@
dpw_
Very nice DNS script.
What MFG / Firmware do you have on your DB?
Using Batch Configuration here enabled ONVIF on my DB and running
ONVIF2MQTT
I am currently using a PAHO-MQTT Python script running on a micro Openwrt router (inside of the alarm panel) which trigger an ESP01 relay with Tasmota firmware on it which hard wire triggers a zone on the alarm panel.
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()
/etc/rc.local running on OpenWRT microrouter (expanded to 32Gb for installation of Python).
# 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
The Omni/HikVision_PIR/cmnd/POWER ==> Tasmota ESP01 relay.
View attachment 86962
Before utilizing the script I was triggering the ESP01 relay with Home Assistant MQTT and or Homeseer (mcsMQTT) automation events that used MQTT. The PIR event also triggers Alexa TTS utilize Alexa Media Player for HA.