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

disable device through lua


Question

Posted

Hi,

I have the following need:

Disable Fibaro roller shutter device while alarm sensor in breached using an HC2 device.

In the actual case, while the window is open I need to disable the roller shutter device that move the curtain. 

 

Through LUA I'm able to recognize the sensor breach, but I'm not able to disable the wanted device.

I'm actually also struggling in just retrive the enable state.

I'm able to get roller shutter name, Id and other stuff through undocumented commands:

fibaro:getName(590)

fibaro:getDevicesId(590)

But I'm not able to find any command to get the enable state and nothing to change its value using lua commands.

 

The only way I found to inspect the enable value is through the filter capability but it seems to me far from an actual solution.

 

Someone can help on this?

Thank you for your support!

12 answers to this question

Recommended Posts

  • 0
Posted (edited)
6 hours ago, Peppe said:

Hi,

I have the following need:

Disable Fibaro roller shutter device while alarm sensor in breached using an HC2 device.

In the actual case, while the window is open I need to disable the roller shutter device that move the curtain. 

 

Through LUA I'm able to recognize the sensor breach, but I'm not able to disable the wanted device.

I'm actually also struggling in just retrive the enable state.

I'm able to get roller shutter name, Id and other stuff through undocumented commands:

fibaro:getName(590)

fibaro:getDevicesId(590)

But I'm not able to find any command to get the enable state and nothing to change its value using lua commands.

 

The only way I found to inspect the enable value is through the filter capability but it seems to me far from an actual solution.

 

Someone can help on this?

Thank you for your support!

 

 

 

Hi

 

On HC3 i would do something like this..however i am not familiar with HC2, maybe will work there either.

 

Please login or register to see this code.

 

 

 

Edited by Neo Andersson
  • 0
  • Inquirer
  • Posted

    Hi Neo, thank you for the advise. I will try on HC2 using its API.

    Anyhow I just recognized that despite I set as disabled the device the physical buttons are still working.

    My idea is to completely disable the Fibaro rollershutter avoiding its usage even through physical buttons when the window is open.

    I need to find a different solution... Any idea? I have already broken 4 curtains due to their activation with the windows opened.

     

    • 0
  • Inquirer
  • Posted
    12 hours ago, Neo Andersson said:

    On HC3 i would do something like this..however i am not familiar with HC2, maybe will work there either.

     

    Please login or register to see this code.

     

    It works as is in HC2! Thank you!

    • 0
    Posted (edited)
    2 hours ago, Peppe said:

    Hi Neo, thank you for the advise. I will try on HC2 using its API.

    Anyhow I just recognized that despite I set as disabled the device the physical buttons are still working.

    My idea is to completely disable the Fibaro rollershutter avoiding its usage even through physical buttons when the window is open.

    I need to find a different solution... Any idea? I have already broken 4 curtains due to their activation with the windows opened.

     

    After disabling a device, its interface controls will still react to button clicks. I would rather set buttons visibility to false. self:updateView("buttonID", "visible",false), maybe there are some other options to block UI controls too (some other api calls for layout, i dont know, never tried),

    Edited by Neo Andersson
    • 0
  • Inquirer
  • Posted
    11 minutes ago, Neo Andersson said:

    After disabling a device, its interface controls will still react to button clicks. I would rather set buttons visibility to false. self:updateProperty("buttonID", "visible",false), maybe there are some other options to block UI controls too (some other api calls for layout, i dont know, never tried),

    Thank you Neo.

    Sorry but the proposed suggestion is not clear to me. Does the gateway assign an ID to the device buttons? I thought the button ID is related to VD.

    In the case I succeed with hide the button, does this also disable the physical buttons connected by wire to the module?

    Thank you 

    • 0
    Posted
    10 minutes ago, Peppe said:

    Thank you Neo.

    Sorry but the proposed suggestion is not clear to me. Does the gateway assign an ID to the device buttons? I thought the button ID is related to VD.

    In the case I succeed with hide the button, does this also disable the physical buttons connected by wire to the module?

    Thank you 

    Please login or register to see this attachment.

    • 0
    Posted
    Just now, Neo Andersson said:

    Please login or register to see this attachment.

    Id of a button can be accessed from inside the quickapp itself..However the linked callback function can be called fromoutside the quickapp too.

    Hiding buttons does not disable the physical button.

     

    • 0
    Posted (edited)

     

    Beeing you i would go for it like this>

     

     

    Hide your original shutter devivce in Fibaro.

    Create a VD that will controll the original shutter device. (I dont know if HC2 has a roller shutter type device for VD, but i assume it has.)

    Link you VD shutter device to the original shutter device. (just mirror every original functionality to the VD)

    (if VD Open then original open etc.)

    Now, before every action that is made in VD, right before you call the action for the original, just check the window status, and do your action upon the result

    e.g.

     

    Please login or register to see this code.

     

     

     

     

    Edited by Neo Andersson
    • Like 1
    • 0
    Posted
    40 minutes ago, Neo Andersson said:

     

    Beeing you i would go for it like this>

     

     

    Hide your original shutter devivce in Fibaro.

    Create a VD that will controll the original shutter device. (I dont know if HC2 has a roller shutter type device for VD, but i assume it has.)

    Link you VD shutter device to the original shutter device. (just mirror every original functionality to the VD)

    (if VD Open then original open etc.)

    Now, before every action that is made in VD, right before you call the action for the original, just check the window status, and do your action upon the result

    e.g.

     

    Please login or register to see this code.

     

    However, the physical behaviour of your wired wall switch will not be affected. There is no way to disable a wired switch functionality (as far as i know, but maybe i am wrong about this, however it seems to me impossible). Usually you can disable phyisical interactions through Local protection of a device, but its not a solution for you, as turning on local protection needs personal interaction on device's web UI anyway.

    Either disabling  a device or hiding its buttons in Fibaro would not prevent shutter to function if a wall switch button was physically pressed.

     

     

     

    1 hour ago, Neo Andersson said:

    Please login or register to see this attachment.

     

    • 0
    Posted
    1 hour ago, Neo Andersson said:

    Please login or register to see this attachment.

     

    1 hour ago, Neo Andersson said:

    Please login or register to see this attachment.

     

    1 hour ago, Neo Andersson said:

    After disabling a device, its interface controls will still react to button clicks. I would rather set buttons visibility to false. self:updateView("buttonID", "visible",false), maybe there are some other options to block UI controls too (some other api calls for layout, i dont know, never tried),

    Sorry i had a typo here. It is updateView and not updateProperty

    • 0
  • Inquirer
  • Posted (edited)

    Hi Neo, thank you for all your hints!

    At the very end, I found a more easy way to address my issue, the use of protection attribute of the module.

    So I wrote this basic code:

    Please login or register to see this code.

     

    Where tenda is curtain in Italian.

    I will add some additional points like:

    - disable the device while protections are ON, in this way I can easily see on HC2 and on the APP that the device is currently not usable.

    - improve the debug message reporting the current state of protection value instead of a simple string.

    Thank you

    Edited by Peppe
    • 0
    Posted (edited)
    19 hours ago, Peppe said:

    Hi Neo, thank you for all your hints!

    At the very end, I found a more easy way to address my issue, the use of protection attribute of the module.

    So I wrote this basic code:

    Please login or register to see this code.

     

    Where tenda is curtain in Italian.

    I will add some additional points like:

    - disable the device while protections are ON, in this way I can easily see on HC2 and on the APP that the device is currently not usable.

    - improve the debug message reporting the current state of protection value instead of a simple string.

    Thank you

    I think you wil not see the device at all in your mobile app, if it is disabled.

    Edited by Neo Andersson

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