mqtt and json

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
bledad
Normal user
Posts: 18
Joined: 23 Nov 2020, 10:57
Location: France

mqtt and json

#1 Post by bledad » 09 May 2021, 16:14

hello,
i try mqtt , but in log :

Code: Select all

2543194068: IMPT : Bad Import MQTT Command sdb_statut
2543194069: ERR : Illegal Payload {'relais': {'CLIM': 0, 'RELAIS': 0, 'LED': 0}, 'mode': 'Travail', 'temperature': 22.03, 'consigne': 18.0
i would collect 'RELAIS' 0 or 1 , for variable in rules
can you help
thank's
mqtt.jpg
mqtt.jpg (62.34 KiB) Viewed 1279 times

User avatar
Ath
Normal user
Posts: 891
Joined: 10 Jun 2018, 12:06
Location: NL

Re: mqtt and json

#2 Post by Ath » 09 May 2021, 17:16

You will have to wait for PR #3424 to be finished and merged before you can have that feature. I'm still ironing out some (memory-usage) wrinkles...
/Ton

bledad
Normal user
Posts: 18
Joined: 23 Nov 2020, 10:57
Location: France

Re: mqtt and json

#3 Post by bledad » 09 May 2021, 17:29

ok , thank you , i wait

bledad
Normal user
Posts: 18
Joined: 23 Nov 2020, 10:57
Location: France

Re: mqtt and json

#4 Post by bledad » 09 May 2021, 18:31

it's possible in command line for test ?

ip/control/cmd= (ip broker /subscribe /sdb_statut ) ??

User avatar
Ath
Normal user
Posts: 891
Joined: 10 Jun 2018, 12:06
Location: NL

Re: mqtt and json

#5 Post by Ath » 09 May 2021, 18:34

Currently, the MQTT Import plugin only can process numeric values, nothing else.
/Ton

bledad
Normal user
Posts: 18
Joined: 23 Nov 2020, 10:57
Location: France

Re: mqtt and json

#6 Post by bledad » 10 May 2021, 09:44

it will be possible , when you finish PR #3424 , recover ' RELAIS '= 1 or 0 ?


{'relais': {'CLIM': 0, 'RELAIS': 0, 'LED': 0}, 'mode': 'Travail', 'temperature': 22.03, 'consigne': 18.0

Thank

User avatar
Ath
Normal user
Posts: 891
Joined: 10 Jun 2018, 12:06
Location: NL

Re: mqtt and json

#7 Post by Ath » 10 May 2021, 09:56

Yes, it will, and also 'translate' values like "Travail" to a 1 and any other values to a numeric equivalence (I'm using to translate off/on/up/down to 0/1/2/3)
Next to that, it can parse the nth value from a multi-value string like "22.0;150;1;0", so requesting the 2nd value would return 150.
/Ton

bledad
Normal user
Posts: 18
Joined: 23 Nov 2020, 10:57
Location: France

Re: mqtt and json

#8 Post by bledad » 10 May 2021, 10:01

ok, fantastic , I am impatient

Post Reply

Who is online

Users browsing this forum: Micha_he and 24 guests