[90] MQTT Support
Moderators: leecollings, remb0
-
- Posts: 784
- Joined: Wednesday 10 December 2014 13:06
- Target OS: Linux
- Domoticz version: beta
- Location: Bordeaux France
- Contact:
Re: [90] MQTT Support
@nayr, thanx your job.
I test some devices this morning with Android app you références on previous post to read mqtt flow, and it works on last beta.
It's look like you have a great expérience on MQTT.
Is this possible you update the wiki with an exemple showing how to get a dummy switch toggle true MQTT and send it to a device with node red ?
I want to use MQTT but wiki MQTT & wiki flows are very technic and not really accessible.
I test some devices this morning with Android app you références on previous post to read mqtt flow, and it works on last beta.
It's look like you have a great expérience on MQTT.
Is this possible you update the wiki with an exemple showing how to get a dummy switch toggle true MQTT and send it to a device with node red ?
I want to use MQTT but wiki MQTT & wiki flows are very technic and not really accessible.
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
- nayr
- Posts: 354
- Joined: Tuesday 11 November 2014 18:42
- Target OS: Linux
- Domoticz version: github
- Location: Denver, CO - USA
- Contact:
Re: [90] MQTT Support
I have not played with Node-Red at all, well I take that back.. I followed the wiki my with my first foray into MQTT, and did not like the Node-Red component. Since then all my work with MQTT has been direct against the domoticz/in and domoticz/out.
I get the impression Node-Red is only needed to take existing MQTT clients and make them talk w/Domoticz without modification.. well all my MQTT clients are designed specifically for domoticz so they communicate natively without any Node-Red translation.
If your working on a new integration, ignore all the Node-Red crap and just use MQTT as a bi-directional JSON API.. it works much like the URL API except you send/receive the JSON via the MQTT Broker.
this is all you have to send in to set a Dimmer switch with IDX of 1 to level 50:
to set a binary switch with IDX of 1 to ON:
check out my node-domoticz-mqtt module, with it you can use Node JavaScript to spin out scripts/apps in much the same way as the internal Lua, Blocky and Python interpreters.
I get the impression Node-Red is only needed to take existing MQTT clients and make them talk w/Domoticz without modification.. well all my MQTT clients are designed specifically for domoticz so they communicate natively without any Node-Red translation.
If your working on a new integration, ignore all the Node-Red crap and just use MQTT as a bi-directional JSON API.. it works much like the URL API except you send/receive the JSON via the MQTT Broker.
this is all you have to send in to set a Dimmer switch with IDX of 1 to level 50:
Code: Select all
{"command":"switchlight","idx":1,"switchcmd":"Set Level","level":50}
Code: Select all
{"command":"switchlight","idx":1,"switchcmd":"On"}
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
-
- Posts: 73
- Joined: Friday 09 October 2015 19:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [90] MQTT Support
Any chance we can get Kodi support?
I've just added Kodi to Domoticz but looks like we don't get any MQTT messages with status updates
I'm happy to help in any way i can!
I've just added Kodi to Domoticz but looks like we don't get any MQTT messages with status updates
I'm happy to help in any way i can!
-
- Posts: 17
- Joined: Saturday 05 December 2015 0:24
- Target OS: Windows
- Domoticz version: 3.4834
- Contact:
Re: [90] MQTT Support
I added a dummy humidity sensor and use this
But the value of the sensor is updated from the nvalue not from the svalue.
Why??
In this case value of dummy humidity is always equal 1%
Code: Select all
[{"id":"2543a541.b26dba","type":"mqtt-broker","broker":"127.0.0.1","port":"1883","clientid":""},{"id":"3086682d.a477a8","type":"inject","z":"7d53d511.239b3c","name":"Update Data","topic":"","payload":"{\"idx\": 161, \"nvalue\": 1, \"svalue\": \"456\" }","payloadType":"str","repeat":"1","crontab":"","once":false,"x":225,"y":363,"wires":[["e61556e0.5bd898"]]},{"id":"e61556e0.5bd898","type":"mqtt out","z":"7d53d511.239b3c","name":"Domoticz In","topic":"domoticz/in","qos":"","retain":"","broker":"2543a541.b26dba","x":435,"y":443,"wires":[]}]
Why??
In this case value of dummy humidity is always equal 1%
-
- Posts: 17
- Joined: Saturday 05 December 2015 0:24
- Target OS: Windows
- Domoticz version: 3.4834
- Contact:
Re: [90] MQTT Support
And another question:
Below my function for update temperature+humidity
(it is the same when I uncomment the commented line)
But when I look in the setup->Devices I see this but not as in the non-MQTT version
Below my function for update temperature+humidity
(it is the same when I uncomment the commented line)
But when I look in the setup->Devices I see this but not as in the non-MQTT version
Code: Select all
if (msg.nodeId == 25 & msg.payload !="\n" & msg.messageType == 1)
{
var msg_new = {};
msg_new.payload = {};
msg_new.payload.idx = 162,
msg_new.payload.nvalue = 0,
msg_new.payload.svalue = ""+context.global.temp+";"+context.global.hum+"";
//msg_new.payload = {"idx": 162, "nvalue": 1, "svalue": "4;1" }
return msg_new;
}
Last edited by Lyubomyr on Wednesday 27 April 2016 2:17, edited 1 time in total.
-
- Posts: 17
- Joined: Saturday 05 December 2015 0:24
- Target OS: Windows
- Domoticz version: 3.4834
- Contact:
Re: [90] MQTT Support
And another question^
what is the difference between nvalue and svalue? Some sensors and actuators use nvalue others use svalue!
what is the difference between nvalue and svalue? Some sensors and actuators use nvalue others use svalue!
-
- Posts: 476
- Joined: Monday 14 March 2016 13:55
- Target OS: Linux
- Domoticz version: beta
- Location: Rome, Italy
- Contact:
Re: [90] MQTT Support
Hi
I'm trying MQTT support, but I don't understand how to configure it.
I'm on latest beta, and as far as I understood from the Wiki, no additional SW have to be installed.
What about the configuration of a new MQTT Hw?
What I have to put into Remote Address and Port? And where I can choose username and password in my configuration?
mosquitto is running since if I do
I get results
And what about CA Filename?
I haven't found these info on the Wiki, so I'm here to ask some help.
Thanks
I'm trying MQTT support, but I don't understand how to configure it.
I'm on latest beta, and as far as I understood from the Wiki, no additional SW have to be installed.
What about the configuration of a new MQTT Hw?
What I have to put into Remote Address and Port? And where I can choose username and password in my configuration?
mosquitto is running since if I do
Code: Select all
ps -ef | grep mosq && netstat -tln | grep 1883
And what about CA Filename?
I haven't found these info on the Wiki, so I'm here to ask some help.
Thanks
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
-
- Posts: 476
- Joined: Monday 14 March 2016 13:55
- Target OS: Linux
- Domoticz version: beta
- Location: Rome, Italy
- Contact:
Re: [90] MQTT Support
Got it working!
Just needed to make some config, I found these explanations easy and useful https://www.digitalocean.com/community/ ... -owntracks
and then put the info in the Domoticz panel.
CA is not needed, but maybe is useful for security.
I tried with a MQTT Chrome App to send something after subscribing to domoticz/in and domoticz/out and it seems to work.
I will explore more,sorry to post info request before searching more and more
Just needed to make some config, I found these explanations easy and useful https://www.digitalocean.com/community/ ... -owntracks
and then put the info in the Domoticz panel.
CA is not needed, but maybe is useful for security.
I tried with a MQTT Chrome App to send something after subscribing to domoticz/in and domoticz/out and it seems to work.
I will explore more,sorry to post info request before searching more and more
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
-
- Posts: 57
- Joined: Sunday 04 January 2015 21:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Finland
- Contact:
Re: [90] MQTT Support
If MQTT server is running in a same computer with the Domoticz then you should use following:woody4165 wrote: What I have to put into Remote Address and Port? And where I can choose username and password in my configuration?
Remote address = 127.0.0.1
Port = 1883
Of course you need to create a virtual sensors (create a Dummy device first in Hardware page) that are used receive incoming MQTT data.
-
- Posts: 476
- Joined: Monday 14 March 2016 13:55
- Target OS: Linux
- Domoticz version: beta
- Location: Rome, Italy
- Contact:
Re: [90] MQTT Support
What do you mean by virtual sensor that receive incoming Mqtt data?
Should I send instead mqtt message that contains what I can do with htto/json?
Should I send instead mqtt message that contains what I can do with htto/json?
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
-
- Posts: 57
- Joined: Sunday 04 January 2015 21:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Finland
- Contact:
Re: [90] MQTT Support
I meant that you should create a virtual sensor(s) first and use the IDX(s) of the created sensor(s) in MQTT messages.woody4165 wrote:What do you mean by virtual sensor that receive incoming Mqtt data?
Should I send instead mqtt message that contains what I can do with htto/json?
-
- Posts: 476
- Joined: Monday 14 March 2016 13:55
- Target OS: Linux
- Domoticz version: beta
- Location: Rome, Italy
- Contact:
Re: [90] MQTT Support
Hi all
I'm having issue on let mosquito start at boot
If I run it by command line it's ok, but haven't found a way to let it start as service or during boot?
Can you help me also with some link or instructions?
Thanks
I'm having issue on let mosquito start at boot
If I run it by command line it's ok, but haven't found a way to let it start as service or during boot?
Can you help me also with some link or instructions?
Thanks
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
-
- Posts: 1571
- Joined: Friday 25 March 2016 17:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [90] MQTT Support
Hi all -
i'm interested in the concept of event-driven notifications, but i've a stupid Q (and the forum doesn't let me search on 3 letter-words!) - if i post an update from a 3rd party h/w to MQTT on say a switch state change (on/off), do I need to then write more code to identify and obtain the IDX for this?
I think the Wiki could do with some more info in it - i get the sense there's a lot if implied knowledge in it
i'm interested in the concept of event-driven notifications, but i've a stupid Q (and the forum doesn't let me search on 3 letter-words!) - if i post an update from a 3rd party h/w to MQTT on say a switch state change (on/off), do I need to then write more code to identify and obtain the IDX for this?
I think the Wiki could do with some more info in it - i get the sense there's a lot if implied knowledge in it
Native Alexa skill and Google app - register at https://www.controlicz.com - https://twitter.com/Controlicz
-
- Posts: 57
- Joined: Sunday 04 January 2015 21:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Finland
- Contact:
Re: [90] MQTT Support
I have done this by adding a virtual device to the Domoticz and using a IDX associated to the virtual device in my Arduino based devices. So you don't need to write more code in order to identify and obtain the IDX. You can find my implementations from the github.Madgeni wrote:Hi all -
i'm interested in the concept of event-driven notifications, but i've a stupid Q (and the forum doesn't let me search on 3 letter-words!) - if i post an update from a 3rd party h/w to MQTT on say a switch state change (on/off), do I need to then write more code to identify and obtain the IDX for this?
-
- Posts: 13
- Joined: Wednesday 03 August 2016 8:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.4834
- Location: Netherlands
- Contact:
Re: [90] MQTT Support
Ok, call me a n00b but I am not getting MQTT to work to send data to Influxdb.
What I want to achieve:
Send gas meter (P1) data to influx so I can create cool graphics in Grafana.
The protocol from the gasmeter is not yet supported by Http-Link so I wanted to try something via MQTT.
I created the hardware device:
And according to the log there is a connection:
2016-08-02 11:56:16.123 MQTT: Connecting to xxx.xxx.xxx.xxx:1883
2016-08-02 11:56:16.225 MQTT: connected to: xxx.xxx.xxx.xxx:1883
2016-08-02 11:56:16.325 MQTT: Subscribed
In Node-Red I imported the following:
Node-Red can deploy this without issues and has connection to Domoticz
But still, no info in Influx...
What am I doing wrong??
What I want to achieve:
Send gas meter (P1) data to influx so I can create cool graphics in Grafana.
The protocol from the gasmeter is not yet supported by Http-Link so I wanted to try something via MQTT.
I created the hardware device:
And according to the log there is a connection:
2016-08-02 11:56:16.123 MQTT: Connecting to xxx.xxx.xxx.xxx:1883
2016-08-02 11:56:16.225 MQTT: connected to: xxx.xxx.xxx.xxx:1883
2016-08-02 11:56:16.325 MQTT: Subscribed
In Node-Red I imported the following:
Code: Select all
[{"id":"7b366043.74005","type":"mqtt-broker","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"willQos":"0","birthQos":"0"},{"id":"1be38963.6067a7","type":"mqtt in","z":"ecee940b.146508","name":"Domotic Out","topic":"domoticz/out","broker":"7b366043.74005","x":120,"y":158,"wires":[["962a6069.2b9c5"]]},{"id":"962a6069.2b9c5","type":"function","z":"ecee940b.146508","name":"ToInfluxDB","func":"var date = new Date(msg.payload);\ndata=JSON.parse(msg.payload);\n\nmsg.payload = {}; //null msg obj and create new properties\n\nvar influx_obj = \"[{\";\n\n\ninflux_obj += '\"name\": \"' + data.dtype.split(\" + \").join(\"\") + '\",';\nvar columns='\"columns\": [';\n\ncolumns+='\"idx\", \"nvalue\"';\n\nvar points='\"points\": [[';\n\npoints+= data.idx + ', ' + data.nvalue;\n\nfor (ii=0; ii<10; ii++)\n{\n var vidx = (ii+1).toString();\n var vname = \"svalue\" + vidx;\n if (typeof data[vname] != 'undefined') {\n columns+=', \"' + vname + '\"';\n var vdata=data[vname];\n if (!isNaN(vdata)) {\n points+=', ' + parseFloat(vdata);\n }\n else {\n points+=', \"' + vdata + '\"';\n }\n }\n}\n\n\ncolumns+=']';\npoints+=']]';\n\ninflux_obj+=columns+\",\" + points;\n\ninflux_obj+=\"}]\";\n\nmsg.payload=influx_obj;\n\nreturn msg;","outputs":1,"noerr":0,"x":225,"y":224,"wires":[["df17cf36.7a29f","19155261.c3e15e"]]},{"id":"df17cf36.7a29f","type":"debug","z":"ecee940b.146508","name":"","active":false,"console":false,"complete":false,"x":528.0833129882812,"y":223.08331298828125,"wires":[]},{"id":"19155261.c3e15e","type":"http request","z":"ecee940b.146508","name":"TEST","method":"POST","ret":"txt","url":"http://xxx.xxx.xxx.xxx:8086/db/domoticz/series?u=root&p=root","x":333.08331298828125,"y":317.08331298828125,"wires":[["4bab87f8.cc2218"]]},{"id":"4bab87f8.cc2218","type":"debug","z":"ecee940b.146508","name":"","active":false,"console":false,"complete":false,"x":529,"y":317,"wires":[]}]
But still, no info in Influx...
What am I doing wrong??
Re: [90] MQTT Support
How can I publish some information on domoticz/out when a device (Temperature and Humidity) is updated?
I search on wiki but without success ...
I search on wiki but without success ...
-
- Posts: 57
- Joined: Sunday 04 January 2015 21:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Finland
- Contact:
Re: [90] MQTT Support
I'm using a lua script to publish needed events from the Domoticz. The script can be found from here.Twinsen wrote:How can I publish some information on domoticz/out when a device (Temperature and Humidity) is updated?
I search on wiki but without success ...
Re: [90] MQTT Support
On my system domoticz/out is updated every time my temp+hum sensors are updated:Twinsen wrote:How can I publish some information on domoticz/out when a device (Temperature and Humidity) is updated?.
{
"Battery" : 100,
"RSSI" : 12,
"dtype" : "Temp + Humidity",
"id" : "13825",
"idx" : 93,
"name" : "Badkamer",
"nvalue" : 0,
"stype" : "WTGR800",
"svalue1" : "22.5",
"svalue2" : "58",
"svalue3" : "1",
"unit" : 0
}
Re: [90] MQTT Support
Thank you for the answer.
I recheck the configuration and everything is working now
I recheck the configuration and everything is working now
-
- Posts: 10
- Joined: Wednesday 28 January 2015 22:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [90] MQTT Support
Hello
Anyone knows if I can get the list of devices through mqtt?
I am trying to build a home skill for ALexa using IoT
the send commands is pretty easy
The only thing I am missing is to get a list of all devices in MQTT
Anyone knows if I can get the list of devices through mqtt?
I am trying to build a home skill for ALexa using IoT
the send commands is pretty easy
The only thing I am missing is to get a list of all devices in MQTT
Who is online
Users browsing this forum: No registered users and 0 guests