[90] MQTT Support
Moderators: leecollings, remb0
Smappee MQTT Support
good morning, I have a problem for the management of smappee. https://www.smappee.com/eu_it/home.
recently smappee has changed the way to manage its switches using the mqtt protocol.
I attach the files that the service has sent to me.
somebody would be able to create a script to manage the switches using the mqtt protocol and how to implement it in domoticz?
recently smappee has changed the way to manage its switches using the mqtt protocol.
I attach the files that the service has sent to me.
somebody would be able to create a script to manage the switches using the mqtt protocol and how to implement it in domoticz?
- Attachments
-
- MQTT broker configuration on Smappee Plus Pro (1).pdf
- (190.71 KiB) Downloaded 141 times
-
- Posts: 8
- Joined: Friday 26 October 2018 21:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: United States
- Contact:
Re: MQTT Support
Hello - I'm a newbie to Domoticz [my son is the teckie who set it up]
In the LOG I see these lines:
2018-10-29 12:25:46.885 MQTT: Topic: domoticz/in, Message: {"idx":4,"nvalue":0,"svalue":"-10.1"}
2018-10-29 12:28:46.295 MQTT: Topic: domoticz/in, Message: {"idx":2,"nvalue":0,"svalue":"-21.2"}
How do I tell WHAT EVENT is issuing them? [my son doesn't know either] ??
How do I tell which DEVICE is :2 and :4 ??
I've scanned the wiki and can't figure it out.
Thanks, Jim
In the LOG I see these lines:
2018-10-29 12:25:46.885 MQTT: Topic: domoticz/in, Message: {"idx":4,"nvalue":0,"svalue":"-10.1"}
2018-10-29 12:28:46.295 MQTT: Topic: domoticz/in, Message: {"idx":2,"nvalue":0,"svalue":"-21.2"}
How do I tell WHAT EVENT is issuing them? [my son doesn't know either] ??
How do I tell which DEVICE is :2 and :4 ??
I've scanned the wiki and can't figure it out.
Thanks, Jim
Re: [90] MQTT Support
In the device list (Settings->Devices) you can see the device index (Idx). This matches to the idx in your MQTT messages. Also watch the log of domoticz
-
- Posts: 8
- Joined: Friday 26 October 2018 21:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: United States
- Contact:
Re: [90] MQTT Support
@SweetPants
Thanks ... here's what I have from Setup > Devices
2 deepfreezer 14052 1 deep-freezer Temp LaCrosse TX3 -4.8 F - - Set Unused Rename Device Log 2018-10-30 14:16:45
4 garagefreezer 14054 1 garage-freezer-temp Temp LaCrosse TX3 10.8 F - - Set Unused Rename Device Log 2018-10-30 14:19:53
and from the logfile:
2018-10-30 14:16:45.255 MQTT: Topic: domoticz/in, Message: {"idx":2,"nvalue":0,"svalue":"-20.5"}
2018-10-30 14:19:53.875 MQTT: Topic: domoticz/in, Message: {"idx":4,"nvalue":0,"svalue":"-11.8"}
So that SOLVES the mystery of what IDX refers to - thanks so much.
QUESTION - The nvalue and svalue do not match the temperature shown in devices. Any idea why not?
Thanks in advance, Jim
Thanks ... here's what I have from Setup > Devices
2 deepfreezer 14052 1 deep-freezer Temp LaCrosse TX3 -4.8 F - - Set Unused Rename Device Log 2018-10-30 14:16:45
4 garagefreezer 14054 1 garage-freezer-temp Temp LaCrosse TX3 10.8 F - - Set Unused Rename Device Log 2018-10-30 14:19:53
and from the logfile:
2018-10-30 14:16:45.255 MQTT: Topic: domoticz/in, Message: {"idx":2,"nvalue":0,"svalue":"-20.5"}
2018-10-30 14:19:53.875 MQTT: Topic: domoticz/in, Message: {"idx":4,"nvalue":0,"svalue":"-11.8"}
So that SOLVES the mystery of what IDX refers to - thanks so much.
QUESTION - The nvalue and svalue do not match the temperature shown in devices. Any idea why not?
Thanks in advance, Jim
Re: [90] MQTT Support
For Temp devices the nvalue( numeric value) is always 0, the svalue (string value) should reflect your device temp. Maybe Fahrenheit to Celcius conversion? You can set that under Settings->Meters/Counters. Default is Cecius.jimbo213Mo wrote: ↑Tuesday 30 October 2018 20:30 QUESTION - The nvalue and svalue do not match the temperature shown in devices. Any idea why not?
-
- Posts: 8
- Joined: Friday 26 October 2018 21:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: United States
- Contact:
Re: [90] MQTT Support
yes that's it ... thanks
-18C = -4F
in settings > meters/counters I have
Meter/Counter Setup
Temperature:
Display: Fahrenheit
Degree Days (Base Temperature): 18.0
There are three [3] other mentions of the garage-freezer
-- setup > device = shows Fahrenheit, type = TEMP, sub-type = LaCrosse TX3
-- temperature > garagefreezer > notifications = shows Fahrenheit
The third place [below] I can't get the TYPE field to show TEMP which would match the device.
TEMP is not in the dropdown !!
Does this assist you in helping me get the notification svalue converted from C to F?
Thanks for sticking with me
Jim
-18C = -4F
in settings > meters/counters I have
Meter/Counter Setup
Temperature:
Display: Fahrenheit
Degree Days (Base Temperature): 18.0
There are three [3] other mentions of the garage-freezer
-- setup > device = shows Fahrenheit, type = TEMP, sub-type = LaCrosse TX3
-- temperature > garagefreezer > notifications = shows Fahrenheit
The third place [below] I can't get the TYPE field to show TEMP which would match the device.
TEMP is not in the dropdown !!
Does this assist you in helping me get the notification svalue converted from C to F?
Thanks for sticking with me
Jim
- Attachments
-
- GF setup-Hardware.png (13.74 KiB) Viewed 3044 times
-
- Posts: 11
- Joined: Monday 30 July 2018 15:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10102
- Location: France
- Contact:
Re: [90] MQTT Support
hello mrf68 and to all,
here I have followed your little tutorial page 16 from Monday 02/2018 with a fictitious idx 178 sensor but nothing works: on the one hand, although at the exit of the 1st node named json I have this :
the idx 178 sensor does not appear or never in the right part (debug): is this normal?
And, at the exit of the function, I have the undefined svalue such as:
(even with the idx 25). Where is the problem?
An idea?
here I have followed your little tutorial page 16 from Monday 02/2018 with a fictitious idx 178 sensor but nothing works: on the one hand, although at the exit of the 1st node named json I have this :
Code: Select all
{
"Battery": 255,
"RSSI": 12,
"description": "",
"dtype": "Usage",
"id": "0000204",
"idx": 25,
"name": "Unknown",
"nvalue": 0,
"stype": "Electric",
"svalue1": "22.5",
"unit": 2
}
And, at the exit of the function, I have the undefined svalue such as:
Code: Select all
"{" command ":" udevice "," idx ": 25," svalue ":" undefined "}"
An idea?
Re: [90] MQTT Support
Hello pat054,
I think you need to check your function node. You need to manually set the idx of the virtual sensor, not the idx of the original input. And don’t forget to put a 1 behind svalue as well (svalue1 instead of svalue).
I think you need to check your function node. You need to manually set the idx of the virtual sensor, not the idx of the original input. And don’t forget to put a 1 behind svalue as well (svalue1 instead of svalue).
-
- Posts: 11
- Joined: Monday 30 July 2018 15:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10102
- Location: France
- Contact:
Re: [90] MQTT Support
Hello mrf68,
Thank you for your reply.
What exactly does your phrase mean " You need to manually set the idx of the virtual sensor, not the idx of the original input."?
For my part, I can not get the result. Here is my installation:
- for the MQTT node :
Server: 192.168.1.17:1883
Topic: domoticz/out
- for the JSON node :
Action: convert between JSON string & object
Property: msg.playload.svalue1
- for the node of the function :
On the Domoticz side, the MQTT equipment is declared and the virtual sensor device (idx 178) is also declared in temperature.
I do not see where it stems except the interpretation of the sentence that I do not understand. In expectation to hear from you, Sincerely.
Thank you for your reply.
What exactly does your phrase mean " You need to manually set the idx of the virtual sensor, not the idx of the original input."?
For my part, I can not get the result. Here is my installation:
- for the MQTT node :
Server: 192.168.1.17:1883
Topic: domoticz/out
- for the JSON node :
Action: convert between JSON string & object
Property: msg.playload.svalue1
- for the node of the function :
Code: Select all
msg.payload = "{\" command \ ": \" udevice \ ", \" idx \ ": 178, \" svalue \ ": \" "+ (msg.payload.svalue1) +" \ "}";
return msg;
I do not see where it stems except the interpretation of the sentence that I do not understand. In expectation to hear from you, Sincerely.
Re: [90] MQTT Support
Hi pat054,
If I look at your new written function, you changed the correct part, so the idx of the virtual sensor is now correct (in my opinion).
I see some extra spaces in the code of the function, that can a problem. You could copy this:
... or change your existing code. There should be no spaces between \ and ". In your code for example, it says:
where it should be:
Can you see the difference?
I hope this info helps. If not, don't hesitate to ask again.
Oh, and I almost forgot: my little 'tutorial' does not mention the part where the info is being sent to Domoticz. When the output of the function is correct and going through the second JSON node, it needs to go into another MQTT node to your broker, with topic
Regards.
As I saw in your example of the exit of the function, you used idx 25, which is the idx of the original sensor, as shown in the exit of your 1st node. I realised that I didn't make it clear enough that the function, where we rebuild the info that has to be processed by Domoticz, needs to have the idx of the virtual sensor that needs to be updated.
If I look at your new written function, you changed the correct part, so the idx of the virtual sensor is now correct (in my opinion).
I see some extra spaces in the code of the function, that can a problem. You could copy this:
Code: Select all
msg.payload = "{\"command\": \"udevice\", \"idx\": 178, \"svalue\": \"" + (msg.payload.svalue1) + "\"}";
Code: Select all
: \" udevice \ ",
Code: Select all
: \" udevice \",
I hope this info helps. If not, don't hesitate to ask again.
Oh, and I almost forgot: my little 'tutorial' does not mention the part where the info is being sent to Domoticz. When the output of the function is correct and going through the second JSON node, it needs to go into another MQTT node to your broker, with topic
Code: Select all
domoticz/in
-
- Posts: 11
- Joined: Monday 30 July 2018 15:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10102
- Location: France
- Contact:
Re: [90] MQTT Support
mrf68,
yes, I see the visual difference.
So I copied your line :
and replaced my line but nothing helps. After a Deploy, the result is always this (on the right of the screen) :
I do not see where the problem can come from!
The problem would not come from the source: Domoticz? (my domoticz is in the latest beta version 4.10303)
When I put a msg.payload at the output of my MQTT (domoticz/out), in debug (on the right of the screen) I do not have in the idx 178 scroll: is this normal?
It is for this reason that in my previous posts I put an idx 25 (which appeared in debug (on the right of the screen)). But the same, I had the same result.
yes, I see the visual difference.
So I copied your line :
Code: Select all
msg.payload = "{\"command\": \"udevice\", \"idx\": 178, \"svalue\": \"" + (msg.payload.svalue1) + "\"}";
Code: Select all
{"command": "udevice", "idx": 178, "svalue": "undefined"}
The problem would not come from the source: Domoticz? (my domoticz is in the latest beta version 4.10303)
When I put a msg.payload at the output of my MQTT (domoticz/out), in debug (on the right of the screen) I do not have in the idx 178 scroll: is this normal?
It is for this reason that in my previous posts I put an idx 25 (which appeared in debug (on the right of the screen)). But the same, I had the same result.
Re: [90] MQTT Support
Hi pat054,
does not exist.
Instead of trying to solve things somewhere in the code, let's start from the beginning.
The exit of your first node says:
You see this probably in the debug tab as a result of the debug node. Change the Properties of that debug node to this:
As a result it should show after receiving the next update from the sensor:
It will probably show a different value, but it should show you a value. Is this working correctly?
This output means that this part"svalue": "undefined"
Code: Select all
(msg.payload.svalue1)
Instead of trying to solve things somewhere in the code, let's start from the beginning.
The exit of your first node says:
Code: Select all
{
"Battery": 255,
"RSSI": 12,
"description": "",
"dtype": "Usage",
"id": "0000204",
"idx": 25,
"name": "Unknown",
"nvalue": 0,
"stype": "Electric",
"svalue1": "22.5",
"unit": 2
}
As a result it should show after receiving the next update from the sensor:
It will probably show a different value, but it should show you a value. Is this working correctly?
-
- Posts: 11
- Joined: Monday 30 July 2018 15:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10102
- Location: France
- Contact:
Re: [90] MQTT Support
mrf68,
ok, at the exit of the 1st node MQTT (domoticz / out), I connected a debug node (msg.payload.svalue1).
After a Deploy, the result is negative (on the right of the screen): domoticz / out: msg.payload.svalue1: undefined
While my 1st MQTT node is seen connected (green LED) below the node
ok, at the exit of the 1st node MQTT (domoticz / out), I connected a debug node (msg.payload.svalue1).
After a Deploy, the result is negative (on the right of the screen): domoticz / out: msg.payload.svalue1: undefined
While my 1st MQTT node is seen connected (green LED) below the node
Re: [90] MQTT Support
Alright, we are getting somewhere.
The output of domoticz/out is every thing that crosses domoticz. We first need to capture the data from that one specific sensor.
Change the properties from the debug node back to normal (= msg.payload) and watch the data come in.
Can you do that and do you see some things flying by?
The output of domoticz/out is every thing that crosses domoticz. We first need to capture the data from that one specific sensor.
Change the properties from the debug node back to normal (= msg.payload) and watch the data come in.
Can you do that and do you see some things flying by?
-
- Posts: 11
- Joined: Monday 30 July 2018 15:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10102
- Location: France
- Contact:
Re: [90] MQTT Support
I redefined the properties of the debug node on normal (= msg.payload) and I observe the scrolled data. Here is an example :
Basically, I get idx 140 (as above) and idx 25, 27, 141, 142, 143, 144, 145, 146, 147..etc.
Etc. is actually limited to 25, 27,141,142,143,140,144,144,146,147. And that's about everything
I think Domoticz only sends idx (devices) that change state
Code: Select all
{
"Battery": 255,
"RSSI": 12,
"description": "",
"dtype": "General",
"id": "0000044D",
"idx": 140,
"name": "CPU_Usage Raspberry",
"nvalue": 0,
"stype": "Percentage",
"svalue1": "12.12",
"unit": 1
}
Etc. is actually limited to 25, 27,141,142,143,140,144,144,146,147. And that's about everything
I think Domoticz only sends idx (devices) that change state
Re: [90] MQTT Support
So far so good. Now add a JSON node and a Switch node like this:
Change the settings of the switch:
... and put the desired idx in the empty fiels after az.
Then watch for the next update. And yes, Domoticz only shows an update in mqtt when the sensor sends an update to Domoticz.
Change the settings of the switch:
... and put the desired idx in the empty fiels after az.
Then watch for the next update. And yes, Domoticz only shows an update in mqtt when the sensor sends an update to Domoticz.
-
- Posts: 11
- Joined: Monday 30 July 2018 15:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10102
- Location: France
- Contact:
Re: [90] MQTT Support
mrf68,
I added the JSON node and the Switch node. And I changed the switch settings such as:
name: msg.payload.idx
== 0/9 140 (from idx)
After Deploy, I have this in the debug screen:
domoticz / out: 29/12/2018 at 16: 01: 53node: ad57d776.782158
domoticz / out: msg.payload.svalue1: string [5] "23.72".
Which corresponds to "Data": "23.72%" of the idx 140 device when the JSON code is entered in the browser: http://192.168.1.17:8080/json.htm?type=devices&rid=140.
So far it is going well.
I added the JSON node and the Switch node. And I changed the switch settings such as:
name: msg.payload.idx
== 0/9 140 (from idx)
After Deploy, I have this in the debug screen:
domoticz / out: 29/12/2018 at 16: 01: 53node: ad57d776.782158
domoticz / out: msg.payload.svalue1: string [5] "23.72".
Which corresponds to "Data": "23.72%" of the idx 140 device when the JSON code is entered in the browser: http://192.168.1.17:8080/json.htm?type=devices&rid=140.
So far it is going well.
Re: [90] MQTT Support
Now add a function node:
... and place in in the line before the debug node. My idx in this example is 368, you should change that to 178. Change the properties of the debug node to msg.payload, so you can see the whole message. It should look like this:
This message will be the input for a virtual temp sensor. Add a MQTT out node and change the settings to your needs. So don't use this ipaddress since it's my local server. What you should use is the topic domoticz/in.
Then connect it to the function node like this:
When a new message shows up in the debug tab, your Domoticz should receive this message as well. Check the virtual sensor if it updated correctly and if not check the Domoticz log.
... and place in in the line before the debug node. My idx in this example is 368, you should change that to 178. Change the properties of the debug node to msg.payload, so you can see the whole message. It should look like this:
This message will be the input for a virtual temp sensor. Add a MQTT out node and change the settings to your needs. So don't use this ipaddress since it's my local server. What you should use is the topic domoticz/in.
Then connect it to the function node like this:
When a new message shows up in the debug tab, your Domoticz should receive this message as well. Check the virtual sensor if it updated correctly and if not check the Domoticz log.
-
- Posts: 11
- Joined: Monday 30 July 2018 15:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10102
- Location: France
- Contact:
Re: [90] MQTT Support
mrf68,
I'm late because my Mosquitto on my Raspberry did not want to connect anymore. I had to reinstall it completely.
I approved your message such as:
- MQTT node domoticz / in:
server: 192.168.1.17:1883
topic: domoticz / in
QOS 2
- JSON node:
action: Convert between JSON string & object
property: msq.payload
- switch node:
property: msg.payload.idx
== 0/9 140
- Node of the function :
- MQTT node domoticz / in:
server: 192.168.1.17:1883
topic: domoticz / in
- debug node:
output: msg.payload
to: debug windows
- The results are:
- pour the debug screen:
- in domoticz:
the idx 140 gives data 24,96
the idx 178 gives data 24.96
the device idx 178 in the tab "temperature" gives 24.96 ° c
and the log gives:
the problem is solved?
I'm late because my Mosquitto on my Raspberry did not want to connect anymore. I had to reinstall it completely.
I approved your message such as:
- MQTT node domoticz / in:
server: 192.168.1.17:1883
topic: domoticz / in
QOS 2
- JSON node:
action: Convert between JSON string & object
property: msq.payload
- switch node:
property: msg.payload.idx
== 0/9 140
- Node of the function :
Code: Select all
msg.payload = "{\"command\": \"udevice\", \"idx\": 178, \"svalue\": \"" + (msg.payload.svalue1) + "\"}";
return msg;
server: 192.168.1.17:1883
topic: domoticz / in
- debug node:
output: msg.payload
to: debug windows
- The results are:
- pour the debug screen:
Code: Select all
"{"command": "udevice", "idx": 178, "svalue": "24,96"}"
the idx 140 gives data 24,96
the idx 178 gives data 24.96
the device idx 178 in the tab "temperature" gives 24.96 ° c
and the log gives:
Code: Select all
2018-12-29 18: 40: 20.622 MQTT: Topic: domoticz / in, Message: {"command": "udevice", "idx": 178, "svalue": "24.96"}
Who is online
Users browsing this forum: No registered users and 1 guest