Z-Wave

Fibaro Home Center – Geofencing

Fibaro Home Center - Geofencing

What makes a home "smart"?

Is it the fact you can control your lights and devices from your phone? Sure. That’s part of it. However, I strongly believe what makes a home (or office) truly smart is when you don’t need to touch your phone at all. Your Z-Wave home automation system can make intelligent and automated decisions for you… without having to lift a finger.

That’s when a home becomes genuinely smart.

In this blog, I am going to introduce you to one of the most powerful, yet mystifying aspects of home automation – Geofencing with Fibaro Home Center 2.

What is a geofence?

As the name implies, it can simply be described as an invisible “fence” around a geographical location – usually at a set radius distance (30 meters as an example). When a GPS device (such as your smartphone) enters or exits a predefined geofence, the “fence” is considered to be “breached”.

Fibaro Home Center 2 Geofencing

Let’s take a look at how Fibaro have implemented Geofencing and how powerful and useful it can be. I am going to use our SmartHome office as an example.

When one of our team arrives at the office in the morning, I would like to turn a light on (keeping it simple for this example) – but only if they are the first to arrive.

When the last person leaves the office, I would like to turn a light off.

Let me show one of the ways we can do this with the Fibaro Home Center 2.

Home Center 2 – Localisation

In order to create a Geofence around my office, I first need to tell Home Center where in the World the SmartHome office is located! I do this by providing longitude and latitude coordinates into the Localisation Panel within Home Center.

Please note that you will need to be logged into your Home Center through your web browser as the Administrator < this is very important.

1. Click on “Panels” in the top menu
2. Select “Localisation panels” from the list on the left
3. Click “Add new” from the menu on the left
4. Enter a Name (Office). 5. Drag the PIN to the desired location on the map. 6. Click “Save localisation”.
Great. Now Fibaro Home Center 2 knows where the SmartHome office is located.

Creating a "Variable"

This is where we get a bit clever. What if someone has already arrived at the office before me (very unlikely)? I don’t need Home Center to turn lights on etc. – they are already on. And of course the same holds true if someone else arrives at the office and I’ve already started my workday (very likely).

To avoid these conflicts and to make sure Home Center knows if the office is occupied or not, we can use a “Variable”. Think of a variable as a typical light switch – it has two states (you can have more) – on or off < this is the variable (on/off). In home automation terms, variables can be very powerful, as you will see below.

My “Variable” is simple… I would like it to reflect the number of people currently in the SmartHome office. So I can let Home Center know if the office is empty or not, I will create an “OccupyCount” variable (you can name it anything you like).

1. Click on “Panels” in the top menu
2. Select “Variables Panel” from the list on the left
3. Now click the “Add” button under “Variables”
4. Name your Variable: OccupyCount (or whatever you like). 5. Leave the default value of 0. 6. Click Save
Perfect. Now we have a way of letting Home Center know if the office is occupied or unoccupied – and by how many people (you will see how we can cleverly use this little bit of information below).

Creating the Scenes

For this example, I am going to keep my “Arrive at office” scene very simple. When I get to work (or rather when I am close to arriving to work), I would like my office lights to turn on. So I create my “Arrive to office” scene in Home Center. Of course, I only want my office to come to life if I am the first to arrive…

Arrive at office Scene

1. Click on “Scenes” in the top menu
2. Select “Add scene” from the list on the left
3. Click the “Add” button in the “Add scene using graphical blocks” section
4. Click the + icon in the scene window. 5. Select Variables > OccupyCount
6. Now adjust the element: OccupyCount = = 1. 7. Change the And block to Then. 8. Click on the very bottom + icon
9. Select a device you would like to activate
10. Make sure you click the Save button!
The Scene above will turn on a light for the first person that arrives to work (OccupyCount = 1). I now need to create a scene that is triggered when the last person leaves the office (OccupyCount = 0)…

Leave the office Scene

1. Click on “Scenes” in the top menu
2. Select “Add scene” from the list on the left
3. Click the “Add” button in the “Add scene using graphical blocks” section
4. Click the + icon in the scene window. 5. Select Variables > OccupyCount
6. Now adjust the element: OccupyCount = = 0. 7. Change the And block to Then. 8. Click on the very bottom + icon
9. Select the same device you would like to turn off
10. Make sure you click the Save button!

