This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Machine learning and prediction - A first shot

So, just bought my Homey one and a half week ago and my first impression is that I like it a lot!

Sure, a lot can be improved in Homey, like speech recognition and the home/away prescence (has only worked once).
I really like the app store with downloadable device support!
If I don't need stuff, there's no need to have it installed! GG!

So, backstory:
When our son was born about 15 months ago we got up at night (every night :( ) for food and diaper change and every time during winter time we needed to turn the lights on in the hallway to be able to see what we were doing. So I created a scene in my Vera Edge that would solve all our problems; when the motion sensor in the hallway discovered motion AND the lux value was lower than a specific value, a lamp would turn on. The scene looped with a pause for a couple of minutes and checked for motion again and again. If there were no motion, the lamp would turn off again.

I thought that my wife would think I was her night in shining armor...and maybe she would have, if the lamp didn't stayed on the entire night, or if the lamp didn't turn on all of a sudden, or if the lamp didn't turned on and off randomly or if the lamp turned on at all...

It's been naggin me ever since that why do we need to create flows/scenes and scripting when things can be automated?
I read the post(s) from MathijsFrencken here about AI and I realized I wasn't the only one looking for predictions.
So I've decided to look into machine learning and how to get the next suitable time for a lamp to be turned on.

I just started tonight with creating a REST-API that listens to PUT-requests from my Homey.
The API will gather data for a couple of days which will later on be collected and put together to be used in an prediction engine.
When data is received in the API, it will save the data in a database (ElasticSearch).
The data posted to the API will only occur when a device is manually controlled, like a switch being turned on or off or a dimmer changes it's value by human hand.
The data for each post will contain values like the id of the device, a timestamp and the current value.

My initial goal is that i want to be able to send a date and a time (the next day) and receive a true/false value or a score value (0-100) that indicates if the lamp should be turned on.

If I succeed, the next step will be to have the result posted from the prediction engine to my API so I can send a command to Homey.
Side note: Hopefully the times will be correct this time or my wife is going to sign divorce papers while our son is screaming due to a bulb in his room shooting out raw white light in the middle of the night.

Later on, i will introduce more and more variables so that the prediction will take the following into consideration:
Which household member(s) are currently at home?
Is the tv on or off?
Did the motion sensor detect motion before the lamp in the kitchen was turned on?
Why was it not ok to turn on the lights this time (when a lamp being turned off immediately after it was turned on by a prediction)?
Do we have guests visiting?

Since I am a Microsoft fan boy I'm going for the Machine Learning in Azure.
Sadly I don't know much about Machine Learning and predictions so if there is anyone that have any suggestions or ideas, feel free to give me a lecture in do's and don'ts.

// Mikael

Comments

  • Going to keep my eye on this topic!

    Awesome idea, just like how i imagine home-automation to be. Its cool to switch lights by voice when some friends are over, but getting something like this to work is awesome :smile:

    You know there is a web-api beta to control homey?
  • Awesome Idea, going to bookmark this one:)
  • This is Home Automation 2.0. I bookmarked this post. 
    My wife is thinking the same thing. :-)

    It might be an idea to link outside resources, like is the rain against the window waking up your sun (Wunderground API) or does the bus drives past your house. 

    For now the lights that turn on unexpectedly is caused by bugs in my flows. :-)
Sign In or Register to comment.