I have an automation that increments a counter once per minute, but it “fires” twice and seems to update a copy of the counter. The counter and its ghost maintain different values.
The Logbook shows events like these:
The Reset automation acts on only one of the counters, which goes to zero. The ghost counter keeps its value and keeps incrementing once per minute.
I renamed the counter and the automation in the configuration, thinking that the ghosts might retain the original name, but everything shows with the new names.
In the History, the line graph bounces between the two:
Here are my automations:
- alias: Reset HVAC Operation Minute Counter
initial_state: 'on'
trigger:
platform: state
entity_id: sensor.hvac_operation
action:
- service: counter.reset
entity_id: counter.hvac_operation_minute_counter
- alias: Increment HVAC Operation Minute Counter
initial_state: 'on'
trigger:
platform: time_pattern
minutes: '/1'
seconds: '00'
action:
- service: counter.increment
entity_id: counter.hvac_operation_minute_counter
Here is my counter:
counter:
hvac_operation_minute_counter:
icon: mdi:progress-clock
# name: HVAC Operation Timer
initial: 0
step: 1
For completeness, here is the sensor that triggers the reset:
- platform: template
sensors:
hvac_operation:
friendly_name: HVAC Operation
value_template: "{{ states.climate.springville_house.attributes.operation | capitalize }}"
icon_template: >
{% if states.climate.springville_house.attributes.operation %}
{% if states.climate.springville_house.attributes.operation == 'cool' %}
mdi:air-conditioner
{% elif states.climate.springville_house.attributes.operation == 'heat' %}
mdi:radiator
{% elif states.climate.springville_house.attributes.operation == 'fan' %}
mdi:fan
{% else %}
mdi:fan-off
{% endif %}
{% endif %}
Just one shows in Developer Tools:
Any idea what could be going on or what to look at?