I have a sunshade and can control it through HomeAssistant with a IR relay box, so I have seperate buttons configured in HA to control the movement. This means HA does not know at what percentage the shade is rolled out, if this explanation makes sense .
However, I thought of the following, but my program skills are zero so if somebody could help me code this that would be great!
What I would like to make is a template sensor that will display the latest action pressed of two of the three buttons.
As you can see the status is a date and timestamp. What I would like to have is two (up and down) combined and show the STATE of the last pressed one, so it would be something like this.
{% if states("button.sunscreen.down" == PRESSED AS LAST %}
Down
{% else states("button.sunscreen.up" == PRESSED AS LAST %}
Up
{% endif %}
As I said, Iām an IT guy but I have no knowledge in programming, I can read it but I have no clue how to write or parse code for this kind of stuff. So if somebody can shine a light on this for me, that would be great!
So this creates a list of [datetime] : friendly name of the buttons.
Then it takes the maximum value of the state as the key and finds the value (meaning the friendly name).
Couldāve think of this myself lol. thanks!
Itās just looking what value is āearlierā in this code, right? if Down is greater than up it will show Down otherwise up.
However, it does not āacceptā the current code.