[APP][Pro] JSON Handler and Manipulator

Yeah, i can fix that! Would you mind creating a feature ticket for it? (Iink in the top post).
Thanks!

I did! Not sure if it’s a feature that would be handy for everyone… but just think about it :slight_smile:

1 Like

Newbee JSON Handler Q

I have simple myJSON: {“29”:123,“30”:456"Year":23,“Month”:10,“Day”:23} and would like to read value of “30” (i.e. 456) (and as/if possible) also “Day” (i.e. 23)

What are correct variables in “Read JSON” card (have tried all but getting error after error)…

You are missing a “,” between “30”:456 and “Year”:. Maybe just a misspelling here?
Property path 1 = “30”
Property path 2 = “Day”

Value 1 and 2 is a number.

Does this not work?

Yes, actual JSON much longer, so saved some space and mistakenly “,” dropped.

JSON now directly on JSON Handler card (one value version):

myJSON: {“29”:123,“30”:456,“Year”:23,“Month”:10,“Day”:23}

Test 1: “Prop. path 1” (empty), “Prop. path Number 1” (“30”), “…Yes/No 1” (empty)
=> Text-1 (empty), Number-1 (zero), Yes/No 1 (No)

Test 2: “Prop. path 1” (“30”), “Prop. path Number 1” (empty), "…Yes/No (empty)
=> Text-1 (empty), Number-1 (zero), Yes/No 1 (No)

On HomeyScript below working just fine, but want to do small repeating things on flow-cards…

console.log(myJSON[“30”])

newbee getting desparate :grimacing:

Why not use the built-in Logic card to handle JSON?

(replace the “Start value” tag with the one that’s relevant for your situation)

Worked, thank you - now newbee happy.

Why not use the built-in Logic card to handle JSON?

=> did not realize simple card from Logic but also have to admit that would have not understood to use special characters eather…

Funny how long it took to try myself to find solution, can tell you that was more that 5h used here :slight_smile: , Thanks again

You can use the same path in the Json Handler app.

Both JSON Handler resulst zero, while Logic with value…

I want to use this api Strømpris API - Åpent og gratis to check if the current hour has the lowest power price. Any suggestions how and where to start?

Is there a way to append to an array with JSON Handler?

{
  "frames":[ ... ]
}

Basically I am looking at adding elements in sequence to the frames array json strings that I have built in previous flow steps as {"icon":"57197","text":"20 °C","duration":500}

so in the end I should have

{
  "frames":[
    {"icon":"57197","text":"20 °C","duration":500},
    {"icon":"48963","text":"36 °C","duration":500},
    ...
  ]
}

Hi,

It looks like your are doing somethings with lametric

Take a look att https://homey.app/sv-se/app/dev.dadda.localapi/Local-API/
Im trying to convince the author to make the output lametric-compatible.

/Rikard

True, using MQTT on LaMetric Time and the json used in the mqtt topic uses such an array for the information frames.

If i get the author of the local api app to mae it 100% compatible with lamterics json-format it will be easy to just use My Data DIY on the lametric.

Its already possible, but it takes a little bit to much configuration in the lamteric-app to be plesant, if i get the change in local api all programming can be done in homey

Just saw Athoms advertise that LaMetric is official supported. Is it not sufficient?
What is missing?

the lametricapps on homey gives you a little bit of controll of your lametric in general.
But its possible in several diffrent ways to present information on your lametric, but the lametric-apps on homey doesnt supporrt that at all.
and that sucks because if you use your homey you probably have a lot of data and information you would like to show on some sort of screen.

the homey app “local api” works, but needs a little bit of tweaking to be 100% compatible with one of the ways you could present information on lametric.
mqtt maybe work, but i have never tried that

1 Like

Question I got this json

[
{“key”:“SN1”,“value”:“119706”,“unit”:null,“name”:“SN”},
{“key”:“DV1”,“value”:“366.6”,“unit”:“V”,“name”:“DC Voltage PV1”},
{“key”:“DV2”,“value”:“290.8”,“unit”:“V”,“name”:“DC Voltage PV2”},
{“key”:“DC1”,“value”:“1.6”,“unit”:“A”,“name”:“DC Current PV1”},
{“key”:“DC2”,“value”:“1.5”,“unit”:“A”,“name”:“DC Current PV2”},
{“key”:“AV1”,“value”:“240.4”,“unit”:“V”,“name”:“AC Voltage R/U/A”},
{“key”:“AV2”,“value”:“0.0”,“unit”:“V”,“name”:“AC Voltage S/V/B”},
{“key”:“AV3”,“value”:“0.0”,“unit”:“V”,“name”:“AC Voltage T/W/C”},
{“key”:“AC1”,“value”:“4.1”,“unit”:“A”,“name”:“AC Current R/U/A”},
{“key”:“AC2”,“value”:“0.0”,“unit”:“A”,“name”:“AC Current S/V/B”},
{“key”:“AC3”,“value”:“0.0”,“unit”:“A”,“name”:“AC Current T/W/C”},
{“key”:“A_Fo1”,“value”:“49.98”,“unit”:“Hz”,“name”:“AC Output Frequency R”},
{“key”:“AP1”,“value”:“999”,“unit”:“W”,“name”:“AC Power R/U/A”},
{“key”:“AP2”,“value”:“0”,“unit”:“W”,“name”:“AC Power S/V/B”},
{“key”:“AP3”,“value”:“0”,“unit”:“W”,“name”:“AC Power T/W/C”},
{“key”:“APo_t1”,“value”:“999”,“unit”:“W”,“name”:“Total AC Output Power (Active)”},
{“key”:“Et_ge0”,“value”:“31663”,“unit”:“kWh”,“name”:“Cumulative Production (Active)”},
{“key”:“Etdy_ge1”,“value”:“3.77”,“unit”:“kWh”,“name”:“Daily Production (Active)”},
{“key”:“INV_T0”,“value”:“40.4”,“unit”:“℃”,“name”:“Temperature- Inverter”},
{“key”:“t_w_hou1”,“value”:“0”,“unit”:“h”,“name”:“Total Running Hour”},
{“key”:“INV_ST1”,“value”:“6”,“unit”:null,“name”:“Inverter status”}]

Now I would like to store the Etdy_ge1 to the homey pro numeric variable DailyProduction

But I can not get it to work

In javascript there is a possibiliy to stop/exit a loop before ending. How can I cancel an already running JSON Handler loop card?

I think there is something wrong with this app. I’ve been trying to parse a very simple JSON, but I just can’t make it work. I then went ahead and tried using the app to build an even simpler JSON (but similar), which also fails:

Assume that the simplified JSON I have looks like this:

{
“Total volume”:234.567
}

No matter what I try, the output number returned is 0. Here’s what the flow I tested with looks like:

This flow generates the exact JSON as shown above, but the given result (tag #Number 1) is always 0.

If I pass that same generated JSON to one of the builtin logic JSON parse flowcards, it provides the correct result. I am in fact using the builtin flowcards now, but it seemed an improvement to parse all the values in one card instead of multiple, but alas, this doesn’t seem to work.

Place a dollar and dot before the bracket: $.

Edit: wrongly answered, see answer: