I want the frontend to be able to set an calibration offset (don’t want to compile this to the firmware obviously, as this will be different for probably each device) and figured I could do it this way:
number:
- platform: template
name: "Temperature offset"
id: temperature_offset
optimistic: true
min_value: -10
max_value: 10
step: 0.1
restore_value: true
initial_value: 0
on_value:
then:
- component.update: sensor_temperature
- platform: template
name: "Humidity offset"
id: humidity_offset
optimistic: true
min_value: -25
max_value: 25
step: 0.1
restore_value: true
initial_value: 0
on_value:
then:
- component.update: sensor_humidity
sensor:
- platform: aht10
variant: AHT20
temperature:
name: "Temperature"
id: sensor_temperature
accuracy_decimals: 1
filters:
- lambda: return x + id(temperature_offset).state;
humidity:
name: "Humidity"
id: sensor_humidity
accuracy_decimals: 1
filters:
- lambda: return x + id(humidity_offset).state;
- platform: ens160_i2c
address: 0x53
aqi:
name: "AQI"
id: aqi
accuracy_decimals: 2
eco2:
name: "eCO2"
tvoc:
name: "Tvoc"
compensation:
temperature: sensor_temperature
humidity: sensor_humidity
But getting the following yaml linting error:
ID 'sensor_temperature' of type sensor::Sensor doesn't inherit from PollingComponent. Please double check your ID is pointing to the correct value.
Autocomplete even helps me type it, just ends up being illegal
It’s just an aesthetic thing of course, re-sending the value after changing the value so I don’t have to wait 60s after a value change. I’m sure this must be possible?