SamZorSec / Open-Home-Automation

Open Home Automation with Home Assistant, ESP8266/ESP32 and MQTT
MIT License
957 stars 196 forks source link

Controlling 4 lights #27

Closed PavanSN closed 6 years ago

PavanSN commented 6 years ago

how can i control many lights using mqtt light.ino file, ive tried many ways of modifying the code but it didnt work... please help me to fix..

gabrielcsilva commented 6 years ago

I have reached a functional code that could control as many lamps as the esp can hold (theoretically). I had to change mostly the functions to receive a position counter of an array of lamps.

The code still have some points that need improvement, like in the lines 38 and 39 with an automatic generation of the topics according to the number of lamps; and the line 45, because the code doesn't work with an array of lamps using PROGMEM for a reason that I can't tell.

If there's something wrong about what I did, i apologize @mertenats

Test-_4_lamps_MQTT.zip

SamZorSec commented 6 years ago

Hi @PavanSN, Someone asked me the same question a few months ago. Just look at this issue, a example is provided.

Sam