1
0
mirror of synced 2026-03-09 20:13:40 +00:00

Support AD410 doorbell

This commit is contained in:
Daniel Chesterton
2021-02-09 10:13:50 +00:00
parent b84537dd4e
commit 2bf406d7c9
2 changed files with 5 additions and 7 deletions

View File

@@ -17,8 +17,8 @@ It supports the following environment variables:
- `HOME_ASSISTANT` (optional, default = false)
- `HOME_ASSISTANT_PREFIX` (optional, default = 'homeassistant')
It exposes events to the `amcrest2mqtt/[SERIAL_NUMBER]/event` MQTT topic. If the device is an AD110 doorbell it will expose the
doorbell status to `amcrest2mqtt/[SERIAL_NUMBER]/doorbell`. If the device supports motion events it will expose motion events
It exposes events to the `amcrest2mqtt/[SERIAL_NUMBER]/event` MQTT topic. If the device is an AD110 or AD410 doorbell it will expose
the doorbell status to `amcrest2mqtt/[SERIAL_NUMBER]/doorbell`. If the device supports motion events it will expose motion events
to `amcrest2mqtt/[SERIAL_NUMBER]/motion`.
## Device Support

View File

@@ -138,7 +138,7 @@ if home_assistant:
log("Writing Home Assistant discovery config...")
if device_type == "AD110":
if device_type in ["AD110", "AD410"]:
mqtt_publish(doorbell_home_assistant_topic, json.dumps({
"availability_topic": status_topic,
"state_topic": doorbell_topic,
@@ -164,17 +164,15 @@ log("Listening for events...")
try:
for code, payload in camera.event_actions("All", retries=5):
log(str(payload))
if code == "ProfileAlarmTransmit":
mqtt_payload = "on" if payload["action"] == "Start" else "off"
mqtt_publish(motion_topic, mqtt_payload)
if code == "_DoTalkAction_":
elif code == "_DoTalkAction_":
mqtt_payload = "on" if payload["data"]["Action"] == "Invite" else "off"
mqtt_publish(doorbell_topic, mqtt_payload)
mqtt_publish(event_topic, json.dumps(payload))
log(str(payload))
except AmcrestError as error:
log(f"Amcrest error {error}", level="ERROR")