-
Notifications
You must be signed in to change notification settings - Fork 0
ezviz MQTT service
Duane McKibbin edited this page Sep 20, 2023
·
1 revision
A simple service that connects to an MQTT broker to enable integration of the ezviz.net API into a home automation system such as Openhab or HomeAssistant.
This library is packaged as two OS specific services
Once the service is installed (see the above OS specific links for details), you will need to setup the appsettings.json file for your environment.
"polling": {
//How often to poll the camera status
"cameras": 5,
//How often to poll the alarms
"alarms": 1,
//Alarms older than this are ignored
"alarmStaleAgeMinutes": 10
},
"ezviz": {
//ezviz API username
"username": "",
//ezviz API password
"password": ""
},
"mqtt": {
//mqtt host name
"host": "",
// mqtt username, blank if not required
"username": "",
// mqtt password, blank if not required
"password": "",
// Retries if MQTT cannot be reached on startup
"connectRetries": 3,
// Time to wait in between retries
"connectRetryDelaySeconds": 60,
// MQTT topics used for integration, {serial} is a placeholder for the camera serial number
"topics": {
// To send commands to a camera
"command": "ezviz/cmnd/{serial}/#",
// Subscribe to this to get status updates per camera
"status": "ezviz/stat/{serial}",
// Subscribe to this to get alarm from the camera
"alarm": "ezviz/alarm/{serial}/set",
// Used to track that the camera is online
"lwt": "ezviz/lwt/{serial}",
// Send command that are not camera specific
"globalCommand": "ezviz/cmnd/global/#",
// Receive state of non-camera specific settings
"globalStatus": "ezviz/stat/global/{command}"
},
// MQTT LWT for the service itself
"serviceLwtTopic": "ezviz/lwt",
"serviceLwtOfflineMessage": "OFF",
"serviceLwtOnlineMessage": "ON"
},
"json": {
// Serialize booleans as
// - Default (1) : true/false like standard json booleans
// - String (2) : As user specified strings, specified in the serializeTrueAs and serialiseFalseAs settings
// - Numbers (3) : 1 for true, 0 for false
"serializeBooleans": 1,
// When using String serialization, the string to use for True
"serializeTrueAs": "ON",
// When using String serialization, the string to use for False
"serializeFalseAs": "OFF"
}
- Camera status messages are sent as JSON objects containing all properties retrieved from the API
- Topic defined in
mqtt.topics.status
- Topic defined in
- Alarms for camera, sent as JSON objects with Base64 image if available
- Topic defined in
mqtt.topics.alarm
- Alarm types:
- Offline
- Motion detected
- Topic defined in
- Commands to send to camera
- Topic defined in
mqtt.topics.command
- Arm/Disarm camera
[topic]/armed
- ON -> Arm
- OFF -> Disarm
- Topic defined in
- Commands to send to the service
- Topic defined in
mqtt.topics.globalCommand
- Arm/Disarm defence mode
[topic]/defenceMode
- Away -> Arm
- Home -> Disarm
- Topic defined in