This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Philips Hue api v2
#11
parsing the output is another thing:

line output: data: [{"creationtime":"2022-02-03T13:35:32Z","data":[{"id":"f2ef58b3-818e-45ea-a291-325e8eeb97bc","id_v1":"/lights/10","on":{"on":false},"owner":{"rid":"0120cec8-b58e-4206-a409-2bd99055af55","rtype":"device"},"type":"light"}],"id":"49142b93-3da7-49dc-9ad6-10809df8fe9d","type":"update"}]
Code:
line = string.sub(line,8,-2) -- remove "data: [" and the last ] character
line = json.pdecode(line)
This works

But the second output combines more lines, how to decode this line?
line output: 
data: [{"creationtime":"2022-02-03T13:35:32Z","data":[{"id":"728be63c-dc61-42b1-9a84-54daeff76046","id_v1":"/groups/0","on":{"on":false},"type":"grouped_light"}],"id":"b201d09a-0ab2-4a60-b72f-3a099841ebbc","type":"update"},{"creationtime":"2022-02-03T13:35:32Z","data":[{"id":"33b4f136-c59e-4270-83af-814c4f5ba856","id_v1":"/groups/18","on":{"on":false},"type":"grouped_light"}],"id":"e2860e1b-ebd0-40b0-81ed-f1c0b27163a3","type":"update"},{"creationtime":"2022-02-03T13:35:32Z","data":[{"id":"7a8f900c-c312-403a-bf73-9d2fcb005489","id_v1":"/groups/19","on":{"on":false},"type":"grouped_light"}],"id":"1cc814e9-9210-4e75-92c0-29a543c32dcb","type":"update"}]
Reply


Messages In This Thread
Philips Hue api v2 - by gjniewenhuijse - 02.02.2022, 13:17
RE: Philips Hue api v2 - by gjniewenhuijse - 02.02.2022, 14:53
RE: Philips Hue api v2 - by admin - 02.02.2022, 15:53
RE: Philips Hue api v2 - by gjniewenhuijse - 02.02.2022, 18:51
RE: Philips Hue api v2 - by admin - 03.02.2022, 07:21
RE: Philips Hue api v2 - by gjniewenhuijse - 03.02.2022, 09:11
RE: Philips Hue api v2 - by admin - 03.02.2022, 09:22
RE: Philips Hue api v2 - by gjniewenhuijse - 03.02.2022, 09:34
RE: Philips Hue api v2 - by admin - 03.02.2022, 09:50
RE: Philips Hue api v2 - by gjniewenhuijse - 03.02.2022, 10:12
RE: Philips Hue api v2 - by gjniewenhuijse - 03.02.2022, 14:58
RE: Philips Hue api v2 - by Joep - 10.01.2023, 09:16
RE: Philips Hue api v2 - by Fcs - 04.11.2024, 14:17
RE: Philips Hue api v2 - by gjniewenhuijse - 05.11.2024, 07:18

Forum Jump: