I am having trouble with my led strip lights. So I have two led strip lights that are each being controlled by a separate NodeMCU due to them being on separate cabinets. I am trying to control both led’s by only using one light setting. So for example if I turn the power on both light strips come on or if I change the color both strips change to the same color. The problem I am having is that if they are both on only one will switch with the commands I send. If I power one off then it seems to work perfectly for the one that is on and visa versa. Is there a way to control both with the same commands? Basically I have the same code running on both NodeMCUs where the only difference is the number of LED’s.
If you unplug the working one, does the second led strip work?
Did you use 2 different client ID in your NodeMCU?
Because they must be unique! So if you carefully uploaded the exact same code, it cannot work ^^ (you need to change the clientID on one of the two)
Actually, if you define the client id in terms of the chip id, which is unique per 8266, then you can upload the same code. But it is definitely something worth checking.
That’s true, but most of the code laying around online use a fixed ID, and I guess it’s not different in grangemd code
Some also use the mac address, since it’s supposed to be unique.
Thanks for the help. That fixed it. I missed that when I uploaded it to the 2nd NodeMCU. I was using someone else’s code as I usually use the chip id to name my client id and didn’t realize they didn’t do this.
Just following this as I want to simultaneously control multiple rgb lights (8266 controllers) and operate them (on/off colour and brightness) as though they were just one light.
In the 8266 sketch is this the client ID you are referring to? (I’m borrowing code)
// MQTT
const char* MQTT_CLIENT_ID = “arilux”;
If I follow this thread, for each of my 6 lights I need to have a unique value instead of arilux?
I’m new to this, so forgive me if I’m missing something basic!
My understanding is that each of the 6 8266-based controllers will have their own connection to the broker (RPi Mosquitto), each with identical State and Command topics? Is that the correct understanding of the terminology?
I misunderstood your situation, I thought all your lights were controlled from one 8266.
@touliloup is correct, you need the client id to be unique for each 8266. As I said before, the best way to do this is to use the chip id as this is intended to be unique.
Set up 9 lights, with just one identical topic each is subscribing to. One, just one, entry to HAss, which means that I do not need to control each light independently. They all work in unison, perfectly!