|
|
|
@ -202,6 +202,8 @@ def get_device(amcrest_host, amcrest_port, amcrest_username, amcrest_password, d
|
|
|
|
"hardware_version": hardware_version,
|
|
|
|
"hardware_version": hardware_version,
|
|
|
|
"vendor": vendor,
|
|
|
|
"vendor": vendor,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
"telemetry": {
|
|
|
|
|
|
|
|
},
|
|
|
|
"topics": {
|
|
|
|
"topics": {
|
|
|
|
"config": f'{config["mqtt"]["prefix"]}/{serial_number}/config',
|
|
|
|
"config": f'{config["mqtt"]["prefix"]}/{serial_number}/config',
|
|
|
|
"status": f'{config["mqtt"]["prefix"]}/{serial_number}/status',
|
|
|
|
"status": f'{config["mqtt"]["prefix"]}/{serial_number}/status',
|
|
|
|
@ -438,7 +440,7 @@ def refresh_device(device):
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}, json=True)
|
|
|
|
}, json=True)
|
|
|
|
mqtt_publish(device['topics']['telemetry'],
|
|
|
|
mqtt_publish(device['topics']['telemetry'],
|
|
|
|
device['telemetry'] if 'telemetry' in device else {},
|
|
|
|
dumps(device['telemetry']),
|
|
|
|
json=True)
|
|
|
|
json=True)
|
|
|
|
|
|
|
|
|
|
|
|
def refresh_storage_sensors():
|
|
|
|
def refresh_storage_sensors():
|
|
|
|
@ -568,7 +570,7 @@ async def main():
|
|
|
|
device_config = device["config"]
|
|
|
|
device_config = device["config"]
|
|
|
|
device_topics = device["topics"]
|
|
|
|
device_topics = device["topics"]
|
|
|
|
async for code, payload in device["camera"].async_event_actions("All"):
|
|
|
|
async for code, payload in device["camera"].async_event_actions("All"):
|
|
|
|
log(f"Event on {host}: {str(payload)}")
|
|
|
|
log(f"Event on {host} - {code}: {payload['action']}")
|
|
|
|
if ((code == "ProfileAlarmTransmit" and device_config["is_ad110"])
|
|
|
|
if ((code == "ProfileAlarmTransmit" and device_config["is_ad110"])
|
|
|
|
or (code == "VideoMotion" and not device_config["is_ad110"])):
|
|
|
|
or (code == "VideoMotion" and not device_config["is_ad110"])):
|
|
|
|
motion_payload = "on" if payload["action"] == "Start" else "off"
|
|
|
|
motion_payload = "on" if payload["action"] == "Start" else "off"
|
|
|
|
|