Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team
Question
Tomax 0
I need some help with json decoding.
I'm succesfully got the data in HC2 from Rasspery/Pyton but I'm not able to decode that data in HC2.
Any advice, please?!
--starting LUA code here
local smartmeter= Net.FHttp('192.168.1.10');
response = smartmeter:GET("/index.py")
fibaro:debug('Answer: ' ..response) --this is the data response coming from Rasppery/Pyton: {"Amp": 13.29, "Volt": 98.01}
if (tonumber(status)==200 and tonumber(errorCode)==0) and response~=nil
then
fibaro:debug('Decoding...')
local harduino = json.decode(response)
fibaro:debug('Decode: ', harduino)
fibaro:debug('Or decode: ', harduino.Volt)
else fibaro:debug('Not able to decode!') -- this is the executed code
end
--end LUA code here
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.