Welcome to Smart Home Forum by FIBARO
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!
Smart Home Forum by FIBARO Team
I’m struggling to convert some basic code from HC2 to HC3
The following code works on HC2
--calls json table and decodes
local decoded_light_settings = json.decode(fibaro.getGlobalVariable("g_light_set"))
print("after decode json file")
--STEP 2 gets the relevant json table settings from the decoded table
local ref_1 = (decoded_light_settings.al_7.c)
But I get this message on HC3 debugger
[11.11.2021] [17:39:28] [DEBUG] [SCENE18]: at top
[11.11.2021] [17:39:28] [DEBUG] [SCENE18]: after decode json file
[11.11.2021] [17:39:28] [DEBUG] [SCENE18]: 1
[11.11.2021] [17:39:28] [ERROR] [SCENE18]: (load):11: Assertion failed: Expected string
The error line is for the last line of the code .... fibaro.setGlobalVariable("g_al_warm", ref_1)
I’ve changed the syntax to what I think is correct but can’t get it to work.
I've set up the global variable with an initial value 0
Any help much appreciated
Link to comment
Share on other sites
5 answers to this question
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.