Logic Machine Forum
Ikea Blinds API GET lift % - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Ikea Blinds API GET lift % (/showthread.php?tid=3360)



Ikea Blinds API GET lift % - Kai-Roger - 10.05.2021

Hi.

Code:
res, code = require('socket.http').request('http://192.168.1.80:40850/api/ABAFA5768F/lights/2/')
log(res, code)

If i use the code above, i get this result:

* arg: 1
  * string: {"etag":"9575d92e1a87a4fc7034b5cd188d239c","hascolor":false,"lastannounced":"2021-05-08T20:41:08Z","lastseen":"2021-05-10T14:34Z","manufacturername":"IKEA of Sweden","modelid":"KADRILJ roller blind","name":"Rullegardin Stue venstre","state":{"bri":254,"lift":100,"on":true,"open":false,"reachable":true},"swversion":"2.2.009","type":"Window covering device","uniqueid":"68:0a:e2:ff:fe:4a:74:9a-01"}
* arg: 2
  * number: 200



I want to retract the "lift" value that in this example is "100".
I tried to use the code below to do this, but i can see that there is something missing in the code to be able to extract this value.
Code:
if res then
  res = require('json').pdecode(res)
  if type(res) == 'table' and res.lift then
    grp.checkupdate('5/4/80', res.lift)
  end
end



RE: Ikea Blinds API GET lift % - Daniel - 10.05.2021

Try res.state.lift


RE: Ikea Blinds API GET lift % - Kai-Roger - 10.05.2021

(10.05.2021, 15:23)Daniel. Wrote: Try res.state.lift

Beautiful :)


RE: Ikea Blinds API GET lift % - FatMax - 22.05.2021

What bridge are you using to control IKEA blinds via API?


RE: Ikea Blinds API GET lift % - Kai-Roger - 22.05.2021

(22.05.2021, 15:33)FatMax Wrote: What bridge are you using to control IKEA blinds via API?

Deconz on a RaspberryPi with a Conbee2 USB stick. I`m altso using Deconz for other Zigbee products like many products from Phillips Hue. Very stable solution.