I'm using ESP8266 to mange sensors and light in my new house under remodeling. All the lighting and sensors are managed directly by batteries powered by Solar. So the 220v is now only in the power plugs. Everything else is DC low voltage.
I thought the manage of lights on-off was very trivial and I didn't spend much time during all the testing I did in the past months .... but it is not really true.
So my configuration at this moment is to have few central controllers (with one MCP23017) that is managing the relays and the majority of the switches. 8 PINs of the MCP manage a 8 port relays board, the remaining 8 on the MCP plus the remaining on the controller do 10 max switches. The remaining 2 position in the Tasks ( 12 positions is really too few ....) is for 2 dummy devices (see below)
Each relay has a position in dummy device so I can then switch them on and off based on the dummy value ..
Code: Select all
on sw13#1 do event,switchgo1 endon on sw14#1 do event,switch-go2 endon // more for all the switches calling the right relay on switch-go1 do if [dummy#d1]=0 MCPGPIO,2,1 TaskValueSet,12,1,1 publish /L1,1 else MCPGPIO,2,0 TaskValueSet,12,1,0 publish /L1,0 endif endon on switch-go2 do if [dummy#d2]=0 MCPGPIO,3,1 TaskValueSet,12,2,1 publish /L2,1 else MCPGPIO,3,0 TaskValueSet,12,2,0 publish /L2,0 endif endon // more for all the relays
THE ISSUE COMES WHEN YOU HAVE SWITCHES ON OTHER CONTROLLERS
if I have a switch on a different controller I have to remotely call the function switch-goX on the master controller.
My first try was to by Node-red and do an http call like http://192.168.1.185/control?cmd=event,switch-go1. The reaction was slow and very variable. In some case it could take 10seconds ... Not accettable
I tryed the UDP connection like sendTo 31,event,switch-go1 (obviously after enabling the UDP port .... and I figured out this works even without the P2P controller enabled) But I had more or less the same result. Benefits we could do everything without Node-red
And finally I worked on MQTT commnds. If the main node was NODE1 I published to NODE1/cmd the message event,switch-go1
Code: Select all
on sw13#1 do publish NODE1/cmd,event,switchgo1 endon
Any idea on how to solve the issue. There is some trick that I miss ?
Tks for the help,