User Geofence – Arrive at office Scene

This is where we tie it all together with our Geofence based on our location (or rather our smartphone’s location). When I arrive at the office, I want our OccupyCount variable to add 1 to the current number. This not only tells Home Center that there is someone in the office, it will also keep a count of how many employees are currently in the office (this may be handy to use in other Scenes or Notifications you may want to create later).

Repeat the following Scene for each User in your Home Center…

1. Click on “Scenes” in the top menu
2. Select “Add scene” from the list on the left
3. Click the “Add” button in the “Add scene using graphical blocks” section
4. Click the + icon in the scene window. 5. Select GPS > Username > Appears in the > Office.
6. Now adjust the geofence area – I set mine to 50m. 7. Change the And block to Then. 8. Click on the very bottom + icon.
9. Select Variables > OccupyCount.
10. Now adjust the scene element accordingly: OccupyCount + = 1 (this will add 1 to our OccupyCount variable). 11. Make sure you click the Save button!

User Geofence – Leaving the office Scene

Now we want to subtract 1 from our OccupyCount variable every time someone leaves the office.

Repeat the following Scene for each User in your Home Center…

1. Click on “Scenes” in the top menu
2. Select “Add scene” from the list on the left
3. Click the “Add” button in the “Add scene using graphical blocks” section
4. Click the + icon in the scene window. 5. Select GPS > Username > Leaving the area > Office.
6. Now adjust the geofence area – I set mine to 50m. 7. Change the And block to Then. 8. Click on the very bottom + icon.
9. Select Variables > OccupyCount.
10. Now adjust the scene element accordingly: OccupyCount - = 1 (this will subtract 1 from our OccupyCount variable). 11. Make sure you click the Save button!

Rename your Scenes

To keep things neat and tidy, you should rename your Scenes. Click on the wrench icon for each Scene you just created and rename appropriately…
Almost done… One last little thing to do…

Enabling GPS tracking for Users

We now need to make sure that each Home Center User is reporting their GPS coordinates via their phone to Home Center (each User will of course need to have the Fibaro app installed).

For each User, do the following…

1. Click on “Configuration” on the top menu
2. Select "Access Control" from the menu on the left
3. Click on the Pencil (edit) icon to the right of a User
4. Adjust the “How frequently GPS position...” setting – I set mine to 5 min. 5. Make sure you click the Save button!

We are done

Let’s take a quick overview of what we have achieved… When someone (User) arrives at the office (based on their current GPS location from their phone)…
  • The OccupyCount variable is increased by 1
  • If this person is the first to arrive (OccupyCount variable will be 1), a light is turned on
  • If this person is not the first to arrive (OccupyCount will be greater than 1), then nothing happens – exactly what we want
When someone (User) leaves the office (based on their current GPS location from their phone)…
  • The OccupyCount variable is decreased by 1
  • If this person is the last to leave (OccupyCount variable is 0), a light is turned off
  • If this person is not the last to leave (OccupyCount will be equal to or greater than 1), then they won’t plunge their colleagues into darkness

Privacy…

I don’t want to get all preachy here… but it would be remiss of me not to point out that monitoring someones location via their phone – without their knowledge and consent – could be considered a gross (and rather creepy) invasion of privacy. Do the right thing people 🙂

Some final thoughts…

Geofencing is not infallible – perhaps someone forgets his or her phone or the battery is dead. This solution relies on each User’s phone to be on them and powered on (so it can report a User’s location via GPS). For this reason, I don’t advise incorporating “mission critical” scenes – like locking doors or turning on alarm systems.

It is also possible that the Variable (OccupyCount) may get out of sync… Let’s say someone arrives and the count is +1… if they leave without their phone, then the count will not return to 0. I have been using this solution with our team for around 2 weeks at the office now and only once has the count gone out of sync. To reset the count, simply adjust your OccupyCount Variable manually within the Home Center Variables Panel interface.

It won’t take you long to see that Geofencing with your Fibaro Home Center 2 can be very powerful. You could for example setup a Geofence for your kids so you know they have arrived home from school safely – and a lot more.

As always, please leave a comment below if you run into any issues – we are always happy to help. If you have found a better or more efficient solution than above, let us know so we can share it with the World 🙂

All the best,

Brad

Leave a Reply

Your email address will not be published. Required fields are marked *

16 − 2 =