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

[HC-3][Solved] Lua scene to control devices like Philips HUE from Z-Wave central scene controller


jakub.jezek

Question

I created simmilar scene for use with Dimmer 2, which works but it uses older send scenes, but I wanted to create something for switches and RGBW modules, Walli controllers and others.

 

I created scene which should work, but it does not and even Toggle ends in Error. It can be used not just with Hue but with Z-Wave devices too, so I test it on Z-Wave devices.

 

Scene condition (left part of scene):

Please login or register to see this code.

 

Scene body:

Please login or register to see this code.

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • Seems like there is something wrong while comparing string that arrives as trigger from central scene event cc. Fibaro shows it as string. But my if conditions have problem with it for some reason. Now changing type seems to work. I have changed strings "Pressed", "Pressed2", "HeldDown", "Released" to hex and that seems to solve the issue.

     

    Scene body:

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Also tested on both 5.070 and 5.072.

    Link to comment
    Share on other sites

    • 0

    why don't you remove all the json.encode and string manipulations?

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @tinman, Thanks for the tip.

     

    44 minutes ago, tinman said:

    why don't you remove all the json.encode and string manipulations?

    Well I did not know I could use it :D I learned with json.encode() so I used what I knew how to work with.

    Link to comment
    Share on other sites

    • 0
    11 minutes ago, jakub.jezek said:

    @tinman, Thanks for the tip.

     

    Well I did not know I could use it :D I learned with json.encode() so I used what I knew how to work with.

    Yes, but that's why it failed originally.

    json.encode("Pressed") is not equal to "Pressed". json.encode("Pressed") includes the "" , i.e.  "\"Pressed\"". In your hex encoding you include the \" around "Pressed" so there the comparison works.

    But with @tinman's advice it should work and be more readable.

    However, the hex encoding is a start of encrypted scenes I guess :-) 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 27 minutes ago, jgab said:

    json.encode("Pressed") is not equal to "Pressed". json.encode("Pressed") includes the "" , i.e.  "\"Pressed\"".

    I see. That would explain things. Seems like I have still something to learn about Triggers ? for future work.

    Link to comment
    Share on other sites

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