Can someone tell please me how to apply the availability template to my situation?
Even with the examples I’ve seen, I keep getting errors.
I want to prevent my utility meters from showing wrong values if the sensors are not available.
sensor:
- platform: rest
name: meter_a
json_attributes:
- waterflow
- waterquantity
resource: http://192.168.0.101/water.html
- platform: rest
name: meter_b
json_attributes:
- waterflow
- waterquantity
resource: http://192.168.0.100/water.html
template:
- sensor:
name: "meter_a quantity"
state: "{{ ( state_attr('sensor.meter_a','waterquantity')|int) }}"
state_class: "measurement"
unit_of_measurement: "l"
- sensor:
name: "meter_b quantity"
state: "{{ ( state_attr('sensor.meter_b', 'waterquantity')|int ) }}"
state_class: "measurement"
unit_of_measurement: "l"
utility_meter:
daily_meter_a:
source: sensor.meter_a_quantity
cycle: daily
name: daily meter_a
daily_meter_b:
source: sensor.meter_b_quantity
cycle: daily
name: daily meter_b