SonoffLAN icon indicating copy to clipboard operation
SonoffLAN copied to clipboard

Sonoff B05 RGB Bulb

Open PepekT opened this issue 6 years ago • 20 comments

Hello,

Thank you for this awesome plugin.

I tried to use this plugin for my Sonoff B05 rgb led bulb. I am able to turn on/off bulb.

Unfortunately I am not able to change brightness. When I change brightness in HA . bulb just blinks and slider in HA returns to its original position.

Logs:

2020-11-30 06:10:14 DEBUG sonoff_local 1000f48984 => Local4 | {'switch': 'on', 'ltype': 'white', 'white': {'br': 79, 'ct': 54}} !! Timeout 1

2020-11-30 06:10:14 DEBUG sonoff_cloud 1000f48984 => Cloud4 | {'switch': 'on', 'ltype': 'white', 'white': {'br': 79, 'ct': 54}} | 1606716613081

2020-11-30 06:10:14 DEBUG sonoff_local 1000f48984 => Local4 | {'switch': 'on', 'ltype': 'white', 'white': {'br': 79, 'ct': 54}} !! Timeout 1

2020-11-30 06:10:14 DEBUG sonoff_cloud 1000f48984 => Cloud4 | {'switch': 'on', 'ltype': 'white', 'white': {'br': 79, 'ct': 54}} | 1606716613265

2020-11-30 06:10:14 DEBUG sonoff_cloud 1000f48984 <= Cloud3 | {'action': 'update', 'deviceid': '1000f48984', 'apikey': '...', 'userAgent': 'device', 'd_seq': 19996, 'ts': 0, 'params': {'switch': 'on', 'ltype': 'white', 'white': {'br': 100, 'ct': 54}, 'sequence': '123456789', 'selfApikey': ''}, 'from': 'device'}

2020-11-30 06:10:14 DEBUG sonoff_cloud 1000f48984 <= Cloud3 | {'error': 0, 'deviceid': '1000f48984', 'apikey': '...', 'sequence': '1606716613081'}

2020-11-30 06:10:14 DEBUG sonoff_cloud 1000f48984 => Cloud5 | Force update sequence: 1606716614580

2020-11-30 06:10:14 DEBUG sonoff_cloud 1000f48984 <= Cloud3 | {'error': 0, 'deviceid': '1000f48984', 'apikey': '...', 'sequence': '1606716614580', 'params': {'version': 7, 'switch': 'on', 'ltype': 'white', 'white': {'br': 79, 'ct': 54}, 'fwVersion': '1.3.2', 'sequence': '123456789', 'selfApikey': '', 'OTA': 'success', 'color': {'r': 254, 'g': 0, 'b': 0, 'br': 1}}}

2020-11-30 06:10:14 DEBUG sonoff_cloud 1000f48984 <= Cloud3 | {'error': 0, 'deviceid': '1000f48984', 'apikey': '...', 'sequence': '1606716613265'}

2020-11-30 06:10:14 DEBUG sonoff_cloud 1000f48984 => Cloud5 | Force update sequence: 1606716614669

2020-11-30 06:10:14 DEBUG sonoff_cloud 1000f48984 <= Cloud3 | {'action': 'update', 'deviceid': '1000f48984', 'apikey': '...', 'userAgent': 'device', 'd_seq': 5981, 'ts': 0, 'params': {'switch': 'on', 'ltype': 'white', 'white': {'br': 100, 'ct': 54}, 'sequence': '123456789', 'selfApikey': ''}, 'from': 'device'}

2020-11-30 06:10:14 DEBUG sonoff_cloud 1000f48984 <= Cloud3 | {'error': 0, 'deviceid': '1000f48984', 'apikey': '...', 'sequence': '1606716614669', 'params': {'version': 7, 'switch': 'on', 'ltype': 'white', 'white': {'br': 79, 'ct': 54}, 'fwVersion': '1.3.2', 'sequence': '123456789', 'selfApikey': '', 'OTA': 'success', 'color': {'r': 254, 'g': 0, 'b': 0, 'br': 1}}}

2020-11-30 06:10:14 DEBUG sonoff_local 1000f48984 <= Local3 | {'switch': 'on', 'ltype': 'white', 'white': {'br': 100, 'ct': 54}} | 3

2020-11-30 06:10:19 DEBUG sonoff_cloud 1000f48984 <= Cloud3 | {'action': 'update', 'deviceid': '1000f48984', 'apikey': '...', 'userAgent': 'device', 'd_seq': 17901, 'ts': 0, 'params': {'switch': 'on', 'ltype': 'white', 'white': {'br': 100, 'ct': 54}, 'sequence': '123456789', 'selfApikey': ''}, 'from': 'device'}

2020-11-30 06:10:19 DEBUG sonoff_local 1000f48984 <= Local3 | {'switch': 'on', 'ltype': 'white', 'white': {'br': 100, 'ct': 54}} | 4

Thank you for your help.

PepekT avatar Nov 30 '20 08:11 PepekT

+1 to this same issue :-)

I can toggle the light on or off but colour and brightness just resets as though I've just turned it on again.

scott40k avatar Dec 01 '20 15:12 scott40k

Same issue.

fishenebelny avatar Dec 08 '20 08:12 fishenebelny

I am having the same issues implementing these bulbs in my homebridge-ewelink plugin. I personally own the B02-F filament bulb which uses the same format:

params: {
   switch: 'on',
   ltype: 'white',
   white: {
      br: 79,
      ct: 54
   }
}

Following this issue to see if a solution is found 😛

bwp91 avatar Dec 23 '20 09:12 bwp91

