First; sorry for my English. I think you’ll understand what i’m saying, but you might find a lot of typo’s along the story. If you need any more explanation feel free to ask!
Alarm system explanation
Soo there are many alarm systems out there and even apps that do the same. Because I embedded this alarm system in my flows I decided to built it on my own.
This system will activate an alarm sound and give push notifications when somebody is entering the house when there’s nobody home. Sounds pretty logical, right?
What do you need for this functionality?
The following devices are necessary to complete this tutorial. Maybe there are parts you wish to use for your own, but I write my posts as if you’re going to copy it exactly!
- A Homey (ofcourse )
- A motion detector
- The ‘Virtuele Apparaten’ app on Homey by Arjan Kranenburg
- Switch on the ‘Location’ functionality in the Homey settings
For the motion detector I use the ’ Xiaomi Mijia Human Body Sensor’. I bought this sensor when I started using Homey in March 2020 and have been using them ever since. I have three, one in every room I needed a sensor in. The only downside of these sensors is that they do not reactive their timers when you keep walking through their sight. This might give a short flash of the lights when the timer is over and you’re still waking there, soo it reactivates. But they’re cheap and have a great battery life and are reliable. There might be better options, but I can assure you that they won’t disappoint you for this price range.
I am not sure if the app I provided is available in multiple languages, but it’s pretty straight forward soo there is no need to understand Dutch for it. Once installed, add a new device, choose ‘Modus’ as option, give the modus a name (for example, mine is simply ‘Alarmsysteem’ or ‘Alarm system’ in English) and add an icon. Since i’ve been using a lot of different modus buttons I have been downloading icons from the FontAwesome library in order to give everything a nice looking button. For example, I used the icon in the link below. Once you’re on this page find the download button that’s located right underneath the title of the icon. This will download a .SVG icon that the app in Homey can use. You get the icon upload functionality when you’re installing a modus. You could ofcourse also just use the built in icons but I found myself using the same icons over and over again since there are not many to choose from.
Optional; this is what we’re going to embed
The following items are not needed to create this house switch, but this is what I embedded in my flows. Be creative and add anything you like, or just copy my way of handling devices.
- Tuya activated sirene systems
- My Yeelight color bulbs in the front and back hallway
- The Soundboard app by Athom
- A virtual button
I will explain more about these products i’ve been using in other flow explanations. Remember, these products are optional… They are written down here to give you an idea what I am embedding in my house switch.
For the virtual button I bought the ‘Xiaomi smart wireless switch’. This switch is cheap and works great! Nothing more to say here…
The flows of this switch
The main idea is that the alarm will sound and you will be notified on your smartphone when somebody enters the house when you don’t want this.
First, make sure you’ve created the virtual device as explained above.
The first flow: Activating the alarm on movement
This is actually the main flow. This flow will trigger the alarm when it’s needed.
If Somewhere in the house a movement sensor activated
And The alarm system modus is turned on
Then Let Homey speak, send a push notifications, change the lights in the hallways to red and activate the alarm sound in Tuya
There is a sensor change flowcard, use the change in movement sensor here. This will trigger this flow when any movement sensor in the house is activated.
The ‘and alarm system is turned on’ flow card is important, we do not want the alarm to sound when this virtual switch is turned off.
Then theres the ‘and nobody is at home’. This card interacts with your location manager. When you are at home and your movement sensor is activated but your house is turned off, you wish to turn on your house instead of letting the alarm sound. Your simply just coming home. This card is taking care of that. More about (de)activating your house in my other tutorial:
The ‘and somebody is home’ makes sure that the house may be turned on, this prevents switching when we’re not even close to our home and we’ve got an unwanted visitor. Ofcourse there is a small chance that we’re within 100 meters of our home and we’ve got company we do not want (let’s say; we’re at the neighbours) but that’s a thing we simply accept.
Once the alarm is activated, notify everybody by saying it through the Homey device. This is giving unwanted alarms a heads up to the users.
After that, we’re sending a push message to all of our users (my wife and myself). This is giving a notification that the alarm is activated when you’re not home, pretty useful I guess!
Next, we are changing the colors of our lamps in the two main hallways to red, giving a visual notification that the alarm is activated.
Last but not least; I bought two TUYA activated sirenes which I will activated in this flow. These TUYA sirenes are bought at the action for under 10 euros. I found it hard to activate these products directly from Homey soo I created a work around. More information about this below.
The second flow: deactivate the alarm
When the alarm is activated and the sirens are turned on (and trust me, your ears will pop), we need a way to turn them off as well.
If The alarm switch is turned off
Then Turn off the sirenes and reset the lights with flows
In my previous alarm system we could switch it off but when the right variables were not set, it will turn back on again. Using the switch and the switch only it’s very simple to turn off the alarm in case something is giving a false alarm, let’s say the dog opened the backdoor.
We trigger the ‘turn off the sirenes’ scene in TUYA. Maybe they are not activated when we turn off the alarm system, but it’s not a problem to hit deactivate anyway just to be sure.
The flows to reset the lights are explained in another tutorial, because there is more to it!
The third flow: add a guest modus
Soo let’s say you’re heading out for a movie with your partner but somebody is staying home to babysit your child. In this case you want your house to stay activated and the alarm system may not be switched on.
First create a new Virtual Device, I named ours ‘Gastaccount’ or literally translated ‘Guest account’. This virtual device is need for the upcoming flows.
If Gastaccount modus is changing
And Gastaccount is on
Then Activate the house, let the bulbs in both hallways turn green, let Homey speak
Else Let Homey speak and reset lights
We are triggering this flow when the guest modus virtual button is switched. This is useful because we can activated two flows in one action, activating and deactivating this virtual device.
We use ‘and gastaccount is on’, this way we will activate the first part of the ‘then’ when the modus is turned on and when the switch is turned off, the ‘and’ is false and soo the ‘else’ is activated.
We will turn on the entire house, this is a pré. Ofcourse we wish that the house is turned on when somebody is visiting and we’re not there. When we activate this virtual device from another location (let’s say, 5 minutes before my parents arrive at our place) the guest mode will be turned on, the house turned on automatically and the alarm system is turned off.
Next, we color the lights in the hallways green indicating that the guest account is activated and our guests may enter without worrying that the alarm will sound.
Also, we’re giving a notification that the guest modus is activated by letting Homey speak. This way we will be notified that the modus is activated succesfully.
Once the modus is turned off, we will let Homey speak again and reset the lights by activating some flows. Please visit my light tutorials in order to understand why this is done by flows.
The fourth flow: guest modus with a button
We installed a virtual button in our hallway, triggering the guest modus. This might be useful because we do not wish to speak to Google or start up the Homey app all the time.
If the button is pressed
And somebody is home
Then turn on the guest modus on/off
Else Send a push notification
Soo when the button is pressed, we are activating this flow.
We built in the ‘and somebody is home’ flow card. This is pretty important. There might be somebody entering the house, setting the alarm and figures out the alarm may be disabled by pressing this button. That’s not what you want. Building in this flow card will prevent this from happening.
But there is another trick for this ‘and’ card… Because if you expect somebody to arrive at your place, you may ask all your relatives to push the button on entrance and wait for the lights to turn green before entering. Let’s say your at work, your dad is pressing the button… You will get a notifcation knowing that he arrived. You push the notication and hit the Virtual Device button named ‘Guest account’, done!
Activate TUYA devices without struggles
Soo I found it hard to find TUYA device keys and I do not like to add static IP addresses to my flows in order to make stuff work. As soon as my router resets IPs somehow, my devices stop working.
Install the Tuya Cloud app and login with your Tuya credentials.
I found a solution in Tuya Smart Scenes. Inside the TUYA app, create scenes that do the smart work for you. For example, for this tutorial, i’ve created two scenes for activating and deactivating the alarm. Inside your flow, add a Then card and scroll down to your Tuya cloud app. Here you can choose a scene to activate.
This solution works for anything… Setting a percentage for your roller blinds, changing lights, activate alarms or whatever action you wish to use and all without IPs and hard to find keys .
(de)Activating the switch by voice command
We do not use this very often, but it’s still useful sometimes. If we wish to turn switch the guest modus with our voice using a command, we are able to use Google Home. Once we’ve linked those two devices togheter, Google will add the virtual devices to it’s database. From now on we can say; ‘Oké Google, gastaccount aan’ (guest mode on), were you pronounce the name of the switch and add on or off to your command. This will turn the virtual switch on or off, Homey will do the rest.
Since Google released ‘Routines’ in the Europe apps, it’s also possible to give this command a little bit more logical sentence. To create this, follow these steps:
- Add a new Google Routine
- As trigger, use ‘I say something’ and add all the sentences you can think of as a command. For example; ‘turn on the guest account’, ‘guest account on please’, ‘we have a babysitter in the house’ etcetera. You muse very specific because google will only trigger when you say the exact sentence, but you can add as many different options you can think off
- Trigger a smart device and choose 'Guest mode: Turn on (or off)
- Done! From now on you can say more logical sentences to your google devices instead of ‘guest mode on’.
Add your nest thermostat to this flows!!
Yes, it IS possible! Since Google added the routines to the European systems, it is possible to switch your Nest thermostat on and off. I am embedding this into switching my home on and off, or better just off. I wish to turn on the thermostat by hand or when we’re on our way home, but we forgot to switch it off pretty often. Our solution? Use Google Routines!
Following the above tutorial you are also able to add a routine card that turns your nest thermostat off before (or after) you hit the virtual switch. Soo when you ask Google to turn off your home it will turn off your nest thermostat and turn off your house in a sequence.
That’s all folks!
Soo that’s all. In my flows you’ll find some other interesting triggers which I will explain in other tutorials. Feel free to search for them. I will write them in the upcoming days.
If you have any questions, feel free to ask them below!