arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.17k stars 4.8k forks source link

Sonoff L1 LED Controller #4935

Closed bertvanovermeir closed 5 years ago

bertvanovermeir commented 5 years ago

Hello,

I have succesfully automated most functions in my home using Tasmota and the 4CH PRO R2 Sonoff modules. (Thanks for all the great work programming and documenting Tasmota BTW!) Now, I would like to add a few LED strips.

It might be that I am overlooking but is the Sonoff L1 LED Strip Controller not in the supported devices list? (see: https://www.banggood.com/Sonoff-L1-Smart-2M-5M-SMD5050-RGB-LED-Strip-LightWiFi-ControllerPower-Supply-Work-With-Alexa-DC12V-p-1396771.html?rmmds=search&ID=4775844707&cur_warehouse=CN )

I can see in the supported devices lists, some other LED controllers are supported from other vendors, but, as I found Sonoff to be quite reliable I wanted to stick with their hardware.

thanks!

Jason2866 commented 5 years ago

We dont own this device. It looks like a variant of https://github.com/arendst/Sonoff-Tasmota/wiki/MagicHome-LED-strip-controller If you buy and you are willing and able to open and flash Tasmota if a ESP82xx is in.... You will find our support on Discord Chat. No warranty at all! There is always the chance to end with a paper weight!

ascillato2 commented 5 years ago

Closing this issue as it has been answered.

Support Information

See Wiki for more information. See Chat for more user experience.

davidelang commented 5 years ago

I just got two of them, they are 8285 based, so I can afford to fry one :-)

http://lang.hm/sonoff/sonoff-l1-bottom.jpg http://lang.hm/sonoff/sonoff-l1-top.jpg

I'm also happy to pay for one to be shipped directly to someone willing to tackle this.

arendst commented 5 years ago

Looks like a Nuvotron clone meaning the ESP8285 is using serial to communicate with the Nuvotron controller which in turn controls the PWM channels.

So to get it working one needs to monitor the serial communication between the ESP8285 and Nuvotron.

ZericE commented 5 years ago

There is thread discussing this device (or a close variant) on the home assistant forum Link. "reef-actor" and I independently examined the protocol between the esp8266 and the Nuvotron (8051). The protocol is simple and reef-actor documented much of it. The board uses the primary esp8285 UART at 19200/8N1. Here are a couple sample message sequences I decoded:

command from esp to turn on AT+UPDATE="sequence":"1554682393798","switch":"on"[1B] acknowledge from 8051 AT+RESULT="sequence":"1554682393798"[1B] response from esp AT+SEND=ok[1B] later a confirmation from 8051 AT+UPDATE="switch":"on","light_type":1,"colorR":255,"colorG":0,"colorB":0,"bright":100,"mode":3,"speed":50[1B] response from esp AT+SEND=ok[1B]

command from esp to change color to purple(ish) AT+UPDATE="sequence":"1554682835320","mode":1,"colorR":255,"colorB":101,"colorG":46,"light_types":1[1B] acknowledge from 8051 AT+RESULT="sequence":"1554682835320"[1B] response from esp AT+SEND=ok[1B] later a confirmation from 8051 AT+UPDATE="switch":"on","light_type":1,"colorR":255,"colorG":46,"colorB":101,"bright":100,"mode":1,"speed":50[1B] response from esp AT+SEND=ok[1B]

command from esp to change brightness level to 36 (100 is max): AT+UPDATE="sequence":"1554693282072","mode":1,"bright":36[1B] acknowledge from 8051 AT+RESULT="sequence":"1554693282072"[1B] response from esp AT+SEND=ok[1B] later a confirmation from 8051 AT+UPDATE="switch":"on","light_type":1,"colorR":255,"colorG":46,"colorB":101,"bright":36,"mode":1,"speed":50[1B] response from esp AT+SEND=ok[1B]

The sequence number is unimportant for tasmota purposes and can be the same every time. The first exchange (esp UPDATE/8051 RESULT) is the actual command/acknowledge. The next message, SEND from the esp, confirms the cloud was informed. Then the UPDATE message comes slightly later from the 8051 telling the esp the new state is in effect. It's followed by another "AT+SEND=OK" confirmation from the esp that the information was sent to the cloud. The "AT+SEND=OK" messages do not appear to be needed by the Nuvotron 8051 and can be omitted based on reef-actor's testing. All messages end in 0x1B or ESC, not CR or LF.

When a key is pressed on the IR remote, the 8051 sends an UPDATE message to the esp like: AT+UPDATE="switch":"on","light_type":1,"colorR":0,"colorG":255,"colorB":0,"bright":100,"mode":1,"speed":100[1B] the esp responds to confirm it was sent to the cloud (AT+SEND=OK) or it failed (AT+SEND=fail), but there is no obvious reaction either way by the 8051.

When the IR remote power button is held for 5s, the 8051 sends "AT+SETTING=enterESPTOUCH" to tell the esp to load factory defaults and put it in pairing mode. In this case the esp echos back the exact string it was sent by the 8051 and does not attempt to send to the cloud.

reef-actor commented 5 years ago

This seems to be an expansion of the PS-16-DZ-Dimmer control scheme (which only supports on/off and brightness).

Jason2866 commented 5 years ago

So enhancement of xdrv_18_armtronix_dimmers.ino should be possible?

reef-actor commented 5 years ago

xdrv_19_ps16dz_dimmer.ino is the one I think?

davidelang commented 5 years ago

here is a better image of the top that lets you see the other chip markings http://lang.hm/sonoff/sonoff-l1-top2.jpg

So if the 8051 is connected to the serial port of the ESP chip, is it still possible to flash it? or do we need to hack stock firmware's update process to get a new image onto it?

reef-actor commented 5 years ago

I was able to flash it without issue by connecting to rx,tx & gnd pads on rear and shorting GPIO0 to gnd. I guess the 8051 stays quiet.

davidelang commented 5 years ago

that's great to hear. Is there something you need me to do to help? or should I just wait for a modified image to try?

ZericE commented 5 years ago

Interestingly, my version of the board is doesn't have the mic, not that we would likely use it with tasmota anyway. @davidelang have you tried with the PZ 16 dimmer module type and see if it works (other than being able to change colors)? I haven't looked at the code that dimmer yet, but I expect it would be a great starting point fo add support for the sonoff L1. I still have the stock firmware on mine and setup on the logic analyzer in case there is anything else in the protocol that needs to be examined. It's pretty simple and I think @reef-actor did a good job of documenting it.

reef-actor commented 5 years ago

In issue #5370 there is a comment that on/off and dimming are working with the PZ. I think the mic is interfaced to the 8051 so should be no problem

davidelang commented 5 years ago

I still have the stock image on mine. It's been a while since I've compiled an image, but if you either provide me an image or tell me to compile and test a specific git commit, I'll flash it and try it.

I'll also buy you a second one if you want to keep one stock and experiment with a second one.

Jason2866 commented 5 years ago

@ZericE You could backup with esptool the orig. firmware and start testing with Tasmota. If something needs to be analyzed just flash the orig. firmware back... See https://github.com/arendst/Sonoff-Tasmota/wiki/Esptool

reef-actor commented 5 years ago

@arendst I think it makes sense to expand xdrv_19, but I am having a bit of trouble understanding how it should be done. Is FUNC_COMMAND the right event to use for receiving RGB, mode, speed and sensitivity commands in the driver? Is there any documentation of XdrvMailbox?

arendst commented 5 years ago

You're probably right in extending the xdrv_19 driver with color control. I suggest you take a look at xdrv_16 that already has color control and is integrated with xdrv_04 too.

FUNC_COMMAND is not the right event to receive RGB info. Again have a look at xdrv_16 and how it is connected to xdrv_04 which does the RGB to driver conversion.

XdrvMailbox is defined in settings.h and is used to convey info to Function Pointer Functions.

reef-actor commented 5 years ago

I've started making some changes, but I don't know if I am going in the right direction, I would appreciate any input (there is a good chance it doesn't even compile, I've just been hacking about in a text editor) 967f9c9d848013c1636dc262920bbeffc3c0b732

reef-actor commented 5 years ago

Updated my branch with some code a87a8ea02a46cff3bc16a950a720abdeefdc581e to parse the UPDATE response from the 8051. Will crack open a cold beer and read about setting up an IDE to debug this mess.

Jason2866 commented 5 years ago

