Shut off the ONVIF to MQTT plugin running in Docker this past week and removing it today.
I kept seeing these errors in the HA logs ==>
PullPointSubscription request and over time these would lock up the Hikvision DB.
I was using the HA ONVIF plugin but not for PIR motion and recently enabled some functionality and it works great.
Using this function: MyMotionDetectorRule Cell Motion in an automation as follows.
Here is a log trace of the function working:
platform: state
entity_id: binary_sensor.mymotiondetectorrule_cell_motion_detection
from: 'off'
to: 'on'
for: '1'
I am still publishing the onvif/motion MQTT statement to trigger an ESP relay connected to the alarm panel here.
id: '1617704971484'
alias: Front Doorbell PIR
description: ''
trigger:
- platform: state
entity_id: binary_sensor.mymotiondetectorrule_cell_motion_detection
from: 'off'
to: 'on'
for: '1'
condition: []
action:
- service: media_player.play_media
data:
media_content_id: amzn_sfx_doorbell_chime_01
media_content_type: sound
target:
device_id:
alexa device ID
- service: mqtt.publish
data:
topic: onvif2mqtt/Doorbell/motion
payload: 'ON'
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
- service: mqtt.publish
data:
topic: onvif2mqtt/Doorbell/motion
payload: 'OFF'
mode: single
Inside of the alarm panel I utilize a micro router firewall running OpenWRT. In the OS of OpenWRT I installed PAHO MQTT (Python).
BusyBox v1.30.1 () built-in shell (ash)
_
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|
|| ||
|||
__||| ||
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
OpenWrt 19.07.5, r11257-5090152ae3
-----------------------------------------------------
root@ICS-HAI:~#
Local startup looks like this:
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
/usr/bin/nohup python3 /overlay/work/DB-MQTT-3.py &
exit 0
Script DB-MQTT-3.py looks like this:
Code:
import paho.mqtt.client as mqtt
MQTTv31 = 3
MQTTv311 = 4
MQTTv5 = 5
message = 'ON'
def on_connect(client,userdata, flags, rc):
client.subscribe("onvif2mqtt/Doorbell/motion")
print("rc: " + str(rc))
def on_message(client, userdata, msg):
global message
print(msg.topic + " " + str(msg.qos) + " " + str(msg.payload))
message = msg.payload
client.publish("Omni/HikVision_PIR/cmnd/POWER",msg.payload);
def on_publish(client, userdata, mid):
print("mid: " + str(mid))
def on_subscribe(client, userdata, mid, granted_qos):
print("Subscribed: " + str(mid) + " " + str(granted_qos))
def on_log(client, userdata, level, buf):
print(buf)
mqttc = mqtt.Client("petetest",protocol=MQTTv311)
# Assign event callbacks
mqttc.on_message = on_message
mqttc.on_connect = on_connect
mqttc.on_publish = on_publish
mqttc.on_subscribe = on_subscribe
# Connect
mqttc.connect("192.168.244.150", 1883)
#mqttc.connect("192.168.1.41", 1883)
# Continue the network loop
mqttc.loop_forever()
The above code triggers this ESP relay running Tasmota with is directly connected to one zone on the Leviton OmniPro 2 alarm panel (this could be any alarm panel).
As I am now only using HA will probably remove the script from use and publish the relay on command from HA instead.
so doing this now:
topic: onvif2mqtt/Doorbell/motion
payload: on
and will do this afterwards:
topic: Omni/HikVision_PIR/POWER
payload: on
BTW this is the piece that HA and Homeseer use for either TTS or Sounds. You can send the sound to all of your Amazon devices or just one.
Here sending the command to the Kitchen Amazon Show device. You can also create an Amazon event which pops up doorbell video when this happens.