Hello all,
I want to connect from domoticz to my node-red instance on the same RPI to control some MQTT systems.
I need to do this preferably from a LUA script. Does anyone have a good simple example of how to publish an mqtt message?
I understand from partial hints and wikis that it should be done with
CommandArray['OpenURL']= and then a JSON line. But I have not been able to find a working example to start experimenting from.
Any help is appreciated.
Bert
LUA command to publish MQTT message
Moderator: leecollings
-
- Posts: 56
- Joined: Wednesday 06 December 2017 16:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: LUA command to publish MQTT message
first install mosquitto_clients
then in your script you can use:
Code: Select all
sudo apt-get install mosquitto_pub
Code: Select all
os.execute('mosquitto_pub -h 127.0.0.1 -t my/topic -m '..myPayload)
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
Who is online
Users browsing this forum: No registered users and 1 guest