What I would like to do is create a custom button that shows the bin icon, with it the color of the next bin, with a state (or label) of the number of days till then.
I’m thinking maybe I could configure another sensor that looks at the three above sensors, and sets it’s state to indicate which one has the lowest value… such as ‘black’ or ‘green’ or ‘brown’. I could then use that state to help with logic to configure the icon colour and state value on a card such as custom-button.
Could anyone assist with what code/logic to use to create such a sensor? Or have any other/better ideas to achieve what I’m attempting?
Yeah, I’ve been using HA for a while, certainly before a lot of the UI tools were avaiable, and usually default to the yaml approach as well. I have just recently update a whole heap of climate sensors in rooms to use multiple sensors and average them, and just found the UI way easier.
The above would def be useful to create a sensor to see how many days till the next bin collection.
However, and I probably didn’t explain it very well, my main sticking point is how to identify which bin is next… so that I can set the color of the bin icon on my card to match.
You could test something like this, to see if it works, I just don’t have those types of sensors, so just mocked this up in yaml (fingers crossed it’s correct).
There are likely cleaner ways to do this though, but its a start.
{% if states('sensor.black_bin') | int < states('sensor.green_bin') | int and states('sensor.black_bin') | int < states('sensor.brown_bin') | int %}
Black Bin Out
{% elif states('sensor.green_bin') | int < states('sensor.black_bin') | int and states('sensor.green_bin') | int < states('sensor.brown_bin') | int %}
Green Bin Out
{% elif states('sensor.brown_bin') | int < states('sensor.black_bin') | int and states('sensor.brown_bin') | int < states('sensor.green_bin') | int %}
Brown Bin Out
{% else %}
Something went wrong
{% endif %}