Open mariusz-schimke opened 1 year ago
I think it would also be interesting to have "substitutions per include":
Instead of and endless specification of bluetooth sensors like this:
sensor:
- platform: atc_mithermometer
mac_address: "A4:C1:38:5B:0E:DF"
temperature:
name: "ATC1 Temperature"
humidity:
name: "ATC1 Humidity"
battery_level:
name: "ATC1 Battery"
battery_voltage:
name: "ATC1 Voltage"
- platform: ble_rssi
mac_address: "A4:C1:38:5B:0E:DF"
name: "ATC1 RSSI"
- platform: atc_mithermometer
mac_address: "A4:C1:38:02:7E:11"
[...]
It would be nice to be able to define one template:
- platform: atc_mithermometer
mac_address: "${MAC}"
temperature:
name: "${ID} Temperature"
humidity:
name: "${ID} Humidity"
battery_level:
name: "${ID} Battery"
battery_voltage:
name: "${ID} Voltage"
- platform: ble_rssi
mac_address: "${MAC}"
name: "${ID} RSSI"
And then invoke it with a single line per sensor:
sensor:
- <<: !include atc_sensor.yaml ATC1 A4:C1:38:5B:0E:DF
- <<: !include atc_sensor.yaml ATC2 A4:C1:38:02:7E:11
[...]
Describe the problem you have/What new integration you would like
The idea I have is making it possible to optionally pass substitutions to individual packages like this:
Please describe your use case for this integration and alternatives you've tried:
I made use of packages for my use case, which is a gas/water/electricity meter based on pulse counting. I extracted the whole metering logic to a separate package to be able to reuse it for different meters. Also, I used substitutions to be able to specify parameters like name, friendly name, pulse per unit, unit, icon etc.
Now I would like to create a multi-purpose device, where metering will be only one of its features. But since substitutions are global, I will have to use prefixes to distinguish those parameters that are specific to the metering logic, not to confuse them with those that will be used for other features. But then the prefix will seem like a redundant piece of text from the point of view of the single-purpose devices, where the metering package represents the only purpose the devices are used for.
So this
would have to be transformed to this to be clear in terms what context it is used in
But I would rather want to have it configured like this (or so):
Additional context