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
Alex de Bruin 16
I want to use a construction in my hometable like for example
local HT = { light1 = { fib_id = 211, hue_id = 7 },
light2 = { fib_id = 227, hue_id = 12 },
}
HT.ftoh = { [ HT.light1.fib_id ] = HT.light1.hue_id,
[ HT.light2.fib_id ] = HT.light2.hue_id,
}
When i test fibaro:debug( HT.ftoh[ 227 ] ) it gives the expected value 12.
I want to use this in a couple of VD's with generic code for hue lights, but when i test local HT2 = fibaro.decode( fibaro.encode( HT ) ) then
fibaro:debug( HT2.ftoh[ 227 ] ) gives un expected NIL result.
fibaro:debug( HT2.ftoh[ "227" ] ) does give the correct result 12 so the original key index 227 is now a string.
Is this normal behaviour of the json.encode / json.decode functions or is this a bug ?
Edited by Alex de BruinChanged : to .
Link to comment
Share on other sites
33 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.