# Mqtt json

**URL:** <https://community.homey.app/t/mqtt-json/106135>\
**Category:** Apps\
**Tags:** app, flow, homey-pro, advancedflow\
**Created:** [March 12, 2024, 6:11pm UTC](https://community.homey.app/t/mqtt-json/106135 "2024-03-12T18:11:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Comgen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/comgen/32/102270_2.png) [@Comgen](https://community.homey.app/u/Comgen)\
**Post date:** [March 12, 2024, 6:11pm UTC](https://community.homey.app/t/mqtt-json/106135/1 "2024-03-12T18:11:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 13, 2024, 6:15am UTC](https://community.homey.app/t/mqtt-json/106135/2 "2024-03-13T06:15:08Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/1/b142daa7345c7b86a656d511d7e45e64bb2ac842.png)

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

---

<div class="post-metadata">

**Author:** ![Charles](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@Charles](https://community.homey.app/u/Charles)\
**Post date:** [May 6, 2024, 12:16pm UTC](https://community.homey.app/t/mqtt-json/106135/3 "2024-05-06T12:16:57Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [May 6, 2024, 12:18pm UTC](https://community.homey.app/t/mqtt-json/106135/4 "2024-05-06T12:18:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Charles](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@Charles](https://community.homey.app/u/Charles)\
**Post date:** [May 6, 2024, 12:19pm UTC](https://community.homey.app/t/mqtt-json/106135/5 "2024-05-06T12:19:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [May 6, 2024, 12:20pm UTC](https://community.homey.app/t/mqtt-json/106135/6 "2024-05-06T12:20:55Z")

</div>

> [@Charles](#):
>
> only available in advanced, flow?

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

---

<div class="post-metadata">

**Author:** ![Charles](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@Charles](https://community.homey.app/u/Charles)\
**Post date:** [May 6, 2024, 5:52pm UTC](https://community.homey.app/t/mqtt-json/106135/7 "2024-05-06T17:52:41Z")

</div>

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,

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/6/c66449d04092d1a3f7a770dabf0aefc070d61b64.png)

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

```auto
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

---

<div class="post-metadata">

**Author:** ![Charles](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@Charles](https://community.homey.app/u/Charles)\
**Post date:** [May 6, 2024, 6:18pm UTC](https://community.homey.app/t/mqtt-json/106135/8 "2024-05-06T18:18:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Comgen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/comgen/32/102270_2.png) [@Comgen](https://community.homey.app/u/Comgen)\
**Post date:** [May 6, 2024, 7:27pm UTC](https://community.homey.app/t/mqtt-json/106135/9 "2024-05-06T19:27:21Z")

</div>

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.
