I’m trying to understand a warning in the logs.
I have a template sensor that sums up values every time a dependent state changes.
- sensor:
- name: Total House Gallons
unique_id: droplet_total_house_gallons
unit_of_measurement: "gal"
device_class: water
state_class: total
state: >
{{ states('sensor.droplet_e67c_water')|float(0) + this.state|float(0) }}
But this generates a template loop warning, and I’m not seeing why. It’s not like the sensor is using something like a template that includes ALL (including itself) sensors:
{{ states.sensor| ... .
Could it be it’s somehow self-referencing with this.state?
I thought the template sensors only watched the explicit sensors listed.
2025-10-15 14:13:09.208 WARNING (MainThread) [homeassistant.components.template.template_entity] Template loop detected while processing event: <Event state_changed[L]: entity_id=sensor.total_house_gallons, old_state=<state sensor.total_house_gallons=-0.00878372074090844; state_class=total_increasing, unit_of_measurement=gal, device_class=water, friendly_name=Total House Gallons @ 2025-10-15T14:13:09.205775-07:00>, new_state=<state sensor.total_house_gallons=-0.00839538782394196; state_class=total_increasing, unit_of_measurement=gal, device_class=water, friendly_name=Total House Gallons @ 2025-10-15T14:13:09.207246-07:00>>, skipping template render for Template[{{ states('sensor.droplet_e67c_water')|float(0) + this.state|float(0) }}]
I solved it by adding an explicit trigger, but what was triggering the loop w/o the trigger?
triggers:
- trigger: state
entity_id: sensor.droplet_e67c_water
BTW, I’m using device_class total instead of total_increasing because the sensor can report a negative value. I guess water can flow uphill…
The volume reported by Droplet over local API is point-to-point, meaning that each new value represents the difference in volume recorded since this data was last sent.
This device also reports a flow rate in g/m. How does using the integration sensor platform differ from just adding up as above?
- platform: integration
source: sensor.droplet_e67c_flow_rate
name: "Flow-based Total Water Usage"
round: 2
unit_time: min
method: left
Thanks,