Where can I temporarily store arbitrary data (and respond when the stored data is changed)?

In my previous automation controller, it lacked a lot of things, still does. So I used variables as makeshift devices. I want to do something similar in Home Assistant for cases where things are not so on and off which I meant metaphorically but it literally applies in my example, motion-activated lights.

I know there are blueprints for it, but those are literally on and off (which is really convenient, but I want to go a little farther—sand the rough edges); what I [used to-, and want to] do is something more like this:

Instead of shutting down the lights, I dim them so you are not left in the dark and have to walk around a little because the sensor is still hot and won’t immediately respond, all those things. Lights are also dimmed to different levels each state/stage, i.e. nuetralwhite lights are almost killed from the get go, whereas warmwhite lights stay a little brighter. And what to turn them off at the light switch, to go upstairs, exit, whatever but the you need to set an override somewhere that when it is on the sensor won’t turn on the lights again.

What if you’re counting how many times $this happened so then $that is evaluated? Or what if you need to proactively query a device’s state every so often rather than waiting for it to broadcast it to condition automations that otherwise would need to be constantly running (but can’t) so they catch the state change. Is there a[n easy] way to store variables or something similar in Home Assistant?

I found something about variables, but I believe it was for the Home Assistant process, environmental variables, I think they’re called, I’m not sure, but if I were too stupid to get it then that wouldn’t make it easy— Hah-loophole! :grin:

(No— really sorry if I’m repeating the question) Thanks!

If you need to count things, you can use an input number helper. If you need on/off toggles like your $manualOff, you can use a input boolean (aka toggle) helper. You didn’t mention them, but your diagram also calls for timers, which you can start, stop, restart, and trigger automations on finishing.

Just to expand upon the previous answer you can use “input helpers”

From the GUI go to:
Settings → Devices & Services → Helpers

Then click on: Create Helper

They are designed for building GUI elements (Text Boxes, On/Off Toggles, Drop down selects, etc) however they store their state and can have automations attached to them so you can use them as variables.

I have found the most useful to be:

  • Text - Textbox / Free form string.
  • Number - Slider / range limited number
  • Drop Down - Allows you to select an option from a list, effectively an enum
  • Toggle - On off toggle effectively a checkbox

If the device use push, then it is the device that decides when it will update and you will have to look into the firmware at that device.

If it is pull, then you can disable the automatic update process and call your own.
Just understand that the sensor on the device you pull might still update slower, so you might still just pull the same sensor reading several times.