Room Automation with WeMo and IFTTT

Hi Particle Community,

So recently I decided to set out to make my basement more “smart” and make it easier for me. I usually go down to the basement to work after school. I wanted to automate the room so it is much easier to come downstairs as I am usually carrying a heaving backpack and textbooks. I also am challenging my self to do all of these tasks with one Particle Core, hence the title. I would like some thoughts and comments on whether these ideas may be possible with one Core and how I would go upon doing this, as the saying goes “Nothing is impossible”( Okay, maybe not).

This is the ideas I have so far:

  • Firstly, the lights turn on. I have a tube light in my basement and I have a reading lamp on my table. I was thinking that I use a motion sensor to turn on the light, but I am unsure whether a motion sensor 's code can possibly also connect to a tube light.

  • Secondly, I was thinking IF it was possible(hint: IF(IFTTT)) to turn on my laptop( Lenovo U310, if that helps) and for it to bring up my Sunrise Calendar App and or Todoist ( Apps from the iOS App Store) with the updated calendar. When I am in school, between classes, I can quickly update my homework to the Todoist app and my schedule to the Calendar, and when I am coming into the basement, the laptop brings up the websites.

-Also, when I am leaving upstairs, it would be nice if the lights turn off, so I think like if I pass the motion sensor, then it would turn off the lights, Also this should be somehow unique to me, because it would be weird if that happened if it was not me, wasting the battery life. So the computer should only turn on if it was me. My idea was if my iPhone or backpack or something that belongs to me comes to a certain range to the motion sensor or the Core, then this would happen.

  • Lastly, this is an not as important, but it would be nice if my Spotify playlist starts playing.

Also, um…well… this is kind of weird…but…um…well… I don’t know how to code…because my high school does not offer AP Computer Science until 10th and I am beginning 9th this fall…so sorry… :cry: :disappointed_relieved: . It would be helpful if the community can help me, it would mean a lot.

I did a lot of research in this but If i put all that down now, it would take me forever to post this topic, but I am open to all comments, questions, concerns, lectures, disappointment, lost of faith in humanity, comments posted. I am terribly sorry that I don’t know how to code… :cry: :cry: :cry:

So I challenge the Particle Community to expand the power of the Particle Core! :smile:

1 Like

@benclough,
Great that you are starting this adventure so young. As you may guess, I am not nearly so young now.

For the entry and exit, you may consider two light sensors, that by which one triggers first can tell if you are entering, or leaving.

Sorry, but I/we can’t write your code for you, but if you come up with some code, we will try to help you improve it.

Don’t hesitate to ask anything here.

Good luck.

1 Like

Hmm, interesting, Well I am not too worried about the coding as I could do some learning and figure out my way, But I am confused on what your saying Mr.Pierce, would the....

be the motion sensors? If so, is it possible to do this with just one, because I am trying to limit this project to the least, and make it very very simple?

How would it be possible to hook motion sensors to the Core? If possible, can you guide me to some articles, forums, about my light automations?

Also, my biggest worry is connecting the flourescent tubes to the motion sensors and Spark?

Thank you.
@Jack

I and others on this forum are glad to help.

There are many motion sensor devices available, ultrasonic, light beams, switch on the door, pressure sensors in the carpet, etc.

If you want to determine if someone is entering, or exiting, then you probably need to watch two sensors to tell the direction.

As far as connecting the core to control the lights, That can be dangerous, if the circuit is 120 volts or 220 volts. So I recommend adult/professional supervision in that area. In general theory you could use a electronic relay, 3 volts to control it, and 120 + volts output.

@Jack

Which type of sensors do you suggest?

Is there an easier way to control the lights with the motion sensor? Do you recommend anyway by how I could do this? I have the light plugged into an electrical outlet, with 4 outlets on the railing of the stairway, so I could turn the lights on as I am going down. My plan is now to have something turn the switch on triggered by the light switch, any ideas of what this could be?

I will make a drawing of what I am talking about and post it,

I would just like a small idea of what I'm going to do so I can explain this to my dad's friends( who could help me) :smile:

This is what I mean

@Jack
@peekay123
@Moors7
@harrisonhjones

Hey Ben.

Seems like a cool project. I’ve only had time to quickly read the posts so far so I’m sorry if I missed something already said.

Sounds like a couple of “modules”:

  1. Detect someone coming down the stairs
  2. Detect someone coming up the stairs
  3. Do cool things with the lights
  4. Do cool things with other services

Let’s address 1 and 2 first. Both completely do-able and really the only ones that need the Spark Core / Photon. The other two can be accomplished with Webhooks.

So, you need to detect people on your stairs. In industry we’d use a Photoeye but those things are expensive and industrial. I would suggest you use two range finders or motion sensors. One at the top of the stairs and the other at the bottom. Settings the top one off would “lock out” the bottom one for a few seconds (enough for you to get downstairs) and vice versa. When either was tripped it would send out a publish message which would trigger a webhook and that could turn on and off your lights!

As for actually controlling the lights themselves I’d look into Hook or something like WeMo or similar

That’s my general take. I’d be happy to help with code. Let me know if I can be of more help

3 Likes

You could use a photoresistor to detect when the light comes on/off.

Being that this is all occurring in one room (the basement), it may be easy to run wires between the devices, rather than counting on WiFi or cell phone connections.

Hey there,

Sounds like a cool project. I’ve been wanting to do something similar for my bedroom but have, unfortunately, not yet got around to it. I’ll try to answer some points.

Switching on/off lights based on sensory input shouldn’t be hard. As is mentioned, If you’re working with mains power, and haven’t got proper experience, no not attempt to do that yourself. Rather, go with the much safer suggestion @harrisonhjones mentioned. You could use Smart lightbulbs (hue, lifx), remote controlled lights (RGB LEDs (strips) are really fancy!), or some remote controlled mains plugs (think Weemo). All things considered, very do-able.

The whole “turning on my laptop and having it run programs (including, but not limited to, Spotify)” will be very tough. It’s not really what the Core/Photon is designed for. Unless you use some clever software, it will be hard to pull of properly.

Making the whole automation process unique to you could be done with some ID tags. I’d imagine RFID or NFC, depending on the range of either. I’d place a reader at the top of the stairs. When going in, that will ‘check you in’ as it were. If it then gets read again, it will check you out, knowing the the room is left and things can be shut down.

Like mentioned before, depending on your needs and difficulty, we should be able to help you out :smile: Feel free to ask more questions if anything is unclear.

1 Like

@harrisonhjones

THANK YOU VERY MUCH!!!!

I cannot like this is like what I was trying to look for:

Thank you!!!!

Is it possible to do this with IFTTT, I was looking at some "recipes" but, I don't see something that
does a task like mine?

@harrisonhjones
@Jack
@Moors7

Sounds like the idea Ben has come up with “check if the light switch is on or off”, is a KISS option. Simple to check, and works 99% of the time. Where the NFC will be accurate about 80% of the time, since you may or may not use the NFC card.

I am no expert on IFTTT, but I don’t think it can turn your computer on, and send it to a specific web page.

1 Like

No…no.no :kissing:

My motive is to turn on the lights ON and OFF with Siri:

Here’s an example:

So my plan is as I am walking downstairs, I can say this to my phone and the lights will turn on via Weemo

@Jack
@harrisonhjones
@Moors7

1 Like

Can it be done with the Spark Core? I mean it must be possible...

No. Sorry

What if I connect it to an Smartthings or Weemo outlet, how hard will it be from there? Will it be possible to use IFTTT to take care of running programs? So the outlet can turn on the laptop, and I can put a IFTTT recipes like:

IF Outlet turns on laptop then Log In
IF laptop logs in THEN open applications ( like Spotify, Sunrise and so on)

@Moors7
@harrisonhjones
@Jack

Can we do this with the Wemo Insight Switch?:

@Moors7
@harrisonhjones

I salute you, if you just finished the 8th grade, you have learned much beyond your years.

1 Like

For the light I will be using :

It is a plug-in motion sensor. It is less complicated than using Spark.

Also, @Moors7, I was wondering whether if I plug a electrical outlet to this and put my laptop, fan and lights, this would work perfectly, when there’s motion the fan, laptop and the lights turn on, and I could use this. I suggest you do the same :smile:

But I yet have to test this @Moors7

As to the websites opening and running, any ideas? @Moors7 @harrisonhjones @zach

I’m a Mac user so I’m not going to provide great advice on automating your computer, but I think what you’d want to do is run a start-up script that will run a set of commands when the computer starts up; that script would open up your web browser and browse to the website you want to load up.

1 Like

That kind of contradicts with what you've said here:

What do you actually want it to do? Either or both should be possible to do.


Even that will be problematic. Unless your laptop powers up automatically as soon as it gets power, you'll need to figure out a way to boot it. The plug won't help you with that since it only switches power to the laptop/device. Since lights can go on automatically, you could definitely use it for that.

Simply put: no. IFTTT is made to connect web based services. Your laptop isn't one of them. Firstly, when it's off, it doesn't have a network connection, thus no access to the internet. Secondly, when it is on, there's no API to control a computer. You (un)fortunately can't send a "open webbrowser" command over the internet. I think Zach's suggestion is the closest you'll get as far as opening a program at startup goes. That is, if you get it to start up. This isn't really a limitation of Particle, but more of a general computer limitation.


It also has zero flexibility. This is about the dumbest switch you can get. "IF movement THEN powe for X seconds". Meaning that if if doesn't see movement for long enough, it'll switch of electricity. I don't know if you've ever been in a bathroom with one of these motion detector, but I've found that they'll always switch of at the most inconvenient times. Being as lazy as I am, I tend to lay on my bed with my laptop. When doing so, I don't move very much. If I'm not in the vicinity of the motion detector, and make movements big enough, it'll repeatedly switch of my power, which would eventually drive me crazy.


Off-topic: you don't have to tag each and everyone one of us repeatedly. Rest assured that those interested will see your topic, and will contribute if they feel they've got something meaningful to add.

2 Likes