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

Updating global variables in block scenes


Question

Posted

Situation:

  • LEDstrip with RF dimmer
  • this is controlled by a RFXCOM module on a synology-NAS running Domoticz
  • a virtual device was created in HC2 to control the functions ON/OFF/MAX/MIN/+/-
  • dimmer2 module in wall socket, with 2 momentary switches: S1 to control the main lights, and S2 (spare)

 

Wish:

I want to control the virtual device LEDstrip with the spare S2 button, instead of using the RF remote. 1 click is ON, another click is OFF, double click is MAX, tripple click is MIN.

Scene activation function is already activated on dimmer 2. Since RFXCOM isn't reporting back it's status, I've created a variable with 2 values: LEDstripStatus: AAN/UIT (ON/OFF)

 

So far, so good! 

The first scene (attachment) is running well, but he doesn't update the variable to ON! And so, the scene for turning OFF the LEDstrip isn't running, because the variable must be ON...

 

Any ideas?

 

Thanks!!!

Please login or register to see this attachment.

9 answers to this question

Recommended Posts

  • 0
Posted

Why don't you convert the block scene to LUA ? It will be much easier to read and to see if and where something goes wrong.

Post the LUA version, then we'll see.

 

  • 0
  • Inquirer
  • Posted
    Quote

    --[[
    %% properties
    72 sceneActivation
    %% events
    %% globals
    LEDstripStatus
    --]]

    local startSource = fibaro:getSourceTrigger();
    if (
     ( tonumber(fibaro:getValue(72, "sceneActivation")) == 26  and  fibaro:getGlobalValue("LEDstripStatus") == "UIT" )
    or
    startSource["type"] == "other"
    )
    then
        fibaro:call(92, "pressButton", "1");
        fibaro:setGlobal("LEDstripStatus", "AAN");
    end
     

     

    • 0
    Posted

    To interpret the whole thing I think I need more info. Now, both sceneActivation AND a change in the Global Variable LEDstripStatus triggers this scene. Do you want both ?
     

    • 0
  • Inquirer
  • Posted

    Yepz, since RFXCOM cannot "see" the status, I want to change a variable "LEDstripstatus" from "AAN" (on) to "UIT (off) on the end of the scene. Doing so, I want to use the same push-button to toggle the ledstrip on and off...

    • 0
    Posted (edited)

    Oh, right, but still, the fact that you change the variable on the end of your scene, automatically triggers it again, so I would take it out of the triggers.

    But what you want should be indeed very straightforward. I think a shorter version of this scene will work. Try something like this:

    Assuming your VD's second button has the code for "Off" (UIT)

     

    Please login or register to see this code.

     

     

     

    Edited by TW1979
    • 0
  • Inquirer
  • Posted

    I don't want to change the global variable in the trigger, I want to check it. (Get instead of set)

    • 0
  • Inquirer
  • Posted

    Your scene above works! I see now what I did wrong. more possibilities in lua it seems... 

    Thank you!

    • 0
    Posted (edited)

    Happy it helped. LUA is definitely what makes the HC2 so much fun :-) . (for me)

    Edited by TW1979

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