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

Questions: fibaro:setGlobal / %globals


Question

Posted

Hey again,

 

so i understand how to work with global variables but i was asking me if i am able to create a global variable direct from a scene?

 

So for example: "if global not exist create and set value else do nothing"

 

The other question is that i don't understand what %globals in the header are for? Maybe there is a little text that explains what i can set there? So my first thinking was that i need to define a global variable there i want to work with in the script but it does work without it.

 

Greetings,

Chris

6 answers to this question

Recommended Posts

  • 0
Posted

The %globals in the header are for trigger the scene when global variable has changed.

For example: If global variable called gName has changed, send an email where the message body is gName value.

Please login or register to see this code.

In this case any change on gName (in other scenes or VDs) will trigger email sending... very useful if you're changing the variable via API.

You cannot create global variable in scenes.

  • 0
Posted

Please login or register to see this link.

You can create global variable from scene, see:

Please login or register to see this link.

and

Please login or register to see this link.

Please login or register to see this link.

 

exercise:

Please login or register to see this code.

  • 0
Posted

What section in docs... as far as I see you can modify variable from API not from Scene.

  • 0
Posted

 

Please login or register to see this link.

You can create global variable from scene, see:

Please login or register to see this link.

and

Please login or register to see this link.

Please login or register to see this link.

 

exercise:

Please login or register to see this code.

Did you tried to run it in scene. The Net.FHttp doesn't recognized in scene. In virtual devices only.

  • 0
Posted

Please login or register to see this link.

You can write the same code in scene using command net.HTTPClient() , http:request('http://............... { options = { method = 'POST' ........

  • 0
  • Inquirer
  • Posted

    Thank you very much for this. I think i got it and i am already on the try to use the developer api with jQuery. Lets see if i get it managed

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

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