Motion sensor triggered ok. But the history_stats Wyze2Motion5m didn’t change from 0 to 1.
Do you have any errors related to the recorder in your log?
Have you excluded the motion sensor from the recorder?
hate to hijack a thread, but i am having similar issues where i am not getting any data on history_stats
sensors… I created a sensor to see if my AC was on heat or cool. here is what i have as that sensor sensor.
- name: "HVAC Activity Upstairs"
unique_id: ui_template_hvac_activity_upstairs
state: >
'{{ state_attr("climate.upstairs_thermostat", "hvac_action") }}'
Looking at the developer tools, it is capturing the states as either ‘idle’, ‘heating’, or ‘cooling’:
I also looked at the history for it and i see it is capturing data:
i then created the daily sensors for ‘heating’ and ‘cooling’ as below:
# Thermostat Day
- platform: history_stats
name: Thermostat Heating Today Upstairs
entity_id: sensor.hvac_activity_upstairs
state: 'heating'
type: time
start: '{{ now().replace(hour=0, minute=0, second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: Thermostat Cooling Today Upstairs
entity_id: sensor.hvac_activity_upstairs
state: 'cooling'
type: time
start: '{{ now().replace(hour=0, minute=0, second=0) }}'
end: '{{ now() }}'
they always show 0.0 on the stats, i would expect them to be showing some rolling total throughout the day. I am sure i am missing something on my end, but i can’t figure out what it is.
Looks like there might be an issue. Could you folks please add your configurations (correctly formatted) to this:
I don’t think so, look at his states, they have quotes. There shouldn’t be quotes.
Normal string states do not have quotes inside the state. It’s just the word.
Oh. Good eyes.
@sebby This:
state: >
'{{ state_attr("climate.upstairs_thermostat", "hvac_action") }}'
Should be:
state: >
{{ state_attr("climate.upstairs_thermostat", "hvac_action") }}
Quotes outside the template are only required when using single line templates, like this:
state: '{{ state_attr("climate.upstairs_thermostat", "hvac_action") }}'
No I didn’t see any errors from the log. Also it is not excluded from recorder.
It was working fine for more than 1 year. It stopped working since I did the update of the latest container. No change on the configuration.
post a screenshot of your binary sensor in developer tools → states page. You have @sebby have different issues.
can you post a screenshot of it in the table below, not in the set state box
Based on your current configuration and the screenshots, it should be working. Are you positive it’s not working? It’s only looking at the last 5 minutes. The only other suggestion I could see causing the problem is that your duration is not in quotes.
After further checking carefully, I found that it is actually working but with delay on the updating Wyze2Motion5m.
Here are the trigger entries on the motion sensor:
Cleared (no motion detected)
8:46:16 AM - 8 seconds ago
Detected motion
8:45:34 AM - 1 minute ago
Cleared (no motion detected)
8:43:11 AM - 3 minutes ago
Detected motion
8:42:29 AM - 4 minutes ago
Below is the history graph on Wyze2Motion5m:
As can see there is delay about 40+ seconds.
I have same setup for two motion sensors, they all behave same (delay updating on the history_stats entities).
I have a similar problem, after updating to version 2022.5.3 history stats stopped counting
- platform: history_stats
name: Ogrzewanie dzisiaj Pompa
entity_id: switch.pompa_ciepla_t06
state: "on"
type: time
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"
other similar entities in history stats are also silent
13.05.2022 - it’s working
Do you notice any delay on the history_stats entities?
Excuse me Guys
I try to do the same thing with my Netatmo Thermostat. Have the daily duration of heating mode.
I have
- platform: history_stats
name: Thermostat Actif
entity_id: sensor.statut_netatmo
state: "heating"
type: time
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"
And
- sensors:
- name: "statut_netatmo"
friendly_name: 'Statut Thermostat'
unique_id: 9dd89288-41d4-46ca-acc5-d03e462ae987
value_template: "{{ state_attr('climate.salon', 'hvac_action') }}"
And i have always
What’s wrong?
Is there a syntax problem?
Have you Restarted HA? Is recorder:
in configuration.yaml?
yes, i restard many times…
And i have recorder in config:
Then it should be working as long as there’s a history for sensor.statut_netatmo, and it has the entity_id of sensor.statut_netatmo.
Also, I just noticed your template sensor is mixing the old style templates with the new style. You need to stick with the old style or the new style, not a mixture of both. I.e. Use the official documents examples, not posts on the forum.