After a few hours of tinkering with my code I have had success and found the following works to update.

  • Send just the switch param to turn on/off
  • To change from color to white mode (or vice versa), send the ltype param along with the white/color param containing both br and ct (but don't send the switch param)
  • To change br/r g b/ct values (but not changing mode) then it is not necessary to send the switch nor mode params.

This third point was what seemed to be causing the flickering - I was sending the mode param even if it didn't need to be changed.

I also noticed that if the bulb is OFF, and I send mode and white/color params, the bulb would turn ON (but still reported as OFF in the ewelink app).

I hope this can help someone on here. I have zero experience with python.

bwp91 avatar Dec 23 '20 16:12 bwp91

Is this B05 bulb working in local mode, or only with cloud mode ? Is color setting is resolved already ?

dr-azbest avatar Dec 29 '20 16:12 dr-azbest

I have created a fork which works with my B05 bulbs over cloud mode. I don't think these bulbs even support local mode (if they do, please let me know how!). Please check it out here: https://github.com/mennovf/SonoffLAN. I will create a pull request after I have gained some experience with my fork. The changes I had to make were exactly those as specified by @bwp91 . Thank you!

mennovf avatar Jan 05 '21 21:01 mennovf

I've run into an issue with the implementation. If I turn on an entity group with two light in them, it happens that only one of them actually turns on. These are the log lines during this event:

2021-01-06 19:40:06 DEBUG sonoff_cloud Cloud init: {'error': 0, 'apikey': '...', 'config': {'hb': 1, 'hbInterval': 145}, 'sequence': '1609958406711'} 2021-01-06 19:46:11 DEBUG sonoff_cloud 1000f18071 => Cloud4 | {'switch': 'off'} | 1609958771951 2021-01-06 19:46:11 DEBUG sonoff_cloud 1000f189bc => Cloud4 | {'switch': 'off'} | 1609958771954 2021-01-06 19:46:11 DEBUG sonoff_cloud Cloud WS retrying in 0 seconds 2021-01-06 19:46:12 DEBUG sonoff_cloud Cloud init: {'error': 0, 'apikey': '...', 'config': {'hb': 1, 'hbInterval': 145}, 'sequence': '1609958772309'} 2021-01-06 19:46:17 DEBUG sonoff_cloud 1000f18071 <= Cloud3 | {'action': 'update', 'deviceid': '1000f18071', 'apikey': '...', 'userAgent': 'device', 'd_seq': 14632, 'params': {'switch': 'off', 'sequence': '123456789', 'selfApikey': ''}, 'from': 'device'}

Is this because the entity groups causes multiple messages to be sent to the cloud too quickly, or should I just handle these timeouts somewhere and try again. Can anyone shed some light on this?

mennovf avatar Jan 06 '21 19:01 mennovf

I have the same issue with B05 bulb. I noticed when using ewelink, all the commands are visible in HA. In the other direction won't work =(

Help please

aljosafrank avatar Jan 09 '21 13:01 aljosafrank

Is this because the entity groups causes multiple messages to be sent to the cloud too quickly, or should I just handle these timeouts somewhere and try again. Can anyone shed some light on this?

From coding my ewelink homebridge plugin, I noticed that multiple web socket updates at the same time would fail. I had to implement a random delay (between 0 and 500ms I think). If it's a lighting group, can you use the eWeLink app to make scenes where if one turns on/off then the other light turns on/off accordingly? - then it would just need one web socket update for them both to turn on/off

bwp91 avatar Jan 09 '21 14:01 bwp91

I had to implement a random delay (between 0 and 500ms I think)

I've made all the 'sends' scheduled with at least a 100ms difference between them. This seems to work so far, but I'm still testing. This is a change that affects all communication with the cloud. I'm not sure this wont have any adverse effect on other devices.

can you use the eWeLink app to make scenes where if one turns on/off then the other light turns on/off

Correct me if I'm wrong, but do you need to use apiv2 for this? I'm new to this eWeLink thing but it appears this repository uses the first api version.

mennovf avatar Jan 09 '21 19:01 mennovf

same issue for me, i'm able to switch on/off but I'm not able to change the brightness, blink and return back to the original positon

andyz68 avatar Jan 13 '21 19:01 andyz68

@andyz68 I have been using my fork for a couple of days now with no issues. You could try it out if you'd like.

mennovf avatar Jan 13 '21 19:01 mennovf

@andyz68 I have been using my fork for a couple of days now with no issues. You could try it out if you'd like.

Done, it work fine! Thank you!

andyz68 avatar Jan 13 '21 21:01 andyz68

Let me know on the dedicated issue page if you encounter any. I don't want to spam this issue too much.

mennovf avatar Jan 13 '21 21:01 mennovf

@mennovf how is it going now, do you plan to create a PR?

sherazlodhi avatar Jan 19 '21 10:01 sherazlodhi

@sherazlodhi I thinks it's fine already for a pull request. I will look at it tonight. I have some questions regarding code quality/organization but I will resolve those in the PR.

mennovf avatar Jan 19 '21 10:01 mennovf

Working solution, thank you @mennovf .

SzenDavid avatar Jan 19 '21 23:01 SzenDavid

Is B05 works fine in latest release?

AlexxIT avatar Mar 10 '21 19:03 AlexxIT

@AlexxIT

Is B05 works fine in latest release?

I've just updated to version 2.4.0 and I can confirm brightness and color setting works like a charm!

Thank you very much.

PepekT avatar Mar 10 '21 19:03 PepekT

Are there any specific configurations that are needed to run the B05?

Dyltong avatar Feb 15 '22 19:02 Dyltong