I don’t know how to title or categorise this issue as I’m not sure where the problem really falls. The symptom is visible in the below screenshot. An entity is showing ‘Clear’ (on) as its current state, but immediately below it the history module suggests its current state is ‘Detected’ (off).
I noticed this issue as a Node Red flow wasn’t operating as I expected. Getting state history it suggests the binary_sensor.garage_camera_motion
is on, but HA clearly shows its off. I think I can rule out Node Red given HA also exhibits confusion, but nonetheless I updated the node-red-contrib-home-assistant-websocket to the latest version (0.62.3), restarted Node Red, etc.
The entity is provided by the Unifi Protect add-on. The camera motion is comprehensively not detected as I write this - the Unifi app on my phone shows no motion and no one is anywhere near the camera - so I’m confident the binary_sensor should be in the off state. It seems the history state is what is wrong.