Sonoff L1 - colour control in a scene not working

Ok. Check your entities list and find this switch. Tell me what the ID is.

If this is yours then you have a sonoff…

So add the debug log to your config:

  username: !secret sonoff_id 
  password: !secret sonoff_secret
  mode: cloud
  debug: true
  reload: always

Then find your switch in the debug log on the basis of the ID 1000338ffe and tell me what the uiid is. Then when go to the next step if possible…

1000338ffe == Init   | {'uiid': 33, 'extra': {'manufacturer': 'ABC', 'model': '123', 'sw_version': 'PSF-BTA-GL v3.4.2'}

OK,

Now go to lights.py and update the following routine:

async def async_setup_platform(hass, config, add_entities,
                               discovery_info=None):

by adding this line:

    elif uiid == 33:  # joe's ledstrip controller
        add_entities([SonoffLED(registry, deviceid)])

in the if - elif block. You will find it.

after save and restart let me know if it works?

i have L1 and can confirm this behaviour, noticed it first when making automations and scripts, you have to first turn on L1 and then change color or mode.

Scene - changing color - this scene will change color, but home assistant will not registered L1 was turned on

    light.sonoff_l1:
      brightness: 255
      hs_color:
      - 0
      - 0
      state: 'on'

Scene - turned on - this on the other hand will let homessistant know L1 was turned on, but it will not change color

    light.sonoff_l1:
      state: 'on'
      brightness: 255
      hs_color:
      - 0
      - 0
      effect: 'Colorful'

It seems like L1 can’t accept 2 commands at once. So this could be solved either by using scripts sending 2 commands with small delay of 1 second or less, 1. turn on, 2. change color/brightness/mode

Or possibly in the integration itself to send 2 commands in the background each time

I did exactly that in my file (custom_components/sonoff/light.py), but it still only recognizes my Sonoff L2 as a switch instead of a light.

     elif uiid == 137: #Sonoff L2
         add_entities([SonoffLED(registry, deviceid)])

Maybe I’m missing something else?

You have to classify the led strip to light as well and I don’t know if you have done that!

I have not! How do I do that?

Please set the device class of your Led strip in your config:

sonoff:
  username: !secret sonoff_id 
  password: !secret sonoff_secret
  mode: cloud
  debug: true
  reload: always
  force_update: [temperature, humidity, power]
  scan_interval: '00:01:00'  # (optional) default 5 minutes
  sensors: [temperature, humidity, power, current, voltage, rssi]
  devices:
    xxxxxa82: # ID of the device Sonoff L2
      device_class: light
      name: friendly name

and let me know if this worked?

1 Like

Yes! That did it!

So, just to summarize, in case anyone else has trouble dealing with Sonoff L2.

1. Enable debug in Sonoff Integration (and restart Home Assistant):

sonoff:
  username: !secret sonoff_id 
  password: !secret sonoff_secret
  mode: cloud
  debug: true

2. Identify Device ID and Device UIID:

1000338ffe == Init   | {'uiid': 33, 'extra': {'manufacturer': 'ABC', 'model': '123', 'sw_version': 'PSF-BTA-GL v3.4.2'}

In this case:

  • 1000338ffe = Device ID
  • UIID: 33 (for me it was 137, so it may vary)

3. Go to /config/custom_components/sonoff/light.py and add the following lines under the el-if group:

    elif uiid == 33:  # id of the ledstrip controller, same UIID you got before
        add_entities([SonoffLED(registry, deviceid)])

Make sure your Entity has the class SonoffLED above, don’t change it to anything else!

4. Add the following lines in the /config/configuration.yaml file.

  devices:
    1000338ffe: # ID of the device Sonoff L2 (use your own device ID from the debug)
      device_class: light
      name: friendly name

Then save and restart!

2 Likes

Great recap !!

You need to care now that at an upgrade might reverse all of it…

Many many thanks!!!

Hello, I have the L2 version, the SONOFF LAN Integration installed via HACS, the eWeLink add-on installed. But nothing is working, not even Turning on and off, and the state is always unavailable.

I had a mistake in my code (the UIID). I corrected it. Now the attributes of the enitity changed a bit. But i can’t still turn on or off the led strip, and the state is always unavailable.

@mkjustuk this works very well thanks!
Have you figured out whether the transition effects can be made to work with the L1?
e.g. make the strip slowly fade to off or fade on when switched on?

Yes and no, I see 4/5 effects options once it’s switched on. They are just called 0-4 but each does one of the breathing/RGB cycle type effects.

Transitions (fade rate etc) in HA terms are not available however, but if you put ESPHome on it, I’m sure that would work, as it’s only that Tasmota doesn’t support HA transition calls.

Thanks @mkjustuk !
Would you have any pointers on flashing esphome to the L1?
I am currently using mine with the SonoffLAN integration no mods!
Hopefully it doesn’t require soldering as I wouldn’t trust my limited skills on such a small device!! :grinning:

@mkjustuk Is there anything else i can do to make it work ?
the state is always unavailable.

The SONOFF Debug shows :

2022-04-19 16:26:20  DEBUG    main          SysInfo: {'version': '2021.12.10', 'dev': False, 'hassio': True, 'virtualenv': False, 'python_version': '3.9.7', 'docker': True, 'arch': 'aarch64', 'os_name': 'Linux', 'os_version': '5.10.92-v8', 'user': 'root', 'supervisor': '2022.04.0', 'host_os': 'Home Assistant OS 7.4', 'docker_version': '20.10.9', 'chassis': 'embedded'}
2022-04-19 16:26:20  DEBUG    main          CLOUD mode start
2022-04-19 16:26:25  DEBUG    sonoff_cloud  2 devices loaded from the Cloud Server
2022-04-19 16:26:25  DEBUG    main          a63001881d == Init   | {'uiid': 87, 'extra': {'manufacturer': 'coolkit', 'model': 'GK-200MP2C', 'sw_version': 'GK-200MP2C v27620201103'}, 'params': {'bindInfos': {'gaction': ['...']}, 'romVersion': '27620201103', 'version': 7, 'rssi': -44, 'fwVersion': '27620201103', 'cloud': 'offline'}}
2022-04-19 16:26:25  DEBUG    main          10013f50dc == Init   | {'uiid': 137, 'extra': {'manufacturer': 'SONOFF', 'model': ' ', 'sw_version': 'OPL-LED-01'}, 'params': {'bindInfos': {'gaction': ['...']}, 'cloud': 'offline'}}
2022-04-19 16:26:36  DEBUG    sonoff_cloud  Cloud init: {'error': 0, 'apikey': '...', 'config': {'hb': 1, 'hbInterval': 145}, 'sequence': '1650385586867'}

Update : It’s working now with the new version of SONOFF LAN Integration (v3.0rc1 - 2022-04-23)