Mqtt json

I have an advance flow that uses the MQTT client to receive cheap charging slots from Octopus Energy. The MQTT client is working well and receives data in JSON format example is:-

{ SlotStart: “2024-03-09 20:30:00+00:00”, SlotEnd: “2024-03-09 21:00:00+00:00”, InsertDate: “2024-03-09 21:05:26” }

I would like to do something meaningful with the data like insert into a calendar or scheduler. Can anyone please offer any advice on how I can format the JSON or point me in the right direction.

There are various Logic cards that can parse JSON and extract data from it:

The “Text” tag is the one provided by the MQTT client (I think it’s called “message”?), “Path” should be a JSONPath expression.

@robertklep sorry to hijack this thread but where do you get these JSON option in Logic?

I can’t see them ever in better logic app and this is exactly what I need

Thanks

They’re all “THEN” cards, in Advanced Flows use “Add > Then…” and search for “json”.

got it only available in advanced, flow? my mistake, thanks for this express answer :slight_smile:

Yes (I assumed they would also be available in standard flows, but apparently not :thinking:).

Can someone show me what syntax I need to use to get json data from MQTT looks like I tried everything without any success, I installed LOG to see but nothing really help.

Here is my advanced flow,

I’m receiving message as follow (from sys log node) and I can’t see any results (valid or error) after node logic

id,timestamp,message,severity,facility,app
2024/05/06$45,2024-05-06T17:47:40.566Z,"{"id":"58:2D:34:12:33:DC","name":"CGG_1233DC","rssi":-75,"brand":"ClearGrass/Qingping","model":"Round TH","model_id":"CGG1_ATC1441","type":"THB","tempc":20.7,"tempf":69.26,"hum":58,"batt":70,"volt":2.837,"mac":"58:2D:34:12:33:DC"}",,,
2024/05/06$44,2024-05-06T17:45:32.965Z,"{"id":"58:2D:34:12:33:DC","name":"CGG_1233DC","rssi":-76,"brand":"ClearGrass/Qingping","model":"Round TH","model_id":"CGG1_ATC1441","type":"THB","tempc":20.8,"tempf":69.44,"hum":58,"batt":71,"volt":2.84,"mac":"58:2D:34:12:33:DC"}",,,
2024/05/06$42,2024-05-06T17:43:15.371Z,"{"id":"58:2D:34:12:33:DC","name":"CGG_1233DC","rssi":-74,"brand":"ClearGrass/Qingping","model":"Round TH","model_id":"CGG1_ATC1441","type":"THB","tempc":20.7,"tempf":69.26,"hum":58,"batt":73,"volt":2.865,"mac":"58:2D:34:12:33:DC"}",,,

So my question is what do I need to put to get for example volt value from JSON?

Tried without any luck

$.volt
message.volt
volt

this is just driving me mad

Thanks

Self answer looks like $.temp and temp are working the deal is that log looks like only one one value to log else it does not seems to work, and 2nd virtual sensor brings name Temperature, Humidity, … but real values to set are
measure_temperature
measure_humidity
measure_battery
and not the ones showed by UI

Just as another option for you, I am a complete noob so I use nodered to receive the mqtt topic as an input and use a function node to convert the mqtt topic into a better format then out put to a mqtt topic of my choice which goes into homey. To write the function node I asked Chat ct write it for me.