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

Turn on the lights when you're coming home


Question

Distance check is a LUA script to turn on the lights when you’re coming home, for example to turn on the garden light.

It uses the GPS functionality of the Fibaro HC2.

The script tries to manage the delays or the errors that sometimes there are acquiring the user's location by the Fibaro/GPS and it requires an interval of 1 minute for the Fibaro HC2 parameter "How frequently GPS position from the user’s iPhone should be collected".

It has been tested in scenario where you are some kilometers away from home and you are going to home.

 

How it works.

 

You can define four areas: large area and small area, gap area and extra large area.

 

The area are circles around the location of the house.

When you enter in the large area the light is turned on and a timer is started.

If you reach the small area before the timer has expired the light will be “confirmed on” otherwise the light will be turned off. Perhaps you was not going to home but you have entered in the large area for a while.

When the light is “confirmed on” by the first timer a second timer is started. If you exit from the small area before that this timer has expired the light will be turned off. This second timer avoids that the light remains on when, for example, you pass near the house (inside the small area) without to stop at the house.

If you remains in the small area the script will continue to run to check when you will go away from home just to reset at the condition where it checks when you area arriving to home.

The reset happens when you will be out of the “large area + a gap distance”.

Large area + gap distance define the gap area.

The gap area is to avoid that the script switches exactly on large area border when you are going away from home. Infact it could be that the road you are on goes in and out from the large area or that the FIBARO GPS reports different values (greater or less than large area radius) when you are next to the large area border. So, without the gap area the script could turn on the light when you are going away from home.

 

It is important to note that even though the script should erroneously turned on the light when you are going away from home the light will be turned off after the first timer is expired since you will not enter in the small area.

Anyway the gap area avoids this kind of error and it is used only when you are going away from home.

 

Link for script (ZIP file) and documentation (PDF) download:

Please login or register to see this link.

 

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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