resend availability if disconnected

This commit is contained in:
blakeblackshear 2019-02-28 06:30:34 -06:00
parent df7b90e367
commit 80f7e998ae
2 changed files with 7 additions and 3 deletions

View File

@ -46,9 +46,10 @@ Access the mjpeg stream at http://localhost:5000
- [x] Add last will and availability for MQTT
- [ ] Build tensorflow from source for CPU optimizations
- [ ] Add ability to turn detection on and off via MQTT
- [ ] MQTT reconnect if disconnected (and resend availability message)
- [x] MQTT reconnect if disconnected (and resend availability message)
- [ ] MQTT motion occasionally gets stuck ON
- [ ] Output movie clips of people for notifications, etc.
- [ ] Integrate with homeassistant push camera
- [x] Store highest scoring person frame from most recent event
- [x] Add a max size for motion and objects (height/width > 1.5, total area > 1500 and < 100,000)
- [x] Make motion less sensitive to rain

View File

@ -139,12 +139,15 @@ def main():
object_cleaner.start()
# connect to mqtt and setup last will
def on_connect(client, userdata, flags, rc):
print("On connect called")
# publish a message to signal that the service is running
client.publish(MQTT_TOPIC_PREFIX+'/available', 'online', retain=True)
client = mqtt.Client()
client.on_connect = on_connect
client.will_set(MQTT_TOPIC_PREFIX+'/available', payload='offline', qos=1, retain=True)
client.connect(MQTT_HOST, 1883, 60)
client.loop_start()
# publish a message to signal that the service is running
client.publish(MQTT_TOPIC_PREFIX+'/available', 'online', retain=True)
# start a thread to publish object scores (currently only person)
mqtt_publisher = MqttObjectPublisher(client, MQTT_TOPIC_PREFIX, objects_parsed,