I’m attemptingto define the availability criteria for a sensor.
according to the doc, I should be able to specify a template within the availability parameter of my template sensor.
availability template (optional, default: true)
Defines a template to get the
available
state of the component. If the template returnstrue
, the device isavailable
. If the template returns any other value, the device will beunavailable
. If not configured, the component will always beavailable
.
However when I create my sensor as below:
- platform: template
sensors:
bedroom_humidity:
value_template: "{{ states('sensor.bedroom_humidity_raw') | float - 10 }}"
availability: "{{ states('sensor.bedroom_temperature') != 'unavailable' }}"
unit_of_measurement: "%"
device_class: humidity
friendly_name: "Bed room humidity"
I get an error when validating the config:
Invalid config for [sensor.template]: [availability] is an invalid option for [sensor.template]. Check: sensor.template->sensors->bedroom_humidity->availability. (See ?, line ?).
Any help is much appreciated.
(I’m running latest version of HA: 2021.8.8)