Page 1 of 1

MQTT notification

Posted: Saturday 17 April 2021 20:29
by devros
Would be great to add support option for MQTT notification. Similar to HTTP but to MQTT chanell. Or I missed something and somehow it works?

Re: MQTT notification

Posted: Saturday 17 April 2021 22:55
by FireWizard
Hi,

Can you explain in more detail what you mean with:
add support option for MQTT notification. Similar to HTTP but to MQTT chanell.
What should be notified and when?
What kind of notification should be send?

Regards

Re: MQTT notification

Posted: Sunday 18 April 2021 22:54
by devros
In setting Notification is Custom HTTP/Action, so just add Custom MQTT/Action with similar fields like HTTP action (subject, topics etc...)

I wrote simple python script as workaround
1/ install mosquitto
2/ set custom HTTP action and create this script, copy to /Domoticz/script/python folder
3/ and set URL action to this script://python/message.py #SUBJECT, #MESSAGE

Code: Select all

#!/usr/bin/env python3
import subprocess
import sys
try:
  command = sys.argv[1]
except:
  print("no input")
  command = 'X'
p = subprocess.Popen(["mosquitto_pub",  "-h", "YOUR_MQQT_IP", "-t",  "message", "-m", command])