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
Tibus31 0
Dear All,
I'm trying to put a simple table to Global, just to test it. I've seen an example and I based my test on it but it return an error that I don't understand.
Here's is the code:
--[[
%% properties
%% globals
–]]
local tableau = {id1=91,id2=96}
fibaro:setGlobal("mon_tableau", json.encode(tableau))
fibaro:sleep(2000)
local mon_tableau = fibaro:getGlobal("mon_tableau");
local devices = json.decode(mon_tableau);
fibaro:debug(devices.id1);
if ((fibaro:getValue(devices.id1,"value"))=="1")
then
fibaro:call(devices.id1,"turnOff")
else
fibaro:call(devices.id1,"turnOn")
end
Here is what it returns:
[ERROR] 12:48:26: line 12: Expected value but found T_END at character 1
Line 12 is: local devices = json.decode(mon_tableau);
Any Idea what's wrong with it?
Thank you in advance!
3 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.