Hi, i would like to implement something like this:
receiving messages from mqtt subscription at: domoticz/out
of course many messages in json format will arrive but i want to filter some messages inparticular.
from this messages i need to take two value: name and svalue
and with this two parameters create a new mqtt message.
is it possible?
i'm trying to do this since days, but not succeed.
some example:
this is some topic that i receive with first block mqtt where i add a debug to see that:
"{↵ "Battery" : 255,↵ "RSSI" : 7,↵ "description" : "",↵ "dtype" : "Temp",↵ "id" : "82116",↵ "idx" : 116,↵ "name" : "Ritorno_Riscaldamento",↵ "nvalue" : 0,↵ "stype" : "LaCrosse TX3",↵ "svalue1" : "19.30",↵ "unit" : 1↵}↵"
2/3/2020, 17:37:46[node: 9badb8d6.0b475](http://192.168.0.105:1880/#)domoticz/out : msg.payload : string[282]
"{↵ "Battery" : 255,↵ "RSSI" : 12,↵ "description" : "",↵ "dtype" : "Light/Switch",↵ "id" : "000140F8",↵ "idx" : 168,↵ "name" : "tap_tasmota_1",↵ "nvalue" : 2,↵ "stype" : "Switch",↵ "svalue1" : "70",↵ "switchType" : "Blinds Percentage Inverted",↵ "unit" : 1↵}↵"
2/3/2020, 17:37:46[node: 9badb8d6.0b475](http://192.168.0.105:1880/#)domoticz/out : msg.payload : string[305]
"{↵ "Battery" : 255,↵ "RSSI" : 12,↵ "description" : "",↵ "dtype" : "Temp + Humidity",↵ "id" : "82014",↵ "idx" : 14,↵ "name" : "Corridoio",↵ "nvalue" : 0,↵ "stype" : "THGN122/123/132, THGR122/228/238/268",↵ "svalue1" : "21.00",↵ "svalue2" : "37.1",↵ "svalue3" : "0",↵ "unit" : 1↵}↵"
2/3/2020, 17:37:47[node: 9badb8d6.0b475](http://192.168.0.105:1880/#)domoticz/out : msg.payload : string[282]
"{↵ "Battery" : 255,↵ "RSSI" : 12,↵ "description" : "",↵ "dtype" : "Light/Switch",↵ "id" : "000140F9",↵ "idx" : 169,↵ "name" : "tap_tasmota_2",↵ "nvalue" : 2,↵ "stype" : "Switch",↵ "svalue1" : "38",↵ "switchType" : "Blinds Percentage Inverted",↵ "unit" : 1↵}↵"
2/3/2020, 17:37:49[node: 9badb8d6.0b475](http://192.168.0.105:1880/#)domoticz/out : msg.payload : string[282]
"{↵ "Battery" : 255,↵ "RSSI" : 12,↵ "description" : "",↵ "dtype" : "Light/Switch",↵ "id" : "000140FA",↵ "idx" : 170,↵ "name" : "tap_tasmota_3",↵ "nvalue" : 2,↵ "stype" : "Switch",↵ "svalue1" : "44",↵ "switchType" : "Blinds Percentage Inverted",↵ "unit" : 1↵}↵"
2/3/2020, 17:37:51[node: 9badb8d6.0b475](http://192.168.0.105:1880/#)domoticz/out : msg.payload : string[305]
"{↵ "Battery" : 255,↵ "RSSI" : 12,↵ "description" : "",↵ "dtype" : "Temp + Humidity",↵ "id" : "82014",↵ "idx" : 14,↵ "name" : "Corridoio",↵ "nvalue" : 0,↵ "stype" : "THGN122/123/132, THGR122/228/238/268",↵ "svalue1" : "21.00",↵ "svalue2" : "36.9",↵ "svalue3" : "0",↵ "unit" : 1↵}↵"
2/3/2020, 17:37:53[node: 9badb8d6.0b475](http://192.168.0.105:1880/#)domoticz/out : msg.payload : string[303]
"{↵ "Battery" : 255,↵ "RSSI" : 9,↵ "description" : "",↵ "dtype" : "Temp + Humidity",↵ "id" : "82021",↵ "idx" : 21,↵ "name" : "Mansarda",↵ "nvalue" : 0,↵ "stype" : "THGN122/123/132, THGR122/228/238/268",↵ "svalue1" : "21.70",↵ "svalue2" : "40.1",↵ "svalue3" : "1",↵ "unit" : 1↵}↵"
2/3/2020, 17:37:54[node: 9badb8d6.0b475](http://192.168.0.105:1880/#)
domoticz/out : msg.payload : string[235]
"{↵ "Battery" : 255,↵ "RSSI" : 6,↵ "description" : "",↵ "dtype" : "Temp",↵ "id" : "82095",↵ "idx" : 95,↵ "name" : "Temperatura_Camino",↵ "nvalue" : 0,↵ "stype" : "LaCrosse TX3",↵ "svalue1" : "55.60",↵ "unit" : 1↵}↵"
from here what i'm interested are only these:
"{↵ "Battery" : 255,↵ "RSSI" : 12,↵ "description" : "",↵ "dtype" : "Light/Switch",↵ "id" : "000140F8",↵ "idx" : 168,↵ "name" : "tap_tasmota_1",↵ "nvalue" : 2,↵ "stype" : "Switch",↵ "svalue1" : "70",↵ "switchType" : "Blinds Percentage Inverted",↵ "unit" : 1↵}↵"
or
"{↵ "Battery" : 255,↵ "RSSI" : 12,↵ "description" : "",↵ "dtype" : "Light/Switch",↵ "id" : "000140FA",↵ "idx" : 170,↵ "name" : "tap_tasmota_3",↵ "nvalue" : 2,↵ "stype" : "Switch",↵ "svalue1" : "44",↵ "switchType" : "Blinds Percentage Inverted",↵ "unit" : 1↵}↵"
or
"{↵ "Battery" : 255,↵ "RSSI" : 12,↵ "description" : "",↵ "dtype" : "Light/Switch",↵ "id" : "000140F9",↵ "idx" : 169,↵ "name" : "tap_tasmota_2",↵ "nvalue" : 2,↵ "stype" : "Switch",↵ "svalue1" : "38",↵ "switchType" : "Blinds Percentage Inverted",↵ "unit" : 1↵}↵"
so all message that as :
"name" : "tap_#######
so that name start with this charachers: tap_
when i recognize these messages i need also to extract the svalue1
so for example in:
"{↵ "Battery" : 255,↵ "RSSI" : 12,↵ "description" : "",↵ "dtype" : "Light/Switch",↵ "id" : "000140F9",↵ "idx" : 169,↵ "name" : "tap_tasmota_2",↵ "nvalue" : 2,↵ "stype" : "Switch",↵ "svalue1" : "38",↵ "switchType" : "Blinds Percentage Inverted",↵ "unit" : 1↵}↵"
i need name and svalue1:
tap_tasmota_2
38
from the name i need to extract the number: in this case: 2
now with this indormation i need to build a mqtt command that publish this:
cmnd/blind_tasmota/shutterposition #number# space #svalue1#
so in this example the output will be:
cmnd/blind_tasmota/shutterposition2 38
is it possible to make somthing like this?
can someone help me?
thanks!