Possible to use JSON respons from a CURL command as a variable?

Hi!

I wonder if it is possible to do the following… I have a CURL command which retrieves some JSON data:

curl -f -k -H 'Accept: application/json' -H 'Authorization: Bearer MyTokenHere -X GET https://envoy.local/api/v1/production

This gets this response (from my solar panels):

{
  "wattHoursToday": xxx,
  "wattHoursSevenDays": yyy,
  "wattHoursLifetime": zzz,
  "wattsNow": abc
}

Now I’d like to have the ‘abc’ number as a variable to use in other flows…

I’m a bit lost cause this is all new to me, but maybe someone can point me in the right direction?

1 Like

Something like this?

Thanks!

Almost works… I get a response "failed, reason: self signed certificate’

With the cURL command, I can use -k to ignore this, no idea if this is possible in Homey?

rejectUnauthorized: false ensures self signed is allowed

You can try it with HomeyScript if you have that installed. There is a Flow card that can run a code snippet and return a text token.