From 6ecbbb720519c9db5f8c534cfa876a48cfd13528 Mon Sep 17 00:00:00 2001 From: Daniel Chesterton Date: Mon, 22 Feb 2021 02:00:44 +0000 Subject: [PATCH] Fix bug with Home Assistant discovery and add qos attribute to discovery --- src/amcrest2mqtt.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/amcrest2mqtt.py b/src/amcrest2mqtt.py index 28f2153..979ee37 100644 --- a/src/amcrest2mqtt.py +++ b/src/amcrest2mqtt.py @@ -166,6 +166,7 @@ if home_assistant: base_config = { "availability_topic": topics["status"], + "qos": mqtt_qos, "device": { "name": f"Amcrest {device_type}", "manufacturer": "Amcrest", @@ -218,10 +219,10 @@ if home_assistant: ) mqtt_publish( - topics["storage_used"], + topics["home_assistant"]["storage_used"], base_config | { - "state_topic": topics["home_assistant"]["storage_used"], + "state_topic": topics["storage_used"], "unit_of_measurement": "GB", "icon": "mdi:micro-sd", "name": f"{device_name} Storage Used", @@ -231,10 +232,10 @@ if home_assistant: ) mqtt_publish( - topics["storage_total"], + topics["home_assistant"]["storage_total"], base_config | { - "state_topic": topics["home_assistant"]["storage_total"], + "state_topic": topics["storage_total"], "unit_of_measurement": "GB", "icon": "mdi:micro-sd", "name": f"{device_name} Storage Total",