dmitrif / onvif2mqtt

Translate ONVIF events (from IP Cameras) to MQTT messages.
Other
113 stars 31 forks source link

New Installation #40

Open peteeee opened 3 years ago

peteeee commented 3 years ago

Great application.

Been using it since the beginning and it has worked well for me with the Hikvision DB2 doorbell camera / PIR

Last week moved the installation to another computer.

Installed the docker version and all appeared OK seeing it running in mqtt Explorer.

Only thing noticed is that the motion trigger never changed from off to on with motion.

So today installed baremetal ==> 1 - apt install npm 2 - npt install

restarted docker version and tested for motion looking at mqtt explorer.

This time it worked right out of the box.

Curious why I had to install NPM for docker version to work?

I've added another piece here installing paho mqtt on an openwrt router and using a script to trigger a relay on an ESP01 which is hardwired connected to alarm panel. Works well and just is another option for use.

peteeee commented 3 years ago

So new version quit working using the Hikvision DB.

The old version on another computer works well.

No changes have been made the Hikvision DB configuration.

peteeee commented 3 years ago

The logs look fine...just do not see any motion from the PIR.

onvif-cam@1.0.4 start /onvif2mqtt node dist/index.js {"level":30,"time":1620005937808,"msg":"Loading configuration. {\"configPath\":\"/config/config.yml\"}","v":1} {"level":30,"time":1620005937828,"msg":"Validating configuration file.","v":1} {"level":30,"time":1620005937834,"name":"Manager","msg":"Beginning initialization...","v":1} {"level":30,"time":1620005937834,"name":"MQTT","hostname":"192.168.244.150:1883","msg":"Connecting.","v":1} {"level":30,"time":1620005937893,"name":"MQTT","hostname":"192.168.244.150:1883","msg":"Successfully connected.","v":1} {"level":20,"time":1620005937893,"name":"MQTT","hostname":"192.168.244.150:1883","msg":"Publishing. {\"topic\":\"onvif2mqtt/status\",\"value\":\"ON\",\"retain\":true}","v":1} {"level":30,"time":1620005937894,"name":"ONVIF/Doorbell","hostname":"192.168.244.152","msg":"Attempting connection.","v":1} {"level":20,"time":1620005937897,"name":"MQTT","hostname":"192.168.244.150:1883","msg":"Publishing. {\"topic\":\"onvif2mqtt/Doorbell/motion\",\"value\":\"OFF\",\"retain\":true}","v":1} {"level":30,"time":1620006002565,"name":"ONVIF/Doorbell","hostname":"192.168.244.152","msg":"Successfully connected.","v":1} {"level":30,"time":1620006005120,"name":"ONVIF/Doorbell","hostname":"192.168.244.152","msg":"CreatePullPointSubscription Doorbell","v":1} onvif-cam@1.0.4 start /onvif2mqtt node dist/index.js {"level":30,"time":1620086500268,"msg":"Loading configuration. {\"configPath\":\"/config/config.yml\"}","v":1} {"level":30,"time":1620086500273,"msg":"Validating configuration file.","v":1} {"level":30,"time":1620086500277,"name":"Manager","msg":"Beginning initialization...","v":1} {"level":30,"time":1620086500277,"name":"MQTT","hostname":"192.168.244.150:1883","msg":"Connecting.","v":1} {"level":30,"time":1620086500318,"name":"MQTT","hostname":"192.168.244.150:1883","msg":"Successfully connected.","v":1} {"level":20,"time":1620086500319,"name":"MQTT","hostname":"192.168.244.150:1883","msg":"Publishing. {\"topic\":\"onvif2mqtt/status\",\"value\":\"ON\",\"retain\":true}","v":1} {"level":30,"time":1620086500320,"name":"ONVIF/Doorbell","hostname":"192.168.244.152","msg":"Attempting connection.","v":1} {"level":20,"time":1620086500322,"name":"MQTT","hostname":"192.168.244.150:1883","msg":"Publishing. {\"topic\":\"onvif2mqtt/Doorbell/motion\",\"value\":\"OFF\",\"retain\":true}","v":1} {"level":30,"time":1620086500558,"name":"ONVIF/Doorbell","hostname":"192.168.244.152","msg":"Successfully connected.","v":1} {"level":30,"time":1620086502542,"name":"ONVIF/Doorbell","hostname":"192.168.244.152","msg":"CreatePullPointSubscription Doorbell","v":1}

ksupipr commented 3 years ago

The logs look fine...just do not see any motion from the PIR.

Add in this line https://github.com/dmitrif/onvif2mqtt/blob/master/src/onvif/SubscriberGroup.js#L62

this.logger.info('ONVIF received event', { subscriberName, eventType });

All publish events: https://github.com/dmitrif/onvif2mqtt/blob/master/src/onvif/SubscriberGroup.js#L12

The camera can return an event with a different name