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

I am still testing around the usage of variables and tried the following simple thing.

I do have a predefined variable having two values being ON and OFF.

I do have a scene (automatic) which switches on a wall plug, when the variable is in its OFF status and sets the variable to ON.

If variable=ON the "switch on" and set variable to ON

nothing happens.

Only when I restart HCL, the scene is triggered. When I then switch the variable to OFF in the variable panel, nothing happens.

What I also noticed. when the variable is switched ON and I manually trigger the scene, the wall plug is switched ON, even the trigger condition of the variable being OFF is not fulfilled, how comes?

this somehow makes the usage of variables as trigger conditions useless.

anyone having a clue?

 

Recommended Posts

  • 0
  • Inquirer
  • Posted (edited)

    @jakub.jezek

    Works like a charm your VD, nicely calling the scenes and (almost) doing what it is supposed to do. I love the fact that I can call the scenes using their names and not their ID, makes life much easier.

    I noticed however the following:

    I do have a variable (var) with values ON, OFF and NEUTRAL, which is also the three buttons for the VD and the label1 of the VD is called 'Status'.

    The label is also declared to be the main, so I can see the value in the device overview.

    I do have three scenes, all OFF and having no 'internal' trigger, so they just wait to be called by someone, which is the VD:

    ON/OFF to NEUTRAL: IF (var == ON) OR (var == OFF) THEN var=NEUTRAL AND Label1="Neutral"

    NEUTRAL to ON:  IF (var == NEUTRAL) THEN var=ON AND Label1="On"

    NEUTRAL to OFF: IF (var == NEUTRAL) THEN var=OFF AND Label1="Off"

    so basically not allowing to switch directly from ON to OFF and vice versa

    1. As long as I keep the VD closed (read just the icon in the overview) and call the scenes I do see the changes in the var and the label1 is nicely updated in the overview of the devices.
    2. When I open the VD and click the buttons, the var changes but the Label1 remains unchanged, even after refreshing the overview of the devices.
    3. When the var is OFF and I click the ON button in the VD or run (manually) the ON scene the var is changed to ON and if the VD is closed the Label1 changes to On (same from the ON into the OFF direction). How comes? The If condition is not true, so the THEN should not be executed. I noticed this already with other much simpler scenes, that the manual execution of the scene disregards the if condition.
      1. Just noticed: I do have a mistake in the VD as the VD is setting the var to the 'destination' value, so the origin value is not maintained before the scene is called but still the IF should then be false. I try to only call the scene and check what happens then, so not setting the value.
      2. No, does not call the scenes at all, when I change the last line of the function call in the VD button to {"SceneName":true} only and shorten the Content-Length to 18 ( in the attached vfib I changed it to 12)

    why is this so?

     

     

    Please login or register to see this attachment.

    Edited by kunoch
    • 0
  • Inquirer
  • Posted (edited)

    I am sort of frustrated....

    After the first trial it worked like a charm, but now it does not trigger the scenes anymore. the variable is nicely changed as in the example, just the scene is not called anymore......

    kuno

    Edited by kunoch
    • 0
    Posted

    Hi @kunoch,

     

    Sorry i was not responding.

     

    Now, i see, what can be wrong there. You missing "invokeScenes" in JSON body, so i think, there is a problem. I added it there and changed Content-lenght, so please, try it.

     

    Please login or register to see this attachment.

    • 0
  • Inquirer
  • Posted (edited)

    @jakub.jezekThanks a LOT! No problem with the delay of your response. It helps me a lot. I will give it a try and report back!

    What does "invokeScenes" do? Does it check all available scenes for the possible trigger-condition == TRUE?

     

    Edited by kunoch
    • 0
    Posted

    @kunoch, Basically yes. That "invokeScenes" checks if global variable is in a scene condition as a trigger and that making scenes work with proper value ofcourse.

    • 0
  • Inquirer
  • Posted

    @jakub.jezekworks like a charm! :D Exactly what I was looking for.

    My question is now, where have you read all this? For me it is almost impossible to create such simple things in VD, even with the /docs page, where the functions can be tried and work perfekt. but I have not really any clue, how this is then 'transposed' into a button of a VD. Is there any documentation I am not aware of?

    For my own purpose. I will for sure create a cook-book guide on even such simple things with all necessary screenshots. maybe then also share in the forum, if it is not already existing.

    • 0
    Posted

    @kunoch,

     

    I learned it almost 2 years ago, when Fibaro admin responded to me on bugzilla.fibaro.com with same problem you had with global variables.

     

    And yes, this information is not mentioned anywhere, except forum.

    • 0
  • Inquirer
  • Posted (edited)

    I clicked together all the help from this thread and others and compiled a HCL cookbook guide. I hope it helps others to avoid the frustration I had and the huge amount of hours I spent trial and error without success.

    If there are more good ideas and screen shots of things, I will try to reproduce it on my HCL and update the cookbook guide when I get the things running as expected. If I forgot important remarks, helping users, please let me know so I can update the cookbook.

     

     

     

     

     

     

    Please login or register to see this attachment.

    Edited by kunoch
    Cookbook update
    • 0
    Posted
    6 hours ago, kunoch said:

    I clicked together all the help from this thread and others and compiled a HCL cookbook guide. I hope it helps others to avoid the frustration I had and the huge amount of hours I spent trial and error without success.

    If there are more good ideas and screen shots of things, I will try to reproduce it on my HCL and update the cookbook guide when I get the things running as expected. If I forgot important remarks, helping users, please let me know so I can update the cookbook.

     

     

    Please login or register to see this attachment.

     

    Nice job

    • 0
  • Inquirer
  • Posted (edited)

    I made some updates to the manual.

    what I would love to include is some simple VD controlling a vusolo device, a samsung series 8 TV or a squeezebox touch (at least these I can test as I have them available), just some simple http interaction.

    I will for sure read some moire thru the forum as there are quite a few people using http commands, but on HCL, I do not have an overview

    Edited by kunoch
    • 0
    Posted

    Hello guys,

    Getting back at you so many years after your discussion.. hoping you're still online here in the forum :-)

     

    I'm currently trying to create scenes that are triggered by variable change on HCL.

    The variable value is sent to my HCL from my raspberry.

    Variable changes are working fine !

     

    I have read your cookbook @kunoch, thanks !!

     

    My first question is about triggers : I don't understand the checkboxes next to the "triggering device" and "triggering variables" in the block scene creation. what do they mean and when should they be checkd?

    Sometimes in your screenshots they are checked, sometimes not.

     

    I believe this has something to do with my scene not working : even though the variable value is updated correctly from my raspberry (it is confirmed in the variable pannel) and the condition is filled (variable value is > 1), the scene (a simple PUSH notification) is NOT triggered.

     

    I can trigger it manually of course, since you confirmed that manual activation of a scene totally bypasses the IF condition. This is indeed true.

     

    If you could help me with this? I'd be glad to give you details and screenshots. Just checking if you're up to it first ?

     

    Cheers

     

    felix

     

     

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