Fix bug with Home Assistant discovery and add qos attribute to discovery

pull/5/head
Daniel Chesterton 4 years ago
parent e8a7f99152
commit 6ecbbb7205

@ -166,6 +166,7 @@ if home_assistant:
base_config = { base_config = {
"availability_topic": topics["status"], "availability_topic": topics["status"],
"qos": mqtt_qos,
"device": { "device": {
"name": f"Amcrest {device_type}", "name": f"Amcrest {device_type}",
"manufacturer": "Amcrest", "manufacturer": "Amcrest",
@ -218,10 +219,10 @@ if home_assistant:
) )
mqtt_publish( mqtt_publish(
topics["storage_used"], topics["home_assistant"]["storage_used"],
base_config base_config
| { | {
"state_topic": topics["home_assistant"]["storage_used"], "state_topic": topics["storage_used"],
"unit_of_measurement": "GB", "unit_of_measurement": "GB",
"icon": "mdi:micro-sd", "icon": "mdi:micro-sd",
"name": f"{device_name} Storage Used", "name": f"{device_name} Storage Used",
@ -231,10 +232,10 @@ if home_assistant:
) )
mqtt_publish( mqtt_publish(
topics["storage_total"], topics["home_assistant"]["storage_total"],
base_config base_config
| { | {
"state_topic": topics["home_assistant"]["storage_total"], "state_topic": topics["storage_total"],
"unit_of_measurement": "GB", "unit_of_measurement": "GB",
"icon": "mdi:micro-sd", "icon": "mdi:micro-sd",
"name": f"{device_name} Storage Total", "name": f"{device_name} Storage Total",

Loading…
Cancel
Save