I’m planning to use my bluz to replace the light switches and control the smart bulbs I already have. It works via IFTTT with the particle channel, but there is a 5+ sec delay, so I’m looking for a better solution. Ideally I’d like to talk to a local nodejs server, but have no idea how to get my gateway to request a local url or something along those lines. Any ideas welcome!
I am not sure why the delay would be so long that seems very excessive.
Have you looked at this project from the community: https://www.hackster.io/nick-stanley/bluetooth-light-switch-75861c
That uses IFTTT and it is very responsive. I have also tried using IFTTT and Alexa and found it to be very quick at calling a function on bluz.
It is possible to swap everything to use a local cloud, or you may want to use something like local communication instead of going through the particle cloud. However, my thought would be to figure out why IFTTT seems to take so long, that shouldn’t be correct.
Frankly I’d like to minimise the route from switch to lamp, and thus would prefer to not have the signal travel half the globe. I believe this should use a local first approach and only add internet as an extension.
But regarding IFTTT, I have the same lag issue with both Hue and Lifx lights. I can see the Particle event show up pretty much instantly in the console, but then there is the long wait outside my control.
How would I go about that local cloud?
There are two ways to do it locally.
The first is probably a bit easier, it involves using local communication from bluz to a gateway. You can see our tutorial on this here: http://docs.bluz.io/tutorials/local_communication/
So what you would do is setup the DK to talk only to the gateway, then you can control the DK through the Photon. The Photon can be used without the cloud, so you could send it commands over some local socket. It would involve you setting up some server to talk to bluz, but that could be pretty simple.
The second involves setting up the local Spark Cloud on a system and sending data through that. You can see details on how to do it here:
Then, you would need to change the keys on bluz to point to your local server, you can see how to do that here: http://docs.bluz.io/tutorials/bootloader/#updating-keys
Finally, you would need to change the IP address in the bluz-gateway library to point to your local server.
How are you planning on controlling the device? Website? Custom app? Another possible option could be an app where you talk to bluz directly, this could let you control it without any gateway but you would need to always be close enough to connect.
Thanks! That local communication solution seems sufficient!
Regarding controlling devices: Both the Hue and Lifx can be controlled on LAN and I already have an RPi running Homebridge to HomeKit enable my older devices. I though I’d either hook into Homebridge or use some other nodejs module to control them locally. In either case I’d essentially be calling a local url, and that should be doable from the gateway, right?
The local communication option pretty much comes with nothing more than socket communication from the gateway. So you would need a server to talk to the gateway, that could pretty much be anything, but you would have to open a UDP/TCP socket on each end and send custom data back and forth. I am not sure if you could somehow have Homebridge send commands over some specific socket, but if they support it then you could do it.
The local Particle Cloud comes with all the benefits of the Particle cloud (REST API, functions, pub/sub, etc.) just running locally. So you would have a more generic interface and could use all the normal Particle commands. If Homebridge can call a REST API for commands, then you could theoretically use this. It is also possible you could run the cloud on the same RPi, but I don’t know if there are any socket conflicts that could cause issues.
Is the ultimate goal to control bluz through HomeKit via iDevices? Or will you control it from some other interface (website, app, etc)?
Essentially I just want to make my own physical switches for controlling smart bulbs instead of buying those Hue switches (or the many other connected switches). Bluz using bluetooth seems like a good match for building a physical flip-switch, as it will sleep most of the time, and only need to send tiny occasional commands, it doesn’t have to maintain a connection, and can be very low power meaning I don’t need to build in a power supply behind the existing wall switch, just rewire.