Homey Community Forum

It's time for bed! Flows for bedtime

Dear readers,

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!

Bedtime explanation
What we are going to build here is a flow right before bedtime. In our case, my wife and I are usually going to bed at the same time (well, maybe 5 minutes in between, but we prepare togheter). This flow will only work when that’s the case in your house as well or when you life alone.

We’re going to make a flow that activated the lights on your way to bed and trigger the ‘house shutdown’ protocol when you are ready to sleep. More about my house flows here:

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! :smiley:

  1. A Homey (ofcourse :slight_smile:)
  2. The ‘Virtuele Apparaten’ app on Homey by Arjan Kranenburg
  3. Lights that work on Homey, in my case Ikea

For the lamps I use Ikea lamps… I am very happy with these! As you may (or may not) know, these lamps are pretty much the same as the Philips Hues, but a lot cheaper. They are available nearby (in my case), are stable, work good and fast and aren’t very expensive. I only use the white ones that are dimmable, I found it useless to color the lights in my house… But that’s to your own taste ofcourse!

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 ‘Bedtijd’ or ‘Bedtime’ 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.

The flows of this switch
The idea behind this tutorial is to create a flow system that takes care of you and your home when you’re going to bed.

First, make sure you’ve created the virtual device as explained above.

The first flow: Activating bedtime protocol
Activating bedtime is taking care of your lights on your way to your bedroom. That’s all it does in my case at first. Well, there are some other flows, but more about those later.

If The modus is changing
And Bedtime modus is on
Then Turn off a few lights and turn on others

I am using the ‘if modus changes’ flow card here to make things cleaner. This builds two flows into one. When the modus is changed, the flow will be activated. If the modus is on (turned on > is changed > is on) run a few things. If this and failes, it automatically means that it’s turned off so run some other actions. Pretty easy right?

Right now we are going to turn off a few lights that we do not need anymore and at the same time I turn on some lights that lead the way up to our bedroom. Ofcourse, the lights in the bedroom are turned on as well.

The other flows are explained in other tutorials. Please search for my posts in order to find out more about them.

Soo now it’s getting interesting. Because in the ‘else’ we are handling the ‘bedtime turned off’ actions. In our case, when bedtime is turned off the house will be turned off. This will take care of the whole house. Please visit my post about turning the house on and off here:

The second flow: Time to go to sleep!
Well, we’re in bed! the lights are still on, but we’re ready to go to sleep. Let’s trigger this! But it’s not cool to tell Google to turn off the bedtime switch or open the app first. If we’re drunk or just extremely tired, we want this to go as easy as possible.

If The light in the bedroom is turned off
And Bedtime switch is turned on
Then Turn off the bedtime switch

This is pretty cool… Because right now, we do not need to think about that whole house protocol and deactivating… Just tell Google to turn of the lights, hard turn off the lights, use your Google Hub to turn them off, use the app to turn them off… It’s your party!

In the ‘and bedtime is on’ flow card we detect that the bedtime switch is turned on. If this is the case, we need to take care of the whole house without bothering you.

Soo ‘then’ we’re going to deactivate the house.

*Activate bedtime with voice command
This is our main way of activating bedtime, by telling Google it’s time to go to bed. Because Google and Homey are synced, the Virtual Device/Switch is also synced to Google. In this case, we can ask Google; ‘Hey Google, bedtijd aan’ (add the name of your switch here, eg bedtime). Google will flip the switch to ‘on’ and Homey takes care of 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:

  1. Add a new Google Routine
  2. As trigger, use ‘I say something’ and add all the sentences you can think of as a command. For example; ‘we’re going to bed’, ‘it’s bedtime’, ‘we’re going upstairs to sleep’ 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
  3. Trigger a smart device and choose 'Bedtime: Turn on (or off)
  4. Done! From now on you can say more logical sentences to your google devices instead of ‘house on’.

You could als add the house switch to a default routine that’s built in within Google, for example to bedtime protocol. Edit this protocol and add 'Trigger a smart device and choose ‘Bedtime: Turn on’ to this routine. This way when wish to go to sleep and you say ‘Hey Google, we’re going to sleep’, Google could tell you the weather forecast, your agenda, the latest news, setup a morning alarm and also activate your entire house at the same time. Awesome right?

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!