neilenns / node-deepstackai-trigger

Detects motion using Deepstack AI and calls registered triggers based on trigger rules.
MIT License
167 stars 28 forks source link

AI System Status is showing disconnected every time after rebooting Home Assistant #423

Closed reesion closed 3 years ago

reesion commented 3 years ago

What trouble are you having? AI System Status (binary_sensor.ai_system_status) is showing disconnected every time after rebooting Home Assistant. I will need to restart the ai-trigger container to bring the status back to "connected"

Have you tried with the sample files? No Have you tried the steps in the troubleshooting guide?

https://github.com/danecreekphotography/node-deepstackai-trigger/wiki/Troubleshooting Ye

Log entries

Please copy and paste all the log messages from the Docker output

Installation details

Additional context

Add any other context about the problem here.

neilenns commented 3 years ago

Do you have retain set to true in the MQTT section of your settings file?

reesion commented 3 years ago

No. I didn't have that set but I have now set it and that seems to fix the issue. Thank you very much.

neilenns commented 3 years ago

Thinking about this a bit more I don't think this is a real fix. The system should be sending "online" MQTT messages periodically. I'll think about this a bit more.

linuxkidd commented 3 years ago

Agreed, the 'retain' is not a good fix. I've had lingering trigger events in MQTT ( BlueIris/admin ) with 'retain' that cause BI to crash during start-up. Took me a good long while to find that issue.

neilenns commented 3 years ago

Notes to myself:

Currently online is published here:

https://github.com/danecreekphotography/node-deepstackai-trigger/blob/d1a11baa957f1956279d1afe154b78132fd34307/src/main.ts#L122

This should probably move inside MqttManager and just be done inside a timer that keeps firing every whatever seconds. If I wanted to get fancy the interval could get specified in the settings file.

neilenns commented 3 years ago

Ok I have a build for you to try @reesion. Change your Docker config so instead of pulling latest it pulls issue423. Then use some sort of MQTT tool (if you are on Windows the MQTT Explorer app from Windows Store is amazing) to clear out the retained status message.

Then fire up everything. You should see a new "online" message pop in every 60 seconds. If you kill HA and restart it will pick up the proper online status at the next health message arrival (within 60 seconds).

reesion commented 3 years ago

Have just tested this and it works.

image

neilenns commented 3 years ago

Noice!!! Thanks. I'll get this released as v5.8.0 later today and let you know when it's out so you can flip back to latest.

neilenns commented 3 years ago

This is now deployed. You can switch your docker tag back to latest @reesion .

reesion commented 3 years ago

Thank you