I’m at a loss trying to set different colours of buttons etc based on the state of my alarm. I understand the code is embedded in Alarmo. How can I modify this?
You’e talking about ‘buttons’, so I hope this might work for you: I’m using a custom button card:
type: custom:button-card
show_entity_picture: true
state:
- value: disarmed
icon: mdi:alarm-light-off-outline
color: green
- value: armed_home
icon: mdi:alarm-light
color: red
- value: armed_vacation
icon: mdi:alarm-light
color: red
- value: triggered
icon: mdi:alarm-light
color: red
- value: armed_away
icon: mdi:alarm-light
color: red
- value: arming
icon: mdi:alarm-light
color: orange
entity: alarm_control_panel.alarmo
tap_action:
action: call-service
service: script.toggle
service_data:
entity_id: script.alarmo_arm_toggle
show_state: false
show_label: true
size: 40%
name: Alarm is
label: |
[[[
if (states['alarm_control_panel.alarmo'].state === "disarmed")
return "Disarmed";
else if (states['alarm_control_panel.alarmo'].state === "armed_home")
return "Armed Home";
else if (states['alarm_control_panel.alarmo'].state === "armed_away")
return "Armed Away";
else if (states['alarm_control_panel.alarmo'].state === "armed_vacation")
return "Armed Vacation";
else if (states['alarm_control_panel.alarmo'].state === "arming")
return "Arming";
else if (states['alarm_control_panel.alarmo'].state === "triggered")
return "Triggered";
]]]
Beware:
I’ve been using this for ages, so the code/naming conventions might not be according to the latest updates.