Magic Text

431

New member
When I address my solar Battery by opening its server by typing
URL/solar_api/v1/GetStorageRealtimeData.cgi?Scope=System
into the the search field of Firefox I get the correct JSON page:

{
"Body" : {
"Data" : {
"0" : {
"Controller" : {
"Capacity_Maximum" : 7800,
"Current_DC" : 4.2128463476070523,
"DesignedCapacity" : 7800,
"Details" : {
"Manufacturer" : "BYD",
"Model" : "BYD Battery-Box Premium HV",
"Serial" : "P030T020Z2006013382 "
},
"Enable" : 1,
"StateOfCharge_Relative" : 59.399999999999999,
"Status_BatteryCell" : 3,
"Temperature_Cell" : 19,
"TimeStamp" : 1693995454,
"Voltage_DC" : 158.80000000000001
},
"Modules" : []
}
}
},
"Head" : {
"RequestArguments" : {
"DeviceClass" : "Storage",
"Scope" : "System"
}

However if I charge "HTTP GET" of MacroDroid (MD) with the same
argument and ask it to store the result in a variable then some
think went wrong and I get what is shown in "var-sy-proto.JPG"
by opening the Systemprotocol.

Next I open the MD Wiki and looked for Magic Text (MT) but there
no explanation of what MT is how how to use MT nor a simple example
is given.

So pls, can anyone help me for this 1. step?

What i'm after is the value of
"StateOfCharge_Relative" : 59.399999999999999,
within the JSON page which I intent to use for further actions in MD.

Can anyone give a hint how to isolate this value to use it in compare action like "if var>xy then action1"?

Thanks in advance Joerg

var-sy-proto.JPG
 

431

New member
Sory Jacob, I need more help. I think first of all I need to see the full Jason taple?
How to achive that?
Next is the evaluation of that table.
Can you give a step by step explanation on what you suggest?
 

431

New member
Dear Jacob,
If You would have read my post completely you would have notices that MD passes ?Scope=SystemStandard to Firfox while is should have passer ?Scope=System. While setting up the request HTTP GET MD placed "{}" at the end of "System" which is replaced then by "Standard".
Removing the curly braces solfed the first problen.

Where could I learn about the JASON parse action?
 

Endercraft

Moderator (& bug finder :D)
Can you share the action you're using ? I've never seen this and it's definitely not normal.
 

MacroDroidDev

Administrator
Staff member
I'm not sure if I'm missing something here, but according to your log you are passing:

Scope=SystemStandard

and the error message returned is just stating that this is not a valid value (you should be passing Scope=System)
 
Top