I am a NOOB and hope someone can help me. I am trying to figure out the actual serial command to turn a switchmote on/off. I have everything setup, but can not figure out how to do this remotely. I read the switchmote sketch, but its more than I can read. Sorry for the NOOB questions.
At the moment of writing it is setup to listen for SSR:1/0 or BTNX:0/1 commands.
SSR:1 turns the relay on (and middle button status GREEN).
SSR:0 does the reverse and RED.
BTN0:1 turns the top button status ON (no relay but would notify SYNCed switchmotes)
BTN1:1 or 0 is the middle button/relay
BTN2:1 or 0 is bottom button.
So just send it the bold commands.
Hope this helps.
That's just what I was looking for. I will have to test when I get home. Is there a format to send to a node?
Format?
Not really, except you have to give it what it expects, something valid like SSR:1 or BTN1:1, these both do the same thing.
To see an example of how to send check this example: https://github.com/LowPowerLab/RFM69/blob/master/Examples/Node/Node.ino
You can just call this to send a packet, after radio is properly initialized in your sketch:
radio.sendWithRetry(SwitchMoteID, "SSR:1", 5) //5== length of message in # of bytes
This would turn on the relay.
Has anyone created a nice web interface for controlling the switchmote?
Well I did but I would not call it uber nice. I am trying to find time to build something better. What I have publishes right now can be seen in the video I posted for HAD Prize. I did not publish the code for that but it's quite easy to add it to the sample gateway I shared here (http://lowpowerlab.com/blog/2013/10/11/raspberrypi-home-automation-gateway-hardware-and-demo/).
Hi Felix
I'm already using your garagemote web code and it's working quite well. I've started looking at how you've done it in both the index.php and in the garagemote_base sketch but I'm a total programming noob so it's all trial and error for me.
Are you willing to share the switchmote web code you've done?
Thanks
Ok ... really sorry ... this took me a while. But I managed to add some sample code. This is actual working code demoed in this video:
https://www.youtube.com/watch?v=I9MNZQgqKHA&list=UUqOeqH8YqacRSXQmaFrIt1A
The code is now shared in Github:
https://github.com/LowPowerLab/RaspberryPi-Gateway/blob/master/gateway.js
https://github.com/LowPowerLab/RaspberryPi-Gateway/blob/master/index.php
https://github.com/LowPowerLab/RFM69/tree/master/Examples/PiGateway
Maybe it's just me, but I don't see any difference in the code on github.
My bad, I submitted the change but forgot to sync... one click can make a difference. Please take a new look now.
I currently have a gateway moteino setup for motion motes. With upgrading the gateway to this INO, will I still be able to monitor my motion motes and have my python scripts text me? Or should I have two gateways? I am thinking only one program can monitor that serial/USB port at any one time.
Further info:
I do not have a garage mote. I am looking to only control my switchmotes with this setup and text me when I have motion on my motion sensors. I do however plan to do water usage as well as fire alarm triggers so I will always be notified when away. I would like only one gateway moteino, but not sure this can occur. If it can, I guess I need to get more experience in coding.
You can adapt the code in python to do the same thing in nodejs... the scripts are only provided as samples. You are encouraged to change them and adapt however fits your needs. When I have a new version that is more interactive/dynamic I will publish it, it's something on my list but for now what I published is all there is, but look at it as an opportunity to learn and explore.
I agree, its great practice to learn more of coding. I got my system up and running and was able to turn on the switch mote on and off through the web interface. The only hiccup I see I want to iron out is for when you first load the page to request status of the current position of the switch mote. It defaults to off and after two clicks it gets in sync, not a huge deal, just my personal agenda. Other than that, thanks for all the help and great stuff here. I love messing with this.
I will make this much nicer, the downside is you have to wait :)
Still this is quite nice to be able to do with stuff you can buy online and without any service agreements and monthly service fees to some big corporate, not to mention software and personal data kept in their cloud. Complete control :D
I agree Felix, I am in your debt for all you have provided us. Your attention to detail and willingness to share is priceless. You have done so much for all of us. I just dropped more money on your items, all because I firmly believe what you just said.
Thanks for the compliments, I plan to continue this adventure. Time is the limiting factor unfortunately.