I am trying to set up a history_stats sensor to count the number of times my voice assistant recognizes a wake word.
I have added the following to the configuration, but the sensor never shows a value. The logs don’t mention anything helpful either. The binary_sensor works fine.
Any idea what might be going wrong?
sensor:
- platform: history_stats
name: Computer Wakewords per Day
entity_id: binary_sensor.computer_wakeword_detected
state: 'on'
type: count
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
Your code looks correct. What does the sensor show, unknown or unavailable?
1 Like
What does the history of binary_sensor.computer_wakeword_detected
look like? Has it changed state at all during the day?
1 Like
Well, the history used to work fine. But now it shows this
The sensor works, though. Config below:
binary_sensor:
- platform: mqtt
name: Computer Wakeword Detected
state_topic: "rhasspy/de/transition/SnowboyWakeListener"
payload_on: 'listening'
off_delay: 2
Did you maybe exclude the entity from your history?
1 Like
Well, that explains why the history_stats
sensor is unknown. This will happen when there are no state changes for the input entity during the defined period. Of course, if you ask me, for the count
mode I would think the state should be 0
instead of unknown
. But that’s just me.
That was it! Thank you so much! I never would have thought of it! I must have forgotten to include binary sensors in the recorder when I first set it up.