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


  • 0

"Simple" code not working in 4.017 / 4.018


Question

Posted

This is code from a button in a virtual device. But, it does not toggle the variable. And i get no error output.

Am i missing something stupid?

Please login or register to see this code.

[/code]

5 answers to this question

Recommended Posts

  • 0
Posted

Please login or register to see this code.

  • 0
  • Inquirer
  • Posted

    Please login or register to see this code.

    So, are variables always strings now? Does that also mean if tonumber(getstatus) == "0" ?

    [ Added: 2014-10-16, 19:32 ]

    Please login or register to see this code.

    No, that code does not toggle the variable either.

    • 0
    Posted

    I just tried that and it seems to be working. Could you please add some fibaro:debug() after the variable is being set and post results here?

    • 0
  • Inquirer
  • Posted
    I just tried that and it seems to be working. Could you please add some fibaro:debug() after the variable is being set and post results here?

    Sure.

    Will do after work.

    • 0
    Posted

    I'm having problems with debug and tonumber after update to 4.018.

    Try this.

    a = "3"

    fibaro:debug(tonumber(a)) -- shows nothing

    fibaro:debug("a = "..a) -- now it's visible

    aa = tonumber(a)

    fibaro:debug(aa) -- shows nothing

    fibaro:debug(""..aa) -- now visible

    Is this a syntax isssue??

    I noticed that you can only put ALPHA variables in global variables AND from the variables panel you can only enter NUMERIC variables, eg 1 , 2.5 etc. ?!!

    So tonumber(x) into setGlobal does not work!!!

    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...