User defined variables across HA

Is there a way to define yaml variables (even with yaml anchoring) that become available across the whole HA env? Something similar how secret file works.
How do you store your alert limits, payloads, etc.? Are they hardcoded in the automations or sensor files? I’d group all such values in one file and make them available across HA.

I know there are custom components like [1], but a set of simple key:value definitions would be enough.

[1] https://github.com/rogro82/hass-variables

Secrets can be used for anything you want accessible that way (even if it’s not sensitive info). I use secrets for a lot of not-sensitive data that I use in multiple spots. Maybe I’m not understanding what you’re saying though.

If you want variable things that you can use in multiple places that you can edit from a Lovelace card you could use an input_number, input_text, etc. and reference that value in your automation/script. I use that in a way that lets me change my thermostat setpoints on the fly if needed (input_number sliders in my frontend).

As well as using the core input.* integrations there are other options:

Storing in an MQTT topic.

Storing in a custom variable integration. Also available in HACS.

The advantage of these three methods over using secrets is that they can be changed without restarting HA.

pretty sure you could create a sensor and increment/decrement/etc the value based on events

Thank you all for your suggestions.
I decided to stick with the secrets file for this, however I’m still missing a native feature for setting key:value pairs that can be used/referenced across the whole HA instance.

So you can use secrets also to use them as variables?
I have lot of Zwave entities that are long and human unfriendly. So if I can add them to the secrets list I can make human friendly variables for example:

  trigger:
    - platform: state
      entity_id:
        - binary_sensor.door_window_sensor_access_control_window_door_is_open_2
        - binary_sensor.door_window_sensor_access_control_window_door_is_open
        - binary_sensor.fibaro_door_window_sensor_2_access_control_window_door_is_open_2
        - binary_sensor.fibaro_door_window_sensor_2_access_control_window_door_is_open

door_diningroom: binary_sensor.door_window_sensor_access_control_window_door_is_open_2
door_bedroom: binary_sensor.door_window_sensor_access_control_window_door_is_open
door_frontdoor: binary_sensor.fibaro_door_window_sensor_2_access_control_window_door_is_open_2

  trigger:
    - platform: state
      entity_id:
        - !secret: door_diningroom
        - !secret: door_bedroom
        - !secret: door_frontdoor

etc?

Or change all entities… but when you need to migrate you get always new entities. So that its easier to update the secret list. But will it be a problem to have many secrets?