|
|
@ -186,7 +186,7 @@ topics = {
|
|
|
|
"storage_used": f"amcrest2mqtt/{serial_number}/storage/used",
|
|
|
|
"storage_used": f"amcrest2mqtt/{serial_number}/storage/used",
|
|
|
|
"storage_used_percent": f"amcrest2mqtt/{serial_number}/storage/used_percent",
|
|
|
|
"storage_used_percent": f"amcrest2mqtt/{serial_number}/storage/used_percent",
|
|
|
|
"storage_total": f"amcrest2mqtt/{serial_number}/storage/total",
|
|
|
|
"storage_total": f"amcrest2mqtt/{serial_number}/storage/total",
|
|
|
|
"home_assistant": {
|
|
|
|
"home_assistant_legacy": {
|
|
|
|
"doorbell": f"{home_assistant_prefix}/binary_sensor/amcrest2mqtt-{serial_number}/{device_slug}_doorbell/config",
|
|
|
|
"doorbell": f"{home_assistant_prefix}/binary_sensor/amcrest2mqtt-{serial_number}/{device_slug}_doorbell/config",
|
|
|
|
"human": f"{home_assistant_prefix}/binary_sensor/amcrest2mqtt-{serial_number}/{device_slug}_human/config",
|
|
|
|
"human": f"{home_assistant_prefix}/binary_sensor/amcrest2mqtt-{serial_number}/{device_slug}_human/config",
|
|
|
|
"motion": f"{home_assistant_prefix}/binary_sensor/amcrest2mqtt-{serial_number}/{device_slug}_motion/config",
|
|
|
|
"motion": f"{home_assistant_prefix}/binary_sensor/amcrest2mqtt-{serial_number}/{device_slug}_motion/config",
|
|
|
@ -197,6 +197,17 @@ topics = {
|
|
|
|
"host": f"{home_assistant_prefix}/sensor/amcrest2mqtt-{serial_number}/{device_slug}_host/config",
|
|
|
|
"host": f"{home_assistant_prefix}/sensor/amcrest2mqtt-{serial_number}/{device_slug}_host/config",
|
|
|
|
"serial_number": f"{home_assistant_prefix}/sensor/amcrest2mqtt-{serial_number}/{device_slug}_serial_number/config",
|
|
|
|
"serial_number": f"{home_assistant_prefix}/sensor/amcrest2mqtt-{serial_number}/{device_slug}_serial_number/config",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
"home_assistant": {
|
|
|
|
|
|
|
|
"doorbell": f"{home_assistant_prefix}/binary_sensor/amcrest2mqtt-{serial_number}/doorbell/config",
|
|
|
|
|
|
|
|
"human": f"{home_assistant_prefix}/binary_sensor/amcrest2mqtt-{serial_number}/human/config",
|
|
|
|
|
|
|
|
"motion": f"{home_assistant_prefix}/binary_sensor/amcrest2mqtt-{serial_number}/motion/config",
|
|
|
|
|
|
|
|
"storage_used": f"{home_assistant_prefix}/sensor/amcrest2mqtt-{serial_number}/storage_used/config",
|
|
|
|
|
|
|
|
"storage_used_percent": f"{home_assistant_prefix}/sensor/amcrest2mqtt-{serial_number}/storage_used_percent/config",
|
|
|
|
|
|
|
|
"storage_total": f"{home_assistant_prefix}/sensor/amcrest2mqtt-{serial_number}/storage_total/config",
|
|
|
|
|
|
|
|
"version": f"{home_assistant_prefix}/sensor/amcrest2mqtt-{serial_number}/version/config",
|
|
|
|
|
|
|
|
"host": f"{home_assistant_prefix}/sensor/amcrest2mqtt-{serial_number}/host/config",
|
|
|
|
|
|
|
|
"serial_number": f"{home_assistant_prefix}/sensor/amcrest2mqtt-{serial_number}/serial_number/config",
|
|
|
|
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Connect to MQTT
|
|
|
|
# Connect to MQTT
|
|
|
@ -251,6 +262,7 @@ if home_assistant:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if is_doorbell:
|
|
|
|
if is_doorbell:
|
|
|
|
|
|
|
|
mqtt_publish(topics["home_assistant_legacy"]["doorbell"], "")
|
|
|
|
mqtt_publish(
|
|
|
|
mqtt_publish(
|
|
|
|
topics["home_assistant"]["doorbell"],
|
|
|
|
topics["home_assistant"]["doorbell"],
|
|
|
|
base_config
|
|
|
|
base_config
|
|
|
@ -266,6 +278,7 @@ if home_assistant:
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if is_ad410:
|
|
|
|
if is_ad410:
|
|
|
|
|
|
|
|
mqtt_publish(topics["home_assistant_legacy"]["human"], "")
|
|
|
|
mqtt_publish(
|
|
|
|
mqtt_publish(
|
|
|
|
topics["home_assistant"]["human"],
|
|
|
|
topics["home_assistant"]["human"],
|
|
|
|
base_config
|
|
|
|
base_config
|
|
|
@ -280,6 +293,7 @@ if home_assistant:
|
|
|
|
json=True,
|
|
|
|
json=True,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mqtt_publish(topics["home_assistant_legacy"]["motion"], "")
|
|
|
|
mqtt_publish(
|
|
|
|
mqtt_publish(
|
|
|
|
topics["home_assistant"]["motion"],
|
|
|
|
topics["home_assistant"]["motion"],
|
|
|
|
base_config
|
|
|
|
base_config
|
|
|
@ -294,6 +308,7 @@ if home_assistant:
|
|
|
|
json=True,
|
|
|
|
json=True,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mqtt_publish(topics["home_assistant_legacy"]["version"], "")
|
|
|
|
mqtt_publish(
|
|
|
|
mqtt_publish(
|
|
|
|
topics["home_assistant"]["version"],
|
|
|
|
topics["home_assistant"]["version"],
|
|
|
|
base_config
|
|
|
|
base_config
|
|
|
@ -309,6 +324,7 @@ if home_assistant:
|
|
|
|
json=True,
|
|
|
|
json=True,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mqtt_publish(topics["home_assistant_legacy"]["serial_number"], "")
|
|
|
|
mqtt_publish(
|
|
|
|
mqtt_publish(
|
|
|
|
topics["home_assistant"]["serial_number"],
|
|
|
|
topics["home_assistant"]["serial_number"],
|
|
|
|
base_config
|
|
|
|
base_config
|
|
|
@ -324,6 +340,7 @@ if home_assistant:
|
|
|
|
json=True,
|
|
|
|
json=True,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mqtt_publish(topics["home_assistant_legacy"]["host"], "")
|
|
|
|
mqtt_publish(
|
|
|
|
mqtt_publish(
|
|
|
|
topics["home_assistant"]["host"],
|
|
|
|
topics["home_assistant"]["host"],
|
|
|
|
base_config
|
|
|
|
base_config
|
|
|
@ -340,6 +357,7 @@ if home_assistant:
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if storage_poll_interval > 0:
|
|
|
|
if storage_poll_interval > 0:
|
|
|
|
|
|
|
|
mqtt_publish(topics["home_assistant_legacy"]["storage_used_percent"], "")
|
|
|
|
mqtt_publish(
|
|
|
|
mqtt_publish(
|
|
|
|
topics["home_assistant"]["storage_used_percent"],
|
|
|
|
topics["home_assistant"]["storage_used_percent"],
|
|
|
|
base_config
|
|
|
|
base_config
|
|
|
@ -355,6 +373,7 @@ if home_assistant:
|
|
|
|
json=True,
|
|
|
|
json=True,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mqtt_publish(topics["home_assistant_legacy"]["storage_used"], "")
|
|
|
|
mqtt_publish(
|
|
|
|
mqtt_publish(
|
|
|
|
topics["home_assistant"]["storage_used"],
|
|
|
|
topics["home_assistant"]["storage_used"],
|
|
|
|
base_config
|
|
|
|
base_config
|
|
|
@ -369,6 +388,7 @@ if home_assistant:
|
|
|
|
json=True,
|
|
|
|
json=True,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mqtt_publish(topics["home_assistant_legacy"]["storage_total"], "")
|
|
|
|
mqtt_publish(
|
|
|
|
mqtt_publish(
|
|
|
|
topics["home_assistant"]["storage_total"],
|
|
|
|
topics["home_assistant"]["storage_total"],
|
|
|
|
base_config
|
|
|
|
base_config
|
|
|
|