diff --git a/src/panels/lovelace/cards/hui-alarm-panel-card.ts b/src/panels/lovelace/cards/hui-alarm-panel-card.ts
index 868e4afc494f..c7965a782799 100644
--- a/src/panels/lovelace/cards/hui-alarm-panel-card.ts
+++ b/src/panels/lovelace/cards/hui-alarm-panel-card.ts
@@ -249,7 +249,7 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
`
)}
- ${!stateObj.attributes.code_format || defaultCode!
+ ${!stateObj.attributes.code_format || defaultCode
? nothing
: html`