Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request, LED state via json #2303

Closed
MatzeJoerling opened this issue Mar 30, 2018 · 13 comments
Closed

Feature request, LED state via json #2303

MatzeJoerling opened this issue Mar 30, 2018 · 13 comments

Comments

@MatzeJoerling
Copy link

Hi,

wrote some node red stuff that steers my 60 Pixel LED WS2812 Ring with a Power Gauge ( Solar Power vs. used Power is shown). In a bad case i have to send 60 mqtt messages to set all LED to there right color.
It would be nice to send only a json with all information to set led color! I know all LEDs with RGB Information will extend the max mqtt message size, but then i would split the json to 3 or 4 messages, better than 40 or more ...

regards M.

@arendst
Copy link
Owner

arendst commented Mar 31, 2018

How about using the backlog command to set some more leds at once keeping in mind the max number of backlog commands (15) and the payload length (255 characters).

This works:

backlog led1 110000;led2 011000;led3 001100;led4 000110;led5 000011;led6 000110;led7 001100;led8 011000;led9 110000;led10 011000;led11 001100;led12 000110;led13 000011;led14 000110;led15 001100

@arendst
Copy link
Owner

arendst commented Mar 31, 2018

Just changed max number of commands from 15 to 30. The max payload length is only valid for serial and web console but is not a problem for mqtt.

arendst added a commit that referenced this issue Mar 31, 2018
5.12.0i
 * Add multiple color entry support for command Led like Led2
120000.001200.000012 setting led2 as Red, Led3 as Green and Led4 as Blue
(#2303)
@arendst
Copy link
Owner

arendst commented Mar 31, 2018

The latest version now supports multiple colors for subsequent leds separated by a dot.

The command

Led2 110000.001100.000011

Will set led 2 to Red, led3 to Green and led4 to blue.

Led2 16,0,0.0,16,0.0,0,16

Should also work

@MatzeJoerling
Copy link
Author

Nice, will try to implement in nodered!

but you do much stuff with json (timer, ds18x20...), why now this new approach?
javascript object to json and vice versa is easy in nodered (i belive in every other tool too).

anyway, will save me a lot of mqtt messages! tnx.

arendst added a commit that referenced this issue Apr 1, 2018
5.12.0i
 * Add multiple color entry support for command Led like Led2
120000 001200 000012 setting led2 as Red, Led3 as Green and Led4 as Blue
(#2303)
@arendst
Copy link
Owner

arendst commented Apr 1, 2018

Attention: Just change the separator from dot to space to keep in sync with other commands and possible future changes.

I indeed reply with JSON status messages but I find it a lot easier to supply simple commands not using JSON. The advantage is also that the payload string can be used to it's full potential.

@martin072
Copy link

martin072 commented Jul 5, 2018

Just trying it out, and I have some strange behaviour;

have set the Pixels to 3 as I have 3 WS8212 led's on a test-bed, then following happens;
(command's via the console)

Command: Color 12 (all lights to white) works OK
Command: Led1 000000 -> First led now goes to a Cyan color but result says: RESULT = {"Led1":"000000"}
Command led2 000000 -> first led now glows red and led2 dims to white, result says: RESULT = {"Led2":"000000"}
command led3 000000 -> First led now glows red, 2nd led green, 3rd led cyaan, result says: RESULT = {"Led3":"000000"}

Dimmer is at 100 and the command HsBColor returns: {"POWER":"ON","Dimmer":100,"Color":"FFFFFF","HSBColor":"0,0,100","Channel":[100,100,100]}

Any idea what this could be? Am I missing a setting here?

See attached picture for Led1 000000 Led2 000000 Led3 000000

img_8180

PS.

Toggling the power ON/OFF with color 12 gives the same color scheme as in the picture. Led's will not go OFF when you select power OFF

@MatzeJoerling
Copy link
Author

not enough voltage, bad soldering ...
tasmota shows you only the command that was executed, not what really happens :-)

@martin072
Copy link

Can’t be. Its on a 1A external 12v power with only 3 Leds, so that would be max 0.2A ?

@MatzeJoerling
Copy link
Author

you are kidding? 12v for WS2812?
According to the datasheet:
image
http://www.world-semi.com/DownLoadFile/108

sorry, you bricked it ... :-(

@martin072
Copy link

martin072 commented Jul 9, 2018

Ehm @MatzeJoerling , No obviously not.. the Wemos D1 R2 is running from a 12v power supply not the WS2812. Further more If I would command #000000 for the color's they should be 'off' so I can't really understand this is a power issue? As mentioned and seen on the picture, its only a 3 LED test, which cannot consume moren then 0,2 Amps can it?
As for the soldering, 3 wire's and all the LED's do work if I give them a command with 'Color 12' for example. All colours correspond.

@MatzeJoerling
Copy link
Author

bad color with ws2812, in my case, was alwas some issue with voltage. sorry, no idea anymore.
I have some of them and also bunch of ws2812, only got wrong colors when i have to much / less voltage ... btw, how did you attach 2812 to wemos?

@martin072
Copy link

Since there are only 3leds I used the 5v from the wemos board. I will try an external 5v supply. But as mentioned the commands Color 2, Color 5 etc work fine. It is just when I use the option to set individual leds it goes wrong. Also the Toggle off/on give the same color issues where as I boot it up fresh it works fine until I used the individual led commands.

I am not able to work on it this week so will try some more next week.

Thanks.

@martin072
Copy link

Hi MatzeJoerling, small update. Used another power supply, and now it seems to work fine. Thanks again for the help.

curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
5.12.0i
 * Add multiple color entry support for command Led like Led2
120000.001200.000012 setting led2 as Red, Led3 as Green and Led4 as Blue
(arendst#2303)
curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
5.12.0i
 * Add multiple color entry support for command Led like Led2
120000 001200 000012 setting led2 as Red, Led3 as Green and Led4 as Blue
(arendst#2303)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants