ESP8266 gateway with VeraPlus
OK, pardon my ignorance. I have read a bunch of the threads on the ESP8266 used with a sonoff, but I am still slightly confused. My confusion comes on the Vera side of this. So if I use the gateway code on the sonoff, how is the Vera able to see and control the device? In my setup, I just have a serial nRF24L01 gateway connected to the Vera. Does the Vera use it's internal wifi to talk to the devices? Can someone outline a simple relay command from the Vera controller to the sonoff and how it communicates to the sonoff node? If I wanted to do node to node control from an nRF24 node to an ESP node, how would I bridge the gap?
@dbemowsk I have not used any sonoff devices but the ESP8266 in any case would need to be added to Vera as another Gateway so that you have 2 Gateways in Vera like this:
This means that you then have also 2 separate MySensors networks but the ESP8266 would have no transport layer (NRF24L01+ or RFM69 or something else).
The sonoff local features needs to be added to the Gateway code as local sensors and actuators.
Since this setup forms 2 separate networks there is no way to send any control commands directly from the nRF24 node to an ESP node. You need to handle this part in Vera.
I have not looked in to the sonoff device but if it was possible to add a nRF24 to it then you could actually create additional nodes to this network which could then control the ESP local sensors/actuator also. It would be much easier to make some logic in Vera to forward some commands though.
@korttoma Thanks for the reply. My question then is, if I have multiple sonoffs/ESP8266 devices, do I need to present each as it's own gateway?
I currently have one of these wifi outlets that I bought from walmart.
These too run from an ESP8266 chip. I hacked this one with ESP Easy firmware from letscontrolit.com and I installed the HTTP Switch plugin on the Vera.
I had to do some tweaking to the lua file for the plugin to get it to work. but I can turn a light on and off.
My main reason for this post was to see if I would gain anything in switching it to a MySensors node instead since I have a number of other MySensors devices. If I have to create scenes or someother lua code on the Vera side to get the nodes to talk to each other, I may just stick with the ESP Easy firmware.
@dbemowsk yes each ESP is presented as another Gateway in Vera if you use the ESP Gateway sketch (currently this is the only MySensors implementation available). I say stick with the ESP Easy firmware since you gain nothing by using the MySensors ESP gateway implementation.
Unless you can come up with something better
@korttoma In that case, I agree. Base on what you are saying I think I would be better off with the ESP Easy firmware all around because if I am correct, Vera would show 2 objects for every ESP. Both the gateway device and the sensor device. With the ESP Easy I would just create another HTTP Switch. I wouldn't have to deal with the extra gateway object fort each one.
I truly appreciate your feedback.
@dbemowsk you would actually get 3 objects per ESP using the MySensors implementation.
Gateway, Node 0 and Switch.
@korttoma Ahhhh, yes, I forgot the node object. That solidifies my decision even more. I just have a few more tweaks to figure out with the HTTP Switch code to make it a bit more flexible with ESP Easy. The biggest being how to define a variable for setting the GPIO pin under the advanced section of the device, and then figuring out how to access that variable in the lua code. Right now I have GPIO 15 hard coded in the lua file (L_HttpSwitch1.lua) as the pin to control the relay. The problem in that is that when I get the sonoffs, if they use a different GPIO pin to control the relays than the devices that I bought at walmart, that might be a problem. I just need to learn more about coding an app for Vera.
@dbemowsk Can you share your L_HttpSwitch1.lua please.