I decided I'd try and set up my ESP32 to control light strips using my amazon Alexa since I'm wasn't using it. I have managed to get it to turn them on and off. This wasn't too hard since there is many tutorials.
I then wanted to expand to be able to really control them. For instance "Alexa, set the red channel to 125" or "Alexa, what is the value of the red channel?" kind of thing. But I can't for the life of me find any tutorials out there that have done this. It seems that's everyone uses 'fauxmo' and I assume that fauxmo doesn't have support for this. Although it seems to return an integer between 0 and 255 it can only be 0 or 255. It doesn't seem like it can be anything in-between. Asking Alexa to set a specific value will make her say: "That value is out of range for device ".
Can anyone help me out with this or is it not possible?
It's really versatile and you can create virtual devices that are discoverable by Alexa. For example, create a virtual dimmer light named George. After discovery, you can tell Alexa to turn George on, off or set to x%. The node returns the numeric value from the device. (Again, on=255, off=0).
Unfortunately, Alexa's vocabulary of understanding is quite limited, so you can't say "turn George on, magenta" because Alexa has no clue what "magenta" means. You can send hue values your RGB strip to set colors, then you can use the percent brightness as a scaled hue (hue is a number from 0-360, but alexa returns a brightness from 0 to 255). The map() command should fix this.
Ok it seems a bit more complicated than I first thought. Where do you have your node-red running? Do you need an extra server to run it on like the RPI or can you run it on the ESP32 as well?
Forget Fauxmo- you don't want Alexa to discover the ESP. The virtual device in the Alexa Home Skill Bridge on Node-Red is what Alexa discovers.
I haven't used Fauxmo for a couple of years, so "everyone" is not using Fauxmo. I prefer Tasmota for my generic devices- mostly lights on or off.
You do use Node-Red, don't you?
Using MQTT, node-Red and the Alexa Home Skill Bridge, I can do pretty much anything I want using Alexa, realizing the limitations of the Alexa universe.
In your example, I would code the ESP to get MQTT messages from Node-Red. You could set up virtual devices in the Alexa home bridge like "red channel", "blue channel" and "green channel" with each being a dimmer light. Then you can say "Alexa set red channel to 50%". The ESP would deal with the return data from Alexa.
DreamingInsanity:
Ok it seems a bit more complicated than I first thought. Where do you have your node-red running? Do you need an extra server to run it on like the RPI or can you run it on the ESP32 as well?
I started with a Raspberry Pi3 that runs Node Red and the Mosquitto Broker. In my IOT universe at home (65 devices), the Pi is the most stable.
I recently moved Node Red duties to an Intel NUC i3 computer running Ubuntu, but you can easily use the Raspberry Pi for your Node Red. Many others do. I am the outlier using the NUC for my Node-Red.
My Mosquitto Broker is still on the Pi only because I have too many devices hard-coded with the IP address of the Pi. (Someday I will fix that by either changing the static IP on the NUC to match the IP of the Raspberry Pi., then pull the plug on the Pi.
I would suggest you look at this library. It simulates the Philips Hue skill so AFAIK you can issue the same colour commands as you can for the Hue bulbs. No need of a server somewhere running node-red though I also use the Alexa home skill bridge mentioned above to monitor environment sensors though the home and control IR devices (Satellite, TV etc).
Riva:
I would suggest you look at this library. It simulates the Philips Hue skill so AFAIK you can issue the same colour commands as you can for the Hue bulbs. No need of a server somewhere running node-red though I also use the Alexa home skill bridge mentioned above to monitor environment sensors though the home and control IR devices (Satellite, TV etc).
Thanks for the replies so far!
And thanks for the library recommendation - I'll see if I can get this to work.
I think Node-red looks great but it's a bit complicated for what I intended. I'm in the process of making an app for my light strips but I thought I'd try and get them set up with my Alexa just so I can use them but if it involves RPI's and webservers I will probably just scrap the idea although I won't forget about node-red because I can see that coming in handy in the future.
Riva:
I would suggest you look at this library. It simulates the Philips Hue skill so AFAIK you can issue the same colour commands as you can for the Hue bulbs. No need of a server somewhere running node-red though I also use the Alexa home skill bridge mentioned above to monitor environment sensors though the home and control IR devices (Satellite, TV etc).
Sorry to bother you again. I thought I had them working but they seem to be playing up. I don't think its the actual light strips since R, G and B all work separately.
Other than that it's literally all the same.
The light strips are running at 23V, the ESP is connected to 5V at 2.4A. There is a common ground between the power supply and ESP and the output pin of the ESP is pin 13.
Do you happen to know what could be going on?
EDIT: I think I should also say that theres 720 LEDs (technically there's 120 since it's 1 chip per 6 LEDS, so 120/720 LEDs)
.show should be the last command- it sends everything you set up, color, brightness, etc, to the LEDs.
After you use it for a while, you will find Node-red incredibly easy to use and really versatile.
Just this morning, I wanted to create a log file to record error conditions in a program I have running on a Wemos D1 Mini that is not easily accessible. (I have ArduinoOTA on this Wemos). It took me less than a half hour to create the log file using Node red. If I tried to do it all in the Wemos (writing a file on the PC), I would likely still be debugging it.
SteveMann:
You have these two statements backwards:
FastLED.show();
FastLED.setBrightness(brightness);
.show should be the last command- it sends everything you set up, color, brightness, etc, to the LEDs.
That has fixed the issue with brightness, and possibly the issue with different sections being different colours but unfortunately it is still paying up. Many of the possible colours are showing up the same, and one section of the strips sometimes doesn't light up even though all the LEDs are working. I'm going to check the RGB values being sent and also try and test out different pins to see if that makes a difference.