I have several Shelly Uni plus devices wired to a set of roller shutter doors.
Each door has a door up and a door down position sensor wired to inputs 0 and 1 of the Shelly
The Shelly’s report the state of an input when its state changes via MQTT.
There are therefore 4 states of the door. Up ( both inputs 1 ) , Down ( both inputs 0 ) , Transiting up and transiting down ( dependent on where the door was before and 1 on the down and 0 on the up switch ) . I can reduce that to Up, Down and transiting.
I want to display something on a dashboard. Door and position up, down, in motion. ( gould be Red, Green and Amber as well )
So far my approach has been to establish a Helper for each door to retain the state of each input so RollerDoor1_up, RollerDoor1_down and another to hold the state. A numeric value, 0,1,2
Q1 - Is there a way to run a script (?) each time an MQTT message comes in from a topic ie rollerDoor1/status, view the payload and set the state helper depending on the state of the two inputs.
An incoming MQTT message will set the new position of up or down helper depending on the input received and then run a script somewhere that further sets the state of the door position helper?
Q2 - How to display my door states on my dashboard.
I am really new to HA, just in the midst of transitioning/onboarding from Homematic