snarky-snark / home-assistant-variables

A custom Home Assistant component for declaring and setting generic variable entities dynamically.
Apache License 2.0
274 stars 16 forks source link

[Feature] "Wildcard" variable definition #90

Closed mdeweerd closed 1 year ago

mdeweerd commented 1 year ago

I would like to define variables for several entities of the same type without specifying each of them individually.

For instance, I would like to have track the temperature of temperature sensors of a given type in one definition.

For example, this script definition:

alias: test_param
sequence: []
mode: single
fields:
  thermometer:
    name: Thermometer
    required: true
    selector:
      device:
        manufacturer: eWeLink
        model: TH01
        entity:
          domain: sensor
          device_class: temperature

Or, a broader selection (too broad in my case, but should provide some devices on every installation):

alias: test_param
sequence: []
mode: single
fields:
  thermometer:
    name: Thermometer
    required: true
    selector:
      device:
        entity:
          device_class: temperature

And then, based on that kind of filter, define variables for a state of each entity. In my case with force_update that would allow to trigger an automation every time the sensor sends a value even if it is unchanged.

The name of the variable could be named after the original state by appending "_var" for instance (I think there is already a naming mechanism).

snarky-snark commented 1 year ago

This is not on the road map, sorry.