Home Assistant receives a JSON string via MQTT each time one of my garage doors changes state. The door state is a text field, and may be any one of the following:
“Open”, “Closed”, “Opening”, “Closing”, “Stopped”, or “Unknown”.
How do I get Home Assistant’s state machine to store the current state so that I can create automations triggered by a state transition like from: Closed, to: Opening?
The current state as it is defined by my garage door controller (Open, Closed, Opening, Closing, Stoped, or Unknown)
The message generated by the my garage door controller(which normally displays the day, date, and time of the last state change, but will display “beeping …” when the controller is warning anyone inside the garage that someone has remotely triggered a door action, or “signal sent …” when the controller actually signals the door opener to perform an action.)
That is all working perfectly.
My current goal is to have Google Home broadcast a message when specific door state transitions occur. I had expected to be able to use the states as defined by my garage door controller but it seems that Home Assistant only recognizes “state” as a “binary” or “numeric value”.
In this specific case, I only care about the transitions to and from the “Closed” state, so I decided to create a new binary sensor that I can use in my automation. After some syntax wrestling, I got this to work: