In terms of a persistent state through restart, no, not really.
I set a boolean input to drive a switch, since I can set the boolean input to have an Initial state which will then drive the system. I use this for my Flux Light control, which I want to default to On
So I was struggling with this issue and I think I found a solution. Instead of remembering the state, I simply tested the conditions where my alarm would be armed. In my case, when everyone leaves, set the alarm. Also, since a restart can mess with the status of a group, I included an unknown state.
When HomeAssistant starts, it runs this automation. I hope this can help someone else.
trigger:
- platform: homeassistant
event: start
condition:
condition: or
conditions:
- condition: state
entity_id: group.people
state: 'unknown'
- condition: state
entity_id: group.people
state: 'not_home'
action:
- service: script.everyone_leaves`
did you stay with this option? or was there a newer way to approach this.
can you have a sensor that matches the state of the alarm, then use an automation that on restart sets the alarm to that variable state of the sensor?
My solution to this was to use the MQTT Manual Alarm Panel and node-red;
Following a reboot HASS sends an online payload to hass/status, when received node-red records a timestamp to file hassonline
When the alarm is armed and sends its state to home/alarm, node-red writes the status to a file hassalarm
When a disarm message is received to home/alarm, node-red reads in the timestamp from hassonline and checks to see if the disarm message was less that 10 seconds after it.
If it was less than 10 seconds it reads the state from hassalarm, and issues the correct command to home/alarm/set to set the alarm again based on its previous state (ARM_AWAY or ARM_HOME) if it was previously disarmed it sends no command.
If it was over 10 seconds node-red writes the disarmed state to the hassalarm file and does nothing else.
Now I just need to secure the topics in mosquitto to make it a little more secure.
It may be possible to do this with scripts/automation but I haven’t had the time to look properly yet.
Thats pretty smart (although involved) sounds like it works.
I went with HA sending a GET request to node-red - then trigger a node to re-evaluate the status of the people at home. If they arent there, a just left occurs - and the house rearms.