This should be relatively simple and could find a lot of utility while creating automations. Right now we end up creating helper variables and that becomes a mess…instead if any device/entity can have key/value pairs get/set able…that’ll make things cleaner and a lot more capable.
Example - if my device was automatically turned on by motion - i can set a flag for that device and auto turn off on no motion. But if it was turned on manually - then i leave it on without turning it off!
It’ll be great if we can add a ttl to the key/value pairs as well
The other use case I have is - using a dimmer switch to cycle between scenes for a room. If i want to maintain the current scene active - i need to create a helper variable for that. Is there a better way of doing this?
I want to be able to switch between “default” → “relax” → “bright” → “all off” scenes when i press up/down. Ideally if the switch could maintain “current active scene” name, then its easy to switch to the next/prev scene on button press.
The current common practice to achieve this is by employing an input_select and using its select_next and select_previous service calls to step through its options (in this case, your scene names).
The issue is - i need to create helpers for every single room/device i want to cycle through stuff. And that was why I wanted to know if this can be a more generic system to add extra custom data (key/value) pairs that can be get/set for every device/entity that HA manages. And with the flexibility - there could be a lot more creativity/flexibility in creating automations.
Basically you are asking for a global variable that can contain a dictionary. Plus services to manage the dictionary.
If you search the community forum for “global variables” you’ll see it’s a long-standing (years) but unfulfilled request. In other words, it may be a long time (if ever) before this FR is implemented. In the interim, consider using input_selects (one per room shouldn’t be a problem unless we’re talking about a hotel).