Hi there,
I just “integrated” my new xmeye-based cheap chinese ip cameras into openhab using tall-r’s great mqtt-bridge over here GitHub - tall-r/dvr-alarm-server: DVR Alarm Server for cheap Chinese cameras. Server listen port 15002 and forward all alarm to MQTT server..
All you need to do is:
- Configure your NVR to send events to your server running the python script
- Create a thing with the appropriate mqtt topics
To configure your NVR, you need to set the alarmserver settings. I’m using the Windows software CMS for this.
Connect your NVR to this software using the device manager. Then open the device configuration → System (Gear icon) → NetService → AlarmServer:
You need to enable the service and adjust the IP to the server where the script is listening. Default is to use 15002 unless you changed it.
Alarm and log report are severities. Log events f.e. are logins to the NVR.
Alarm is seperated into f.e.:
- Motion detection
- Human detection
- Face detection
Where the script is running, you should see something like this (btw, great example ):
2021-06-06T17:42:24.258292 INFO Client connected from NVR_IP
2021-06-06T17:42:24.258873 INFO Payload: { "Address" : "0x00000000", "Channel" : 0, "Descrip" : "", "Event" : "StorageLowSpace", "SerialID" : "XXXXXXXX", "StartTime" : "2021-06-06 17:42:23", "Status" : "Start", "Type" : "Alarm" }
2021-06-06T17:42:24.259057 INFO Alarm Serial: XXXXXXXX/0; Event: StorageLowSpace
2021-06-06T17:42:24.259122 INFO Publish MQTT
2021-06-06T17:42:24.259183 INFO Connecting to MQTT_SERVER:1883
2021-06-06T17:42:24.259244 INFO Publish topic camalarm/XXXXXXXXXX/0/event:StorageLowSpace
Next is to set up your things right. Create a generic MQTT thing and paste this YAML in the code tab while adjusting the stateTopics, broker, UID and number of channels:
UID: mqtt:topic:26b9ec2c:c1dcc5ca67
label: Camera NVR
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:26b9ec2c
channels:
- id: System
channelTypeUID: mqtt:string
label: System
description: ""
configuration:
stateTopic: camalarm/XXXXX/0/event
- id: Channel1
channelTypeUID: mqtt:string
label: Channel 1
description: ""
configuration:
stateTopic: camalarm/XXXXX/1/event
Keepin the StoageLowSpace event, you should see an item linked to the system channel promptly update to StorageLowSpace after creation:
Similar, your other channels and items update f.e. to HumanDetect. You then may create rules to make your smart home self-defend
Pro Tip: Disable the cloud service while in the settings Millions Of Xiongmai Video Surveillance Devices Can Be Hacked Via Cloud Feature (Xmeye P2p Cloud)