Hi everyone, I’m reaching out to see if anyone has encountered a similar issue or can offer some guidance. I’ve been working with a template sensor setup in my smart home system, and while it’s been functional, I’ve run into a snag that I can’t seem to resolve on my own.
The Setup:
I have a template sensor configured to monitor unmonitored power usage across multiple devices. The sensor aggregates data from various power monitoring devices and calculates the total power consumption. Here’s a simplified version of the configuration I’m using:
yaml
- platform: template
sensors:
unmonitored_power:
friendly_name: Unmonitored Power
unique_id: Unmonitored_Power
device_class: power
unit_of_measurement: W
value_template: “{{ (states(‘sensor.legrand_din_power_consumption_module_electricalmeasurement’) | float(0)) - (states(‘sensor.presa_home_network_active_power’) | float(0)) - … | float(0) | round(0)}}”
The Problem:
This setup works perfectly when all the sensors are online and reporting data. However, if any one of the sensors in the group becomes unavailable, the entire group goes down, and the power consumption stops being calculated. This is frustrating because it defeats the purpose of having a consolidated view of my power usage.
What I’ve Tried:
I’ve explored using helper groups to simplify the configuration and make it more maintainable. The idea was to create a group of power sensors that could be summed up without manually editing the template every time a new device is added. However, the same issue persists: if any sensor in the group is unavailable, the entire group fails.
My Question:
Is there a way to configure the sensor group so that it continues to function even if some sensors are offline? I’d love to have the system ignore unavailable sensors or at least provide a partial reading based on the available data.
I’m hopeful that someone in the community has encountered this issue before and found a workaround or a best practice for handling it. Any advice or suggestions would be greatly appreciated!
Thanks in advance for your help!