Do you a favour and install VSC. Just download Tasmota extract to a folder and you are done. See wiki https://github.com/arendst/Sonoff-Tasmota/wiki/Visual-Studio-Code

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem.

PeterLaemmle commented 5 years ago

Hi @reef-actor, all, Great work, much appreciated! Is there a pad for GPIO0 or do I need to access the ESP's pins directly?

reef-actor commented 5 years ago

I believe I had to use the pin directly, but my module was a knock-off 'Spider Z' one so you may have a slightly different layout

PeterLaemmle commented 5 years ago

Flashing worked fine and the L1 is now running on a stock 6.6.0. I tried using the WebUI's console to play around before getting started with MQTT. No matter what I enter in the console, it does not change a thing though. No "power on", "power off" or "color ff0000" is causing any change. However, I see all the updates triggered by the IR remote. Color changes, dimmer changes, power state and whatsoever. Am I missing something? Sorry to keep this issue alive...

arendst commented 5 years ago

And you did change module to Sonoff L1...

arendst commented 5 years ago

With weblog 3 you should see

22:34:27 MQT: stat/l1/RESULT = {"POWER":"ON"} 22:34:27 MQT: stat/l1/POWER = ON 22:34:27 CFG: Saved to flash at F5, Count 143, Bytes 3584 22:34:27 PSZ: Received AT+UPDATE="switch":"on","light_type":1,"colorR":255,"colorG":0,"colorB":0,"bright":13,"mode":1,"speed":100,"sensitive":10 22:34:27 PSZ: Switch 1 22:34:27 PSZ: Color R:255, G:0, B:0 22:34:27 PSZ: Brightness 13 22:34:27 PSZ: Update 22:34:27 PSZ: Send AT+SEND=ok 22:34:27 PSZ: Received AT+RESULT="sequence":"1563834867631"

PeterLaemmle commented 5 years ago

Yes, can confirm both. Module set as Sonoff L1 and the weblog looks as expected.

xbmcnut commented 5 years ago

Can anyone advise if Tasmota works with this legacy Sonoff LED controller? https://www.itead.cc/sonoff-led.html

arendst commented 5 years ago

122

SK848667 commented 5 years ago

I was able to flash it without issue by connecting to rx,tx & gnd pads on rear and shorting GPIO0 to gnd. I guess the 8051 stays quiet.

How did you flash it?

drodiger commented 5 years ago

I have new Sonoff L1 with 8285. Can you confirm that you wired pin 15 to GND or there is some other pad on the board? Did you had to hold it connected to GND, the whole time, while esptool was sending tasmota bin or just hold for 2 seconds...? Thanks

reef-actor commented 5 years ago

I connected GPIO 0 (second pin from the right on bottom of the esp) for a couple of seconds while connecting power.

hheexx commented 5 years ago

@PeterLaemmle did you find a problem? I have the same. Just flashed 6.6.0 and everything looks fine just led strip does not respond. I can not toggle it or change color.

UPDATE: Remote controller works and when I change state it is reflected in the interface and sent over mqtt. Just commands don't work.

PeterLaemmle commented 5 years ago

No, still failing to control the Sonoff L1 using MQTT. Same behaviour as before: Remote control works as with the stock firmware but the Tasmota webUI and weblog reports all status changes etc. like a charm.

PeterLaemmle commented 5 years ago

This is what the log looks like:

