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

Change VD icon based on variable value


Question

Posted (edited)

Hi,

 

I have created a VD that changes the VD icon based on a variable. The debug is not showing an error but the icon keeps the same (icon 1058) and doesn't change when the variable value changes. 

Why doesn't it change to icon 1060?

Please login or register to see this code.

 

Thank you in advance

 

Edited by kevin

7 answers to this question

Recommended Posts

  • 0
Posted

Hi,

 

i'm not shure but I believe it's a matter of case sensitivity of your global. You also can optimize the script like follow:

Please login or register to see this code.

I hope that helps...

  • Thanks 1
  • 0
  • Inquirer
  • Posted

    @AndyY

     

    Thanks, it helped ?

    • Like 1
    • 0
  • Inquirer
  • Posted (edited)

    I want also to see which door is open or closed.

    So I have added a label and added the line below to the code but I get to see a 0 or 1, but I want to see open or closed. How can I achieve that?

    Please login or register to see this image.

    /monthly_2019_07/1485294489_Schermafbeelding2019-07-14om12_38_15.png.0d551e704f7e0485d9a7c6dafdfb05e4.png" />

     

     

    Please login or register to see this code.

     

    I think I need to type something else than value ad the end of the line, but can't find what. I there a list to see what different codes you can type here?

    Edited by kevin
    • 0
    Posted

    Hello Kevin,

     

    i think it depends to what you want to have. Sensors with 2 states have only values 0 or 1. So you can translate values like this in your VD:

     

    Please login or register to see this code.

     

    • 0
  • Inquirer
  • Posted

    Thank you @AndyY

     

    Sorry to bother you again?

     

    It worked, until I added a second label and device. Now the code is as below and now I see 0 or 1 instead of open or dicht. Debug shows no error. I have read the code multiple times but can't see why it doesn't function?. When I set it back to 1 label and device it is not working again ?

    Please login or register to see this code.

     

    • 0
    Posted (edited)
    1 hour ago, kevin said:

    Thank you @AndyY

     

    Sorry to bother you again?

     

    It worked, until I added a second label and device. Now the code is as below and now I see 0 or 1 instead of open or dicht. Debug shows no error. I have read the code multiple times but can't see why it doesn't function?. When I set it back to 1 label and device it is not working again ?

    Please login or register to see this code.

     

     

    Hello @kevin,

     

    really no problem ?

     

    You did nearly everything right but the "label states" section needs to be put at the end:

     

    Please login or register to see this code.

     

    Edited by AndyY
    posted before ready
    • 0
  • Inquirer
  • Posted (edited)

    Many many many thanks @AndyY

     

    I learned a lot today about creating a VD.?

    Edited by kevin
    • Like 1

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