I need help with some logic. I know when my family members are awake and when they are sleeping. I know about movement, temperatures and a lot of stuff more around my house, due to a lot of sensors.
Now I want to teach the house something about day mode, evening mode and night mode. Well, at first this is easy. Take a time and set a variable to day, evening or night. But this is not what I want. Each housholdmemeber might get up to different times and for different reasons.
E.g.: Night mode is easy. When everyone is sleeping set variable to night. Now it is 3 o’clock and I am thirsty or I need to go to the toilet. I still want to stay the house in night mode. A few hours later - 5 o’clock - I need to get up for work. Now the house should go to day mode. How to know the difference between 3 and 5 o’clock situation? Already thought about a countdown, start when I get up and stop it when I get back to bed, but this sounds inefficient.
Evening mode looks similar difficult. I already thought about sunset, but what about winter? I don’t want the house to go into evening mode at 4:30. And creating exceptions for the four seasons might be too much expenditure.
For those who might ask why I want these modes: For lighting, heating, etc. I want to reduce the light in the evening and reduce it more throughout the night.
And one more thing : I don’t want to set the mode with a switch or my mobile. I want the house to know it by the sensor values it creates. Otherwise it won’t be a smart home
What you need to do is set up a set of ‘points’ which determine whether your awake or not.
ie. movement in the bathroom between 12am and 5am may give you one point. Where as turning on the shower may give you 7 points. And turning on the radio give + 4 points Ideally you set as many of these up as possible, as well as setting up items which give negative points for things which would indicate your are not awake. -3 points if your electric blanket is on. etc.
If points > 10 - then its morning.
ie the use of Bayesian Probability. Take lots of input and determine the probability of something being true. While this is used generally to determine whether someone is ‘at home’, the same theory applies to whether someone is ‘awake’
Seems to me normally you want your lights switched on when it gets dark, not reduced. And you want them switched off at night and during the day. Or am i misunderstanding you?
@Jamie: like the idea, but now I have to think about the different morning rituals.
Alarm clock goes on… (messure power with a wall plug)
and when not using the alarm in the morning…… then second rituel is ….
Switching the coffeemaker on (messure power with a wall plug)
I myself have 2 modes,
I set a sleep mode and a deep sleep mode. sleep is when my family members are asleep and deep sleep is when everyone have been asleep more than 30mins.
These state drives different lighting levels and security.
How I derive the modes is studying my patterns with sensors.
Deep sleep is easy as when there is no sensor movement after 30 mins, start deep sleep. Disabling deep sleep happens when there is activity for more than 30 mins continuously after sunrise using countdown and logging movement every 5mins using time now. If there is no movement after a 10 mins interval after the first movement after sunrise, the sleep modes doesn’t get turned off as it knows i went back to bed…
To know what’s happening between the 3am and 5am is to understand your patterns and differentiate the actions u do. For me, it is me going to the kitchen for a drink, so I have a sensor near when I have my cups to detect. My wife goes to her wardrobe, so I have a door sensor, my child has a sensor at his bedside… so all this different combinations will determine the sleep modes… 2 or more people awake will kill all modes and tell me its time to wake up and prepare for the family if I over sleep.
Down side to this method is u need alot more sensors to get “better resolution” of your actions and thinking of a matrix of sensors activated that determine the actions.
I achieve this matrix by using the GROUPs and SETs app. I group the actions when ALL sensors I select are active. I use sets app to calculate probability by extending the countdown action and if all states in the set are active, execute a flow…
So far for me it works.
I like the idea of the points. One of the questions raising in the demand is what you want to achieve with heating. Because if you let that depend on the activities, in the morning the house will not be warm when you wake up.
If you have alarm clocks configured in your Homey, you can have a flow detecting the alarm.
For lights on/off I would combine “awake presence” with the amount of lumen outside. I don’t have it yet, but I am thinking to have a light sensor outside. Sofar I work with “sunset”, “sunrise” but that hardly says anything about the amount of daylight in my experience.
I hope this adds some suggestions that are useful for you.