Looking for a piece of advice regarding an issue with one of the entities (sensors) I’ve created in Home Assistant.
I have 15 smart plugs that measure power consumption and use Zigbee protocol and are connected to HA. I’ve created a /config/sensors.yaml file that combines all 15 smart plugs into one entity called “Active power consumption combined”.
When all 15 plugs are powered everything works fine. But when some of the plugs are offline, the entity behaves weirdly. 50% of the time it is unavailable and shows no data and the other 50% of the time it works fine. Please see attached screenshot for details.
I don’t quite understand what is wrong with my config and why this entity becomes unavailable periodically. Any help is appreciated.
Here is the /config/sensors.yaml file:
# Active consumption combined
- platform: template
sensors:
active_consumption_combined:
friendly_name: 'Active power consumption combined'
value_template: '{{
(states.sensor.smart_plug_01_smartenergy_metering.state | float) +
(states.sensor.smart_plug_02_smartenergy_metering.state | float) +
(states.sensor.smart_plug_03_smartenergy_metering.state | float) +
(states.sensor.smart_plug_04_smartenergy_metering.state | float) +
(states.sensor.smart_plug_05_smartenergy_metering.state | float) +
(states.sensor.smart_plug_06_smartenergy_metering.state | float) +
(states.sensor.smart_plug_07_smartenergy_metering.state | float) +
(states.sensor.smart_plug_08_smartenergy_metering.state | float) +
(states.sensor.smart_plug_09_smartenergy_metering.state | float) +
(states.sensor.smart_plug_10_smartenergy_metering.state | float) +
(states.sensor.smart_plug_11_smartenergy_metering.state | float) +
(states.sensor.smart_plug_12_smartenergy_metering.state | float) +
(states.sensor.smart_plug_13_smartenergy_metering.state | float) +
(states.sensor.smart_plug_14_smartenergy_metering.state | float) +
(states.sensor.smart_plug_15_smartenergy_metering.state | float)
}}'
unit_of_measurement: "W"
Here is the /config/configuration.yaml file:
# Loads default set of integrations. Do not remove.
default_config:
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# My custom sensors
sensor: !include sensors.yaml