Alarm - change color on state change

Hello. I have alarm.dash:

alarm:
widget_type: alarm
entity: alarm_control_panel.alarm
title: Alarm
state_map:
“disarmed”: UNLOCKED
“armed_home”: HOUSE-LOCKED
“armed_away”: BACKYARD-LOCKED
“pending”: WARNING
“triggered”: .::ALARM::.

I would like to change widget background or whole dashboard background to red if alarm turns to “triggered” state. It would be great if it could blink but red color is enough. How to do it?

1 Like

thats also something you need to create a custom widget for or change something in the code.
you need to manipulate the JS code for that.

There is an outstanding PR to allow widget states to change background color - I’ll be mergin it in at some point.

2 Likes

I would like to see this too for monitoring my qnap which states Good or Bad

Did this ever get released? I would love to be able to change the color of the alarm button depending on what state the alarm is in.

needs rebase - https://github.com/home-assistant/appdaemon/pull/159

maybe it could be more generic depending on the state map ?

widget_state_style_map:
  "on": "background-color: red"
  "off": $background_style
1 Like

lol yeah the rebase is a little out of my skill zone. I’ll try the generic approach and see if it works though.
Thank you.

would love to test the generic approach if you make it work (shouldn’t be too hard to implement - if you don’t ill do it) as it would be great for an input_select

1 Like

I’m intending to add this but I will probably take a different approach to that PR.

1 Like