Jump to content

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

Posted

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

  • 0
Posted

Tibus31, damaged or null json

  • 0
  • Inquirer
  • Posted

    Hi Andre,

    Any Idea how could it be while you see it's not null and shouldn't be damaged as very small and easy table...

    • 0
    Posted

    add checking errorCode and status

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...