This part works. They flash or change color. But when the Alarmo system is disarmed, only the smart plugs correctly turn the lights back on. The light switch, however, doesn’t turn the light back on. And the smart bulb stays in the red color state.
Can you advise me on what I should change (towards the end) of this script to force the light switch to turn the light back on, and for the light bulb to return to a white colour state?
First off, bad form using device_id to refer to a device (via type: turn_on); you should switch that to a service that supports the device (light.turn_on?)
I haven’t really diagnosed your existing code, rather I’d recommend replacing everything outside of the repeat action
Before the repeat, create a temporary scene (a “snapshot” which saves the current states of your four devices: on/off state for switch, color data for light)
Thank you for the advice on creating a temporary scene. I used the code your tweaked and it works with the Run Script (under three dots). But when I trigger the Alarmo alarm, it fails to run. Not sure why. I re-started the YAML, etc. I then tried my original (messy) code again and that worked. Then I discovered the reason why my Philips Wiz color light wasn’t reverting back to white. In the settings, you can only list a value in the Color section OR the Color Temperature section—but not both. That is why it didn’t turn white after Alarmo was disarmed. And for my Levitron switch, I unchecked the box Transition, which left only the Brightness Value checked. This solved that problem as well. So, now my original script works.
I like you idea of creating the temporary scene, as that is cleaner code. It’s just that something about that script isn’t activating when my Alarmo is triggered.
For the record, here is my updated script based on my original script.
Not sure what would be preventing it from running. For future reference, if you check Settings > System > Logs you will likely see information related to why things fail as you were initially experiencing. To solve your new problem, you can open the trace data for automations/scripts to see what’s going wrong, where the script or calling automation isn’t going through (clicking the triple dots and choosing Traces)
Hi, I’m trying to do the same ‘lights flash’ when Alarmo is triggered and came across this script.
I appologise in advance for my butchering of the script but I know nothing about coding.
At the moment I just want to get a single lamp to flash as I’m still trying to get my head around Alarmo etc.
This is my butchered code that comes back as valid YAML on all the verifiers I’ve tried, but I get the error 'Message malformed: extra keys not allowed @ data[‘sequence’] when trying to save it in Home Assistant.
I’m running HAOS, fully patched and updated.