I’m trying to figure out how I can change/copy/set the states of a switch from ON/OFF to “MyName1”/“MyName2”
I’m thinking I could do it with a platform template? But do I just set on sensor_name.state or copy the sensor and then use lambda. Or is there some other cool simple trick to redefine the status of a switch (e.g. what if it was a garage door sensor and I wanted to change OPEN/CLOSE state to “DumbassLeftItUp”/“YoureOK”
can u describe why you want to do this? what is the scenario? typically something like this is because you want to show the text differently in a dashboard or something like that… if that is the case it is best to leave the actual switch values alone and key off the values in the UI to show what you want to show.
this is the concept of view/model/controller (Google it if you’re not familiar) which is considered best practice for good reasons!
I have a switch that’s currently on/off. I plan to use it to control two states of a light display. Let’s call it RANDOM and PROGRAMMED.
I have my 4 outputs (lights) and such all working. my “MODE_SWITCH” is presently a GPIO switch type. It all works as I desire.
I want the MODE_SWITCH to reflect “RANDOM” and “PROGRAMMED” instead of on/off.
I realize I could possibly do it at the presentation layer in HA but am seeking to learn YAML as well as Arduino as part of this. (There’s a whole other topic about how to loop things in YAML
)