I am a noob as well…no experience w/node.js and Android. I’m running this on a Raspberry Pi set up via the blood, sweat, and posts of others here. I’d suggest that if you have about $40 to $50 free you could pick up a Raspberry Pi (more likely to be able to use info here to get things set up), or run on a Windows machine if you have one that’s on all the time. No one’s been talking about doing this on an Android device so far.
Hopefully someone w/more experience will help you…I stumbled through my install/setup with tons of “doh!” questions here, and this was on a Pi, so some of the steps were pi-specific AFAIK. Sorry I can’t do more at this point.
Once youve installed node, you will probably need to add node-ssdp (install by typing npm install node-ssdp). After that I changed the port and got stuck myself as I havent had time to debug what is going on. This is the error that is returned by the Post request:
Ok, all working properly now, I just hadnt copied the confirmation code into the SSH window properly as the error messages seemed to stop the pasting of the code correctly.
For anybody else interested in setting this up on a Raspberry Pi, in order to get the script to run automatically when booting, then use the code below as this was the only way I could get it to wait for all dependent scripts/modules/…)
Add the text below to rc.local by running a command like sudo nano /etc/rc.local and the text that should be added is (add it just before the exit 0 line).
FYI: This will delay the start of the script until 60s after rc.local is run, which is about 30s after the Pi has finished booting (and mine is already starting quite a few other processes at boot). You will need to change directories as required.
FYI2: If you want to change the port, then it is indeed possible to change the port number in index.js. Just do a find/replace and you need to change all occurrences of 3000 to your new port (I picked 4000 as there seem to be far fewer programs that use that port). There are three occurrences that need replacing (well two need replacing, but there are three occurrences so best do all of them).
@ghesp Just wanted to say a proper thank you for this! Have had so much fun setting things up with this today!
Node.js was a useful learning on my Raspi, and now every time my OH turns on the sitting room lights I have Google Home make a comment about me being right, makes a nice change! Cant wait for her reaction!
That’s what I call an effective use of technology. You can up the ante further…
I have energy monitoring on my washer/dryer, and use the relay to play funny (to me, anyway!) reminders for my family to get their laundry from the washer to the dryer when the washer finishes, and then out of the dryer when it’s done. We have GHs in the family room and office, so the message gets to us in our two most frequently used rooms, and it actually works so far. Now I rarely run into a washer or dryer full of someone else’s clothes when I go to do my own laundry.
I am having the same issue discovery as someone earlier, the GH announced when the server came online but the SmartApp cannot discover it. It is running on a win10 box with firewall disabled for testing. I am able to sent post commands that work and announce on GH using “curl -X POST http://10.0.0.99:3000/customBroadcast?text=hello+world&user=myname” from my ubuntu server via putty, command also works from the bash shell in Windows after I installed it.
Is there a way to hard code the IP somewhere? Or has anyone else had this discovery issue?
No, it says “Starting Discover” and the little hamster wheel just spins and spins. I changed the IP of the server to a lower IP thinking that the discovery does an IP sweep starting at the beginning of the subnet, have restarted everything
looks like Untangle is screwing me. So either i need to hard code it or I will investigate “WebCore to send a POST request to the IP address of the relay manually” as I have Core running…but no idea where to add this.
So according to Untangle they do not support IGMP. I have a Ubiquiti switch at the core of my network that does support it but changing it made no difference. I dont really understand IGMP but it does not seem like that would be the issue from what I read. Does the app, as part of its discovery just do a ping sweep of the current network looking for IPs the respond and then check for a response on port 3000? Is there not a way to set the IP of my node server in the code itself? Also, I cannot figure out for the life of me how to get webcore to create an item that I can send messages to given that I cant get the device to be discovered. so if anyone who has made WebCore work with the relay service node WTHOUT needing to use the smartapp or device handler on the ST app could pointy me in the right direction I would appreciate it.
I will make a feature request to be able to add the IP manually either in the code or in the ST App GUI. Regardless, this project and the hard work are greatly appreciated!
For anybody wondering, or struggling with the discovery process, you can ignore it if you set up the device correctly in ST. As an outline, the steps to do this are as follows:
Install the device handler by pasting as code into the IDE
Go to the Devices section of the IDE and create a device for Google Home Assistant, following this pattern that I used:
Note that your Device Network ID should be as follows: IP:Port in HEX, hence mine is 192.168.1.2:4000 which translates to C0A80102:0FA0 - you will likely need to change the 0102 section at the end to the correct IP, and you are probably using port 3000 (default) which means then ending should be :0BB8 rather than :0FA0
You can now send a test command through CoRE/WebCore and everything should be working, without needing the discovery SmartApp.