Support AD410 doorbell
This commit is contained in:
@@ -17,8 +17,8 @@ It supports the following environment variables:
|
|||||||
- `HOME_ASSISTANT` (optional, default = false)
|
- `HOME_ASSISTANT` (optional, default = false)
|
||||||
- `HOME_ASSISTANT_PREFIX` (optional, default = 'homeassistant')
|
- `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
|
It exposes events to the `amcrest2mqtt/[SERIAL_NUMBER]/event` MQTT topic. If the device is an AD110 or AD410 doorbell it will expose
|
||||||
doorbell status to `amcrest2mqtt/[SERIAL_NUMBER]/doorbell`. If the device supports motion events it will expose motion events
|
the doorbell status to `amcrest2mqtt/[SERIAL_NUMBER]/doorbell`. If the device supports motion events it will expose motion events
|
||||||
to `amcrest2mqtt/[SERIAL_NUMBER]/motion`.
|
to `amcrest2mqtt/[SERIAL_NUMBER]/motion`.
|
||||||
|
|
||||||
## Device Support
|
## Device Support
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ if home_assistant:
|
|||||||
|
|
||||||
log("Writing Home Assistant discovery config...")
|
log("Writing Home Assistant discovery config...")
|
||||||
|
|
||||||
if device_type == "AD110":
|
if device_type in ["AD110", "AD410"]:
|
||||||
mqtt_publish(doorbell_home_assistant_topic, json.dumps({
|
mqtt_publish(doorbell_home_assistant_topic, json.dumps({
|
||||||
"availability_topic": status_topic,
|
"availability_topic": status_topic,
|
||||||
"state_topic": doorbell_topic,
|
"state_topic": doorbell_topic,
|
||||||
@@ -164,17 +164,15 @@ log("Listening for events...")
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
for code, payload in camera.event_actions("All", retries=5):
|
for code, payload in camera.event_actions("All", retries=5):
|
||||||
log(str(payload))
|
|
||||||
|
|
||||||
if code == "ProfileAlarmTransmit":
|
if code == "ProfileAlarmTransmit":
|
||||||
mqtt_payload = "on" if payload["action"] == "Start" else "off"
|
mqtt_payload = "on" if payload["action"] == "Start" else "off"
|
||||||
mqtt_publish(motion_topic, mqtt_payload)
|
mqtt_publish(motion_topic, mqtt_payload)
|
||||||
|
elif code == "_DoTalkAction_":
|
||||||
if code == "_DoTalkAction_":
|
|
||||||
mqtt_payload = "on" if payload["data"]["Action"] == "Invite" else "off"
|
mqtt_payload = "on" if payload["data"]["Action"] == "Invite" else "off"
|
||||||
mqtt_publish(doorbell_topic, mqtt_payload)
|
mqtt_publish(doorbell_topic, mqtt_payload)
|
||||||
|
|
||||||
mqtt_publish(event_topic, json.dumps(payload))
|
mqtt_publish(event_topic, json.dumps(payload))
|
||||||
|
log(str(payload))
|
||||||
|
|
||||||
except AmcrestError as error:
|
except AmcrestError as error:
|
||||||
log(f"Amcrest error {error}", level="ERROR")
|
log(f"Amcrest error {error}", level="ERROR")
|
||||||
|
|||||||
Reference in New Issue
Block a user