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


  • 1

Disabling a device from Lua script


Question

Posted

Hi all!

I am a bit of a newbee to LUA so have been reading/stealing a lot of good things from this Forum. Thanks to all contributors for that!

 

I have just installed my garage door to be controlled by a Fibaro switch. It works great but as I have no sight in HC2 to whether the garage door is open or closed (it is a simple trigger open/trigger close door)  I would like to disable the device with the start of the virtual device Away/Holiday (that also sets a predefined variable.). By disabling the garage door device I won't have to worry about accidentally opening the garage door when away.

 

On the developer forum I did find some code that should be able to this but can't seem to get it to work:
function Device:setEnabled(true)

For one, I don't know what to fill in for Device. ID does not seem to work.

 

The system also accepts the code below but I does not seem to do anything.

fibaro:call(67, 'setEnabled','False') 

 

Can someone tell me what I am doing wrong? Thanks!

2 answers to this question

Recommended Posts

  • 0
Posted

Do you want to deactivate Switch itself or some virtual device that operates it? If switch itself, it is not really possible - there is no protection mode in this module. To make sure you will not activate it accidentally I would recommend hiding device itself, and operating switch with Virtual Device that will check for some kind of global variable set by Away/Holiday device.

  • 0
Posted

Hi all!

I am a bit of a newbee to LUA so have been reading/stealing a lot of good things from this Forum. Thanks to all contributors for that!

 

I have just installed my garage door to be controlled by a Fibaro switch. It works great but as I have no sight in HC2 to whether the garage door is open or closed (it is a simple trigger open/trigger close door)  I would like to disable the device with the start of the virtual device Away/Holiday (that also sets a predefined variable.). By disabling the garage door device I won't have to worry about accidentally opening the garage door when away.

 

On the developer forum I did find some code that should be able to this but can't seem to get it to work:

function Device:setEnabled(true)

For one, I don't know what to fill in for Device. ID does not seem to work.

 

The system also accepts the code below but I does not seem to do anything.

fibaro:call(67, 'setEnabled','False') 

 

Can someone tell me what I am doing wrong? Thanks!

 

I know this post is old but i use a relay to control my garage door and use a standard alarm contact connected to a universal binary sensor to see if it is opened or closed. I also connected  a DS18B20 temp probe to the UBS and can also read the temperature in the garage.

I used a normal indoor contact sensor (and magnet) for the garage.

 

I also have the same setup for my gates but this time I used a more industrial contact sensor (similar to 

Please login or register to see this link.

I placed the sensor in the motor housing under the gates and routed the cable to the control box for the gates which is just behind the pillar. This is where I placed the UBS for this setup. I also replaced the contact sensor magnet that came with it with a couple of small but powerful magnets that are stuck to the gate 'shoe' in the motor box.

 

This setup gives me open/close control and status on the HC2.

 

I could share some more detail or pictures of either setup is anybody is interested.

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