19:14:40 RSL: empfangenes topic cmnd/ambiente/power, Datengröße 2, Daten on 19:14:40 RSL: Gruppe 0, Index 1, Befehl POWER, Daten on 19:14:40 PSZ: Send AT+UPDATE="sequence":"1570562080039","switch":"on","bright":100,"mode":1,"colorR":255,"colorG":0,"colorB":0,"light_types":1 19:14:40 MQT: stat/ambiente/RESULT = {"POWER":"ON"} 19:14:40 MQT: stat/ambiente/POWER = ON 19:14:40 PSZ: Send AT+UPDATE="sequence":"1570562080154","switch":"on","bright":100,"mode":1,"colorR":255,"colorG":0,"colorB":0,"light_types":1 19:14:40 PSZ: Send AT+UPDATE="sequence":"1570562080221","switch":"on","bright":100,"mode":1,"colorR":255,"colorG":0,"colorB":0,"light_types":1 19:14:40 PSZ: Send AT+UPDATE="sequence":"1570562080287","switch":"on","bright":100,"mode":1,"colorR":255,"colorG":0,"colorB":0,"light_types":1 19:14:40 PSZ: Send AT+UPDATE="sequence":"1570562080354","switch":"on","bright":100,"mode":1,"colorR":255,"colorG":0,"colorB":0,"light_types":1 19:14:40 PSZ: Send AT+UPDATE="sequence":"1570562080421","switch":"on","bright":100,"mode":1,"colorR":255,"colorG":0,"colorB":0,"light_types":1 19:14:40 PSZ: Send AT+UPDATE="sequence":"1570562080488","switch":"on","bright":100,"mode":1,"colorR":255,"colorG":0,"colorB":0,"light_types":1 19:14:40 PSZ: Send AT+UPDATE="sequence":"1570562080555","switch":"on","bright":100,"mode":1,"colorR":255,"colorG":0,"colorB":0,"light_types":1 19:14:42 PSZ: Received AT+UPDATE="switch":"off","light_type":1,"colorR":255,"colorG":0,"colorB":0,"bright":100,"mode":1,"speed":100,"sensitive":10 19:14:42 PSZ: Switch 0 19:14:42 SRC: Switch 19:14:42 PSZ: Send AT+UPDATE="sequence":"1570562082359","switch":"off","bright":100,"mode":1,"colorR":255,"colorG":0,"colorB":0,"light_types":1 19:14:42 MQT: stat/ambiente/RESULT = {"POWER":"OFF"} 19:14:42 MQT: stat/ambiente/POWER = OFF

Does this ring a bell? Anything stupid I am doing?

reef-actor commented 5 years ago

@PeterLaemmle There are a couple of things I can think to try Check SetOption15 is set to 1 (enables color and dimmer commands) Does the Color command work (eg. Color FF0000)?

My MQTT configuration for HomeAssistant:

- platform: mqtt
  name: 'RGB strip'
  command_topic: 'cmnd/rgbstrip/POWER'
  state_topic: 'stat/rgbstrip/POWER'
  payload_on: 'ON'
  payload_off: 'OFF'

  brightness_command_topic: 'cmnd/rgbstrip/DIMMER'
  brightness_scale: 100
  brightness_state_topic: 'stat/rgbstrip/RESULT'
  brightness_value_template: '{% if value_json.Dimmer is defined %}{{ value_json.Dimmer }}{% else %}{{states.light.rgb_strip.attributes.brightness / 255 * 100 }}{% endif %}'

  rgb_command_topic: 'cmnd/rgbstrip/COLOR2'
  rgb_command_template: '{{ "%02x%02x%02x" | format(red, green, blue)}}'
  rgb_state_topic: 'stat/rgbstrip/RESULT'
  rgb_value_template: '{% if value_json.Color is defined %}{{ value_json.Color[0:2]|int(base=16) }},{{ value_json.Color[2:4]|int(base=16) }},{{ value_json.Color[4:6]|int(base=16) }}{% else %}{{ states.light.rgb_strip.attributes.rgb_color|join(",") }}{% endif %}'

  availability_topic: 'tele/rgbstrip/LWT'
  payload_available: 'Online'
  payload_not_available: 'Offline'

I am using 6.5.0.16, it's possible something has changed since then or maybe there are hardware differences.

hheexx commented 5 years ago

@reef-actor Tried SO15. Does not work.

Here is Color output:

21:25:14 CMD: Color FF0000
21:25:14 MQT: sonoff-l1/tele/STATE = {"Time":"2019-10-09T21:25:14","Uptime":"0T00:00:52","Heap":14,"SleepMode":"Dynamic","Sleep":0,"LoadAvg":181,"POWER":"ON","Dimmer":100,"Color":"FF0000","HSBColor":"0,100,100","Channel":[100,0,0],"Scheme":0,"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"PRPIC","BSSId":"74:4D:28:6D:3B:1D","Channel":7,"RSSI":66,"LinkCount":1,"Downtime":"0T00:00:04"}}
21:25:14 MQT: sonoff-l1/stat/RESULT = {"POWER":"ON","Dimmer":100,"Color":"FF0000","HSBColor":"0,100,100","Channel":[100,0,0]}
21:25:18 MQT: sonoff-l1/tele/STATE = {"Time":"2019-10-09T21:25:18","Uptime":"0T00:00:56","Heap":14,"SleepMode":"Dynamic","Sleep":0,"LoadAvg":227,"POWER":"ON","Dimmer":100,"Color":"FF3F00","HSBColor":"15,100,100","Channel":[100,25,0],"Scheme":0,"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"PRPIC","BSSId":"74:4D:28:6D:3B:1D","Channel":7,"RSSI":64,"LinkCount":1,"Downtime":"0T00:00:04"}}
21:25:18 MQT: sonoff-l1/stat/RESULT = {"POWER":"ON","Dimmer":100,"Color":"FF3F00","HSBColor":"15,100,100","Channel":[100,25,0]}

Color of strap has not changed.

angomania commented 4 years ago

Same here. Flashed Tasmota with tuya convert, set template to L1 but get no functions.

Device

LED Strip Amazon 01 LED Strip Amazon 02 LED Strip Amazon 03 LED Strip Amazon 04 LED Strip Amazon 05

Tommy-LSA commented 4 years ago

It has a Buscontroller on PCB as H801 has. Give it a try with this template.

Von meinem iPhone gesendet

Am 20.11.2019 um 17:13 schrieb angomania notifications@github.com:

 Same here. Flashed Tasmota with tuya convert, set template to L1 but get no functions.

Device

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

angomania commented 4 years ago

It has a Buscontroller on PCB as H801 has. Give it a try with this template. Von meinem iPhone gesendet Am 20.11.2019 um 17:13 schrieb angomania @.***>:  Same here. Flashed Tasmota with tuya convert, set template to L1 but get no functions. Device — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

I have tried H801, unfortunately, no function. The IR remote works without problems

hheexx commented 4 years ago

Same problem with 6.7.1

vpomax commented 4 years ago

Has anyone succesfull flashed Tasmota on Sonoff L1 controller?

tifrei commented 4 years ago

Can anyone tell me where i can find the GPIO ? This would be much appricitated

My sonoff L1 looks different or maybe they just did a poor job here: IMG_2938 IMG_2937

thehijacker commented 4 years ago

I too have this LED strip. Consider flashing it with Tasmota using Tuya Convert but need to know if I will have all functions with it (on/off and and changing mode/colors). Anyone can confirm this?

meingraham commented 4 years ago

@thehijacker

Sonoff devices do not use Tuya Wi-Fi modules. They cannot be flashed with Tuya-Convert.

thehijacker commented 4 years ago

@angomania wrote above:

Same here. Flashed Tasmota with tuya convert, set template to L1 but get no functions.

That is why I thought this one can also be flashed with Tuya-Convert. Today I will try to add it to Tuya Android app. Currently I still use eWeLink. I suspect that adding it via Tuya will also work.

jpenninkhof commented 4 years ago

Can anyone tell me where i can find the GPIO ? This would be much appeciated

image

It's here! Second pin from the right. But requires a very steady hand, a pair of good eyes en maybe a thin jumper cable or even needle to connect this to ground. Only required during boot-up though.

jpenninkhof commented 4 years ago

I've connected GPIO0 to Ground, and I can see the board booting up (noise on the serial port), the blue blinking light remains off (as the Sonoff firmware doesn't boot), but no joy with esptool unfortunately.

image

My version is the version with 20181008 on the back of the PCB.

image

meingraham commented 4 years ago

@jpenninkhof If the device functions with the Itead firmware then the ESP chip is functioning... which means that you are not successfully getting the device into programming mode.

While booting bridge GPIO0 to GND and keep the bridge connected for several seconds. In fact, you can keep it bridged for the entire programming procedure... but since that is difficult with this device, 3-5 seconds should be sufficient.

Please address any further questions to the Tasmota Support Discord Chat. The chat is a better and more dynamic channel for helping you. Github issues are best used for Tasmota software feature requests and bug reporting. Troubleshooting and setup assistance is more effective using an interactive forum.

Please check the Contributing Guideline and Policy and the Support Guide.

Thanks.

Support Information

See Wiki for more information. See Chat for more user experience. See Community for forum. See Code of Conduct