There are plenty of ways you could make that work! I wanted mine to use a website or use voice control, but you could definitely find some way to get a button to trigger IFTTT. I suspect that most buttons that support Alexa would be good candidates, or you could find a way to do it directly through the Pi. Congrats on your build, and I encourage you to push yourself to build your own vision!
By default it's designed to toggle. To pass a specific state, you'll need to chain the query parameters. That looks likehttp://ipaddressgoeshere/API/switches/sw1?password=yourpasswordhere&state=on
That's a deeper issue than I can fix just by visualizing it. Shoot me a direct message, and I could probably take a look at a zipped version of your app or if you've forked the starter repo
Sorry for the delayed response. You need to define the port in the .env file. Add a new line that looks like:PORT=3000to the .env file and try running it again.
The .env file isn't tracked in Git in order to let you keep other people from seeing your configuration details. You'll need to add a file yourself and name it .env using the filesystem, running 'touch .env' in your terminal, or some other method. Hope this helps!
The power strip repo is a bit more complicated, and it's built specifically for my use case, and as an example, but not really to be generalizable. That said, I should have added the build command to package.json. It's just webpack, but if you pull down my latest from master and run "npm run build" in the terminal, it will generate a bundle.js for you.
The solution that NielsK8 posted a little while ago using Dataplicity's wormhole feature ought to work for your use case. I've also experimented with using a tailable MongoDb instance that allows me to detect when a change to the data store occurs, so that I can have my server listen to an external data source when changing state.
My second response wasn't as snappy, it seems. You can use port 8080, but your router will need to be configured to pass traffic on port 8080 to port 8080 on your device. The pattern would be http://ipaddressgoeshere:8080/API/switches/sw1?password=yourpasswordhere
I'm glad you were able to use this guide as a starting point for your own project! Your workaround with Dataplicity will probably help out a bunch of people who don't have port-forwarding control over the router that the server will be running on. Thanks for contributing!
The way I've written it, the string would be switches/sw1?command=on&password=yourpasswordhereSorry for the late response
Sorry for the delayed response. It sounds like you've gotten all of the software working correctly, but that the hardware isn't working. Does the light turn on when you execute the python script directly from command line on the raspberry pi?
If you are getting the "listening on port 8000" message, it means that you are already running my sample Node+Express server locally! All you need now is to hook up a method to make POST requests. I recommend using Postman, which you can read about and download from here: https://www.getpostman.com/docs/postman/sending_api_requests/requests. Once you point that at the same address you used in your browser and make a POST request (the browser URL is making a GET request), you should see the switch toggling.
That's probably because you haven't configured your router to pass http requests to your IP address on to the raspberry pi. I recommend using port 80 with sudo privileges when you're ready to interface with it. You'll need to look up a guide for the type of router you own for this part.You definitely should also remove your IP address from your comment.
That will be an easy fix. The raspberry pi doesn't have a copy of the saveState.json file, because I disabled git tracking for it. It gets annoying when normal app functioning creates changes to the app. In retrospect, I should have used a default state to start the app, but it's easy enough to copy the file over.Copy the text from your computer's saveState. Run `touch saveState.json` in the root directory of your raspberry pi app and paste the contents in. That should do it for you!
Ah, that's because Google Assistant will be the trigger. The Maker web request is the IFTTT action.
It is trying to read your password and port from a hidden .env file that you will need to create. Run `touch .env` in the root of the project. In that file, you'll need a port and password with syntax like this: PORT=80PASSWORD=password_hereI didn't want to share my info up on GitHub, and I figured you wouldn't either!
So, the problem there is that you are making a GET request to the API, which is telling you the state of the sample switch. You'll need to make a POST request to the server in order to affect the state. A great tool for this is https://www.getpostman.com/.
It sounds like Apache is hijacking port 80. You'll need to disable the Apache server with something like 'sudo service stop Apache' and then you'll be able to to run the Node.js server with 'sudo node app.js'.Also, if you haven't yet, make sure to run 'npm install' in the console so that the package manager can pull in the additional resources that I aren't part of the bundle. You'll need those before Node will be able to execute my starter code. Let me know if that helps!
I've just released a starter application that requires you to use a password query string in the URL. It's not the most secure method, but it should keep your friends from messing with you.https://github.com/krpeacock/google_home_starter
I've just set up a starter application for you to use. Let me know if you have any issues setting it up! https://github.com/krpeacock/google_home_starter
I'm going to build the new project over the weekend. I'll reply here with it once it's ready, and I'll update the Instructable to point to it. Also, for my benefit, do you think you'll need more details on the electronics portion, or are you mainly concerned about the Node.js environment?
Great! I'll let you know when I've got something for you to use.
This is an intermediary step. Since you have the ability to edit the body of the post request on IFTTT, you can readily attach some private key or JWT to your request. Hopefully, I'll get that next step running as part of my starter code, and then I'll share my authentication solution with everyone!As for a local solution, you can check out this https://timleland.com/wireless-power-outlets/ implementation. There is a project that imitates a Phillips Hue Bridge, which can be accessed on local wifi. Unfortunately, those protocols limit you to On/Off and "dimming" features.My approach has the benefit of being accessible through browser, phone widgets, and voice control, as long as you set up those features. Since the server's API can handle whatever requests you can dream up, it ...
This is an intermediary step. Since you have the ability to edit the body of the post request on IFTTT, you can readily attach some private key or JWT to your request. Hopefully, I'll get that next step running as part of my starter code, and then I'll share my authentication solution with everyone!As for a local solution, you can check out this https://timleland.com/wireless-power-outlets/ implementation. There is a project that imitates a Phillips Hue Bridge, which can be accessed on local wifi. Unfortunately, those protocols limit you to On/Off and "dimming" features.My approach has the benefit of being accessible through browser, phone widgets, and voice control, as long as you set up those features. Since the server's API can handle whatever requests you can dream up, it leaves room for scheduling events, affecting multiple devices, and so on.
Thanks! I use the strip at my nightstand along with a couple Phillips Hue bulbs around the apartment for the full "smart home" experience
Google Home + Raspberry Pi ...View Instructable »