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.

Buderus KM200 api
#4
(31.10.2019, 08:49)MichelDeLigne Wrote: I don't think it is related to the line 101. REST sends a json results, that is supposed to be enclosed in {}.
In your case, I would say the problem is probably with the first "{", that seems to be missing.
That was a copy paste error from my side. Real JSON answer is:
Code:
{"id":"/solarCircuits/sc1/collectorTemperature","type":"floatValue","writeable":0,"recordable":1,"value":-0.6,"unitOfMeasure":"C","state":[{"open":-3276.8},{"short":3276.7}]}
By the way, as in the code you are searching for } it doesn't have anything to do with the {. 

Let me rephrase the issue.
The output that I got after the code:
Code:
local endposition = string.find(res, "}", -0)
res = string.sub(res, 0, endposition)
return res
is
Code:
{"id":"/solarCircuits/sc1/collectorTemperature","type":"floatValue","writeable":0,"recordable":1,"value":-0.6,"unitOfMeasure":"C","state":[{"open":-3276.8}
This is not a valid JSON response as the last } (and some more text) is missing. I assume the -0 in the string.find is not the correct value.

Anyway, thanks a lot for the code Smile It works like a charm so I'm happy with it!
Reply


Messages In This Thread
Buderus KM200 api - by MichelDeLigne - 29.04.2019, 18:46
RE: Buderus KM200 api - by sds - 30.10.2019, 22:55
RE: Buderus KM200 api - by MichelDeLigne - 31.10.2019, 08:49
RE: Buderus KM200 api - by sds - 01.11.2019, 19:18
RE: Buderus KM200 api - by m.j.sorokin - 28.07.2020, 18:39
RE: Buderus KM200 api - by MichelDeLigne - 28.07.2020, 20:53
RE: Buderus KM200 api - by admin - 29.07.2020, 05:53
RE: Buderus KM200 api - by MichelDeLigne - 29.07.2020, 07:53
RE: Buderus KM200 api - by m.j.sorokin - 29.07.2020, 13:37
RE: Buderus KM200 api - by admin - 30.07.2020, 06:20
RE: Buderus KM200 api - by MichelDeLigne - 30.07.2020, 07:39
RE: Buderus KM200 api - by m.j.sorokin - 30.07.2020, 07:37
RE: Buderus KM200 api - by admin - 30.07.2020, 08:03
RE: Buderus KM200 api - by sds - 20.05.2024, 13:28
RE: Buderus KM200 api - by admin - 20.05.2024, 13:52
RE: Buderus KM200 api - by sds - 20.05.2024, 17:51
RE: Buderus KM200 api - by admin - 21.05.2024, 08:19
RE: Buderus KM200 api - by sds - 21.05.2024, 19:06

Forum Jump: