domoticz to MQTT topic

Others (MiLight, Hue, Toon etc...)
Post Reply
User avatar
emme
Posts: 957
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

domoticz to MQTT topic

Post by emme » Monday 09 July 2018 9:40

Ciao,
Since the MQTT messages are almost a replication of the Log, it is quite a mess to work with them, the only way to work with it is to grab the IDX value.

I have few flows in node-red that handle lights/group, multimedia devices and security.
those 3 blocks are handled by a switch block that gets the IDX and do what it is supposed to do...

actually the message sent is the followig:

Code: Select all

{
 "idx" : 5,
 "name" : "Internal Temperature",
 "id" : "00080A",
 "unit" : 1 
 "dtype" : "Temp",
 "stype" : "TFA 30.3133",
 "nvalue" : 0,
 "svalue1" : "41.2",
 "Battery" : 100,
 "RSSI" : 12,
}
I was wondering if there is the possibility to assign a MQTT topic to each device and add it payload sent...

Code: Select all

{
 "idx" : 5,
 "name" : "Internal Temperature",
 "id" : "00080A",
 "unit" : 1 
 "dtype" : "Temp",
 "stype" : "TFA 30.3133",
 "nvalue" : 0,
 "svalue1" : "41.2",
 "Battery" : 100,
 "RSSI" : 12,
 "topic": "TempSensors"
}
this way it would be much more easy to understand what device has done what... :P

thanks
ciao
M
The most dangerous phrase in any language is:
"We always done this way"

Charley
Posts: 29
Joined: Tuesday 06 March 2018 13:20
Target OS: Raspberry Pi
Domoticz version: V3.9030
Location: Netherlands
Contact:

Re: domoticz to MQTT topic

Post by Charley » Thursday 12 July 2018 14:54

Hello Emme,

If the topic is added to the object that Domoticz sends out you can't filter just the topic out.
In that case you need to make a switch to determine your topic.

if domoticz/out/tempsensors you only receive the topic your are subscribed to from your broker.

better would be:

domoticz/out/sensors/temperature
domoticz/out/sensors/humidity

or

domoticz/out/sensors (as general)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest