Homey Community Forum

Setting sleep/awake state with smartphone charger and smart plug

These flows set the sleep state when a smartphone is connected to the charger via a power measuring smart plug. When you disconnect your phone, it sets your status to awake after one minute. I use Fibaro smart plugs, but it might work with other brands as well.

Setting asleep is easy, as the connected phone is drawing a decent amount of power when charging starts.

Set Dennis’ status to asleep
When The power changed
And Power is greater than 4
Then mark Dennis asleep

When the battery of the phone is full, the charger will keep charging it a few times per minute, because it is using a little power constantly.

I have created a countdown timer for 60 seconds, that starts running every time the power use of the charger changes AND is 0 W.
Every time the power use changes AND is higher than 0 W, the timer is stopped. This happens multiple times per minute from the moment the phone is fully charged.
When the phone is disconnected, the used power will stay at 0 W, so the timer will keep counting down to 0.
When the timer is at 0, my status is set to awake.

I did use The Countdown App, created a timer TimerDennis and created two flows:

Dennis Phone Power
When the power changed
And Power is exactly 0
Then Start countdown timer TimerDennis 60
Else Stop countdown timer TimerDennis

Dennis gets up
When Timer reaches zero (0) TimerDennis
Then mark Dennis awake

Values can be different for various phones, chargers and smart plugs, but the basics should work for everyone.

Enjoy!

1 Like

If i may make a liitle side note about the flow, if you phone is set to sleep… and for example someone calls you. You take the phone from the charger and the call is longer then 1 minute!!! It wil set you awake. Guess thats not something you want, maybe depends on the actions you have givin the awake flow.

That’s true. I use a very long charging cable, so I can use it with the charger connected. Of course you can tweak the flows as much as you need, these are just the basics.

2 Likes

I use a button from remotec that i push when i go to sleep.
Then, everything that needs to go off is turned off, google hub tells me a short review, like the temperature outside and in the bedroom, how many kwh i have collected with my solarpanels, then it tells me if i have to put the trash outside the next morning and at what time i have to work. And the radio turns on, coz i like to listen it while falling asleep (sonos)

When i wake up by the alarmclock i have created with homey (dynamically) will make a sound over the sonos, i push the same button but then it says goodmorning and again i get a little review… like if it is raining the comming hour, again if i have to put the trash outside, the temperature, etc.
The alarmclock repeats every 5 minutes as long as i stay in bed.
And from that point i woke up, in every room i get notified every 5 minutes what time it is and 30 minutes before i have to be on my work and I haven’t left yet, it tells me that i have to hurry :slight_smile:

Works like a charm :slight_smile:

1 Like

Of course there are many ways to set up the morning routine. I really want to automate stuff, so I try to avoid having to do anything more than I was used to do, like pushing buttons. Not that there’s anything wrong with that, but I prefer not to.
I use it mostly to trigger the heating system at this moment, but I’m sure I will add other, silent, functions in the future. If anything starts making noise in the bedroom, the partner acceptancy factor will drop many points per day, I’m afraid. :wink:

I understand. But i doubt if it works… only thing i earlier came up with, is by watch which notice that i am awake. But then again, when u wake up coz u need to go to he bathroom, that the system fails again.
Maybe you can fix it by multiple solutions… like icalendar2voice and put your routine in google agenda. You is for your schedule for school or work and name it like that.
Then, you can make variables that know if you have to work or go to school. U do know how many time before that you have to wake up.

My first reply was for weekends or days off… but when i have to work, i dont have to do anything. Homey know that i have to work, so i will be awake at that time the alarmclock goes off.

But for the time you go to sleep is way to difficult. Coz you wont sleep right away but i bet you wanne fall asleep in darkness. So, some piont you have to do something.

Unless you never read, watch tv or anything before you go to sleep. Then you can automate with icalendar2voice that everything goes off at, lets say 23:00 oclock and you have to sleep then…

Even with presure sensors under the matras you will have the same issues.

Even tho when you have a day off, you can automate it with a motion sensor when you leave the bedroom. Use timestamps to exclude bathroom visits.

Or… if it was possible, connect your brain to homey… but also here you will have a problem with the time during falling asleep and bathroom visits.

I bet it is not possible… if you can do it anyway, tell me! :slight_smile:

I think it’s great peeps sharing their flows. And that’s what’s this category is all about aye? Reactions with “I use a button for it” has nothing to do with sharing a great flow which other peeps can use to their own needs.

2 Likes