Giter Site home page Giter Site logo

Comments (65)

peterbuga avatar peterbuga commented on May 26, 2024 1

@gregcsw @max-rh @imjcube @stephanerosi @superjasiek
hi everyone, i've been doing some work regarding this issue (and hopefully i'll get the time to finish it too) if by any chance one of gets the time to do a quick test and let me know if even works i'll highly appreciate it.
please use this branch https://github.com/peterbuga/HASS-sonoff-ewelink/tree/sonoff-bulb (and if you have any kind of custom changed of sonoff component don't forget to backup it) the best way to install it is to completely remove the old sonoff files and this one (works only with HA0.88+)

i would like to mention that this is not complete (if it even works) and the bulb settings are not saved anywhere (i.e. between HA restarts the bulb's values will reset). just try to play with on-off/brightness/color temp/color and let me know how it behaves ps: keep an eye on HA logs too

thanks :)

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024 1

@superjasiek ohh wow thanks! unbelievable great news (more for me than it might be for you) because i've done literally 0 testing of it due to not having the device πŸ˜… so everything was just theoretical (also, i think i might've added new bugs due to refactoring so further testing needs to be done for all the devices)

as i've said earlier the implementation is not complete and i'm relying on you guys to give me some feedback on it.

from what i gather the dimming is not supported by default on this (or any similar) device, but it could be simulated by sending progressing increasing/decreasing values over a defined amount of time, i'll probably create a service call for more-or-less power users willing to achieve this πŸ˜‰ . because it's like an extra feature first i want to be sure all the basic functions work as intended and then i'll look into it (btw, i never played with a dimming/color bulb so i'm not sure if it'll have a flicker effect or not)

looking forward for more feedback! πŸ™Œ

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024 1

Tested it like you said above with 3 automations.
image

Tried with various brightness settings, and it works as expected. The bulb changes to correct color then brightness, and the HA UI updates accordingly with the changes.

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

After installing the component in home assistant, I currently get the following error when the Sonoff B1 has power, light can be on or off.
(It is the only device loaded on the Ewelink app)
The error goes away when the bulb is turned off, ie no power to the globe so it is completely off and disconnected.

Log Details (ERROR)
Wed Jan 09 2019 11:45:57 GMT+0200 (South Africa Standard Time)

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 232, in async_update_ha_state
state = self.state
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 426, in state
return STATE_ON if self.is_on else STATE_OFF
File "/config/custom_components/switch/sonoff.py", line 48, in is_on
self._state = self.get_state()
File "/config/custom_components/sonoff.py", line 414, in get_state
return device['params']['switch'] == 'on' if device else False
KeyError: 'switch'

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

Hi @gregcsw thanks for reaching out! this is the only way for me to add new devices and i'm constantly surprised (not in a good way!) how the developers behind sonoff products keep changing the API logic of various devices.

Long story short: I will definitely fix the error above soon πŸ˜‰ but you'll have to test it and report back (cuz' you're the only one with the device so far πŸ˜‹ )

I see that this device is an RGB light, I will appreciate if you could do a few more device dumps (the first one is perfect btw) so that I figure out which values control the colour/brightness: basically i need a dump for each of a full red/blue/green/yellow + brightness 100%, white-brightness 100% and white-brightness 1% (don't forget to label the dumps accordingly)
This way I could implement also the brightness/colour changing automation in HA in the future, only if you're willing to do the request above 😊 !

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

Thank you for your quick response.
Here are the dumps as requested.
The bulb has 3 white modes, cool white, warm white and cool+warm white (both cool and warm leds are on)

blue100.txt
cool_white_100.txt
cool_white_min.txt
cool+warm_white_min.txt

green100.txt
off.txt
red100.txt
warm_white_100.txt
warm_white_min.txt

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

Wow, I wasn't expecting the dumps so fast πŸ˜„!

They're exactly what I needed/requested. For reference I watched this video https://youtu.be/eBUtXQ8N4Cw to see exactly what are the options and how they match with the dumps. For starters I'll update the component soon-ish to avoid throwing the errors and give you the ability to change the state ON/OFF of the light (i'll let you know)

The brightness/colour part, I have to admit, I have no idea right how needs to be implemented and/or how much it'll take but for sure I'll make it work πŸ˜‰

This might sound weird, but are you able to change bulb's brightness when using the colour mode of the light (it's not totally clear for me from video)? If not, it think this might be an extra feature that I could add.

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@gregcsw looks like the on/off update has been a basic one, give a try with this branch https://github.com/peterbuga/HASS-sonoff-ewelink/tree/sonoff-bulb and let me know if it works (just to be sure, update all the sonoff.py files from this branch)

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

Wow Awesome. Yes that works. Turns on to whatever colour or brightness was last used in the app. Just one small thing, it is showing up as a switch in home assistant instead of a light.

For your previous question, no you can't change the brightness when using the RGB colours, you can only choose the colour from the wheel.
For white there is a 3 position switch for choosing cool white, mixed or warm white and a brightness slider.

Functionality in the app is not great, so anything you can do will be nice.

Thank you
img_1650
img_1651

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

And the error message is gone. Thank you

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

Great πŸ™Œ, glad it works!

Behind the scenes a light entity is actually a physical-switch + physical-light. It's gonna show up as a light later after I work more on on it, but if you really really need to show up as a light you can either customize the switch or use this component https://www.home-assistant.io/components/light.switch/

I'll keep you up-to-date with my progress, again... you're the only one who can test it so far πŸ˜…

from hass-sonoff-ewelink.

superjasiek avatar superjasiek commented on May 26, 2024

Hi! Thanks for your grate work! Works well with bulb B1! In general that was the integration with HA what I was looking for. Can't wait for other options available. In case i can be a second beta-tester! Take care!

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@superjasiek i'll definitely need more people to test it, i'm sort of blindly coding this component due to the fact i don't have the devices to do the tests on my side 😞 . otherwise the development of it was much much faster!
i'll keep you up to date when i make more progress πŸ˜‰

from hass-sonoff-ewelink.

max-rh avatar max-rh commented on May 26, 2024

Hi @peterbuga,
First of all, thanks alot for this absolutely amazing integration, its exactly what i need.
I have the multiple sonoff devices (including the bulb and the RF bridge and multiple door and motion devices), and i am happy to help with the integration, please update me with what u need and how may i assist.

Just a note: i did try the branch for the bulb and it works fine so far, but i still get the following error:

Traceback (most recent call last):, File "/usr/src/app/homeassistant/helpers/entity.py", line 232, in async_update_ha_state, state = self.state, File "/usr/src/app/homeassistant/helpers/entity.py", line 426, in state, File "/config/custom_components/switch/sonoff.py", line 48, in is_on, return STATE_ON if self.is_on else STATE_OFF, self._state = self.get_state(), File "/config/custom_components/sonoff.py", line 418, in get_state, return device['params'][state_key] == 'on' if device else False, KeyError: 'switch'

Happy to be of any assist :)

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@max-rh soo funny thing πŸ˜… the sonoff-bulb branch has (currently) basic ON/OFF support for Sonoff B1 but just yesterday someone else who has a Sonoff RF Bridge contacted me regarding the integration of this device and I pushed some patches to master branch.

i did not expect someone to have B1 + Bridge in the same account and try to use this component. i merged everything right now into sonoff-bulb branch so please update the files from here, but no RF device will be displayed right now (basically the Bridge is ignored)

i would highly appreciate if you could send me a sonoff-debug.py dump following these steps https://github.com/peterbuga/HASS-sonoff-ewelink/tree/master/sonoff-debug and post the output in the thread of this issue #38

The process is tedious because I cannot test myself what I'm actually coding, but for sure Sonoff B1 will have the brightness/colour options added in the future and also the "Alarm" devices from Sonoff Bridge (i don't think it'll make sense to add the key fob buttons from bridge, same thing can be simulated in HA, and for curtains I really have no idea how it works πŸ˜… )

from hass-sonoff-ewelink.

max-rh avatar max-rh commented on May 26, 2024

Thanks @peterbuga,
I am trying to collect the logs for you, but i keep getting python errors while i run sonoff-debug.py, its because i am running this on a different platform than the one my HA is running on (i am using a docker image on HA on my server), so can you please tell me what python image are u using and if i need to have any additional libraries.

currently i am getting the following error:

Traceback (most recent call last): File "sonoff-debug.py", line 90, in <module> devices_json = get_devices() File "sonoff-debug.py", line 69, in get_devices headers.update({'Authorization' : 'Bearer ' + user_details['at']}) KeyError: 'at'

Thanks

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@max-rh thanks for followup
you can run the sonoff-debug.py from any place, it's not mandatory to be on the same environment as HA install, in the end the output is the same.

the error above occurs when you mistype the username/password, please make sure you use ' around the login details, like here python sonoff-debug.py '[email protected]' 'password'
OR by any chance, are you using a phone number as your username instead of an email? because in this case sonoff-debug.py is not working πŸ˜…. this script is a slimmed-down version of the main component which supports both login with an email or phone number but i'm not always updating it due to low usage

from hass-sonoff-ewelink.

max-rh avatar max-rh commented on May 26, 2024

Hi peter,
Yes my account is linked to a phone number not an email... so is there a script for a phone number?

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

so is there a script for a phone number?

@max-rh it wasn't but there is now. try with this updated version of the script https://github.com/peterbuga/HASS-sonoff-ewelink/tree/master/sonoff-debug

you should run it like this python sonoff-debug.py '+1234567890' 'pa55w0rd' (notice that i've changed email argument to username now for a better meaning)

from hass-sonoff-ewelink.

max-rh avatar max-rh commented on May 26, 2024

Hi Peter,
I am using the master script but the Bulb is showing up as an error
image

and i am getting this error in the logs:

Traceback (most recent call last): File "/usr/src/app/homeassistant/helpers/entity.py", line 232, in async_update_ha_state state = self.state File "/usr/src/app/homeassistant/helpers/entity.py", line 426, in state return STATE_ON if self.is_on else STATE_OFF File "/config/custom_components/switch/sonoff.py", line 48, in is_on self._state = self.get_state() File "/config/custom_components/sonoff.py", line 414, in get_state return device['params']['switch'] == 'on' if device else False KeyError: 'switch'

any advice ?

*Edit:
The entity error turned out to be because the bulb is no longer showing up.

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

hi @max-rh can you please give a bit more details about the part "The entity error turned out to be because the bulb is no longer showing up" ? does this mean you had Sonoff Bulb in your eWeLink account and then you removed it?

i've been a bit busy lately, so i didn't had to do so many updates as i would've liked but i'm definitely going to implement/fix this one too πŸ’ͺ

from hass-sonoff-ewelink.

max-rh avatar max-rh commented on May 26, 2024

Hi Peter,
no, the bulb has always been on my account, but it was offline lately (i plugged it in recently) and it showed the error i mentioned before, but today i checked HA again and it showed up as unavailable although i can see it online in the eWelink app.

from hass-sonoff-ewelink.

imjcube avatar imjcube commented on May 26, 2024

Hi,

I have just recived the Sonoff L1 (light strip) and it shows up as a switch so I figured it may belong to this thread. If you need anything I am happy to help.

Thanks for making this!

from hass-sonoff-ewelink.

stephanerosi avatar stephanerosi commented on May 26, 2024

@peterbuga Hi! Any reason why sonoff-bulb branch hasn't yet been merged into master? I've just tried it with my B1 and it works fine, along with my other sonoff switches. But it doesn't work if I'm on master (key error).

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@stephanerosi it's not completed yet, i wanted to finish it instead of just patch-ing it into master

from hass-sonoff-ewelink.

superjasiek avatar superjasiek commented on May 26, 2024

Hey! Just tested new files and it seems to work perfect. I'm not at home but i have a preview from camera and all functions works fine. Thanks to this solution maybe i will use this bulb as a wake-up light - is dimming with automation possible now? . Thank you for your work and time!

from hass-sonoff-ewelink.

superjasiek avatar superjasiek commented on May 26, 2024

So far i'm able to change color, and mode (color or white), change brightness up and down. Can't see if white color changes from warm to cool but i will check it and let you know. Also no errors in home assistant log - only standard warning about using custom components. Have a grate day!
main_color
warmcool

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

another extra feature that i've just noticed based on one above comment of @gregcsw is that i might be able to use brightness on RGB mode also and/or combine warm-cool light with RGB in the same (with different brightness levels for both) if that makes any sense, i hope i'm not wrong believing this is currently missing from eWeLink app.
so if you guys want/need it i could implement it πŸ’ͺ

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

got a little excited and I quickly added support RGB brightness, just the light.py needs to be updated, let me know how it works.

just to be sure, because trust me i'm walking sort of blind here, someone please confirm or not these features work as intended:

  • turning ON / OFF
  • color temperature (100% brightness), the slider works like this:
    • 100% left side = 100% cool + 0% warm,
    • 75% left side = 75% cool + 25% warm
    • 25% left side = 25% cool + 75% warm
    • middle = 100% cool + 100% warm
    • 25% right side = 75% cool + 25% warm
    • 75% right side = 25% cool + 75% warm
    • 100% right side = 0% cool + 100% warm
  • color temperature + brightness levels
  • RGB colors (100% brightness)
  • RGB colors + brightness levels
  • restoring the state between warmcool and color modes

* to mention that first time after you restart HA some values might have a default hardcoded value, please change some settings before testing the above list. this part it's still work in progress

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

thanks! that's a really good catch, i'll follow up and test it myself.

i was actually wondering why the brightness 0% problem occurs because i never change it in the code. too soon to tell but it might be a HA bug πŸ˜… worst case scenario you'll be able to change it in automations only Β―_(ツ)_/Β―

really appreciate the prompt replies!

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

haha my bad πŸ˜„ totally forgot about that!

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

from hass-sonoff-ewelink.

max-rh avatar max-rh commented on May 26, 2024

Hi Peter,
So sorry i was a bit busy, just tested it and its Absolutely Amazing, incredible work; thanks alot.

Was reading the guys responses, looks like most of the bugs are fixed; i am not having any bugs so far, didn't test the automation bug that @gregcsw mentioned will try it soon.

but i have a little issue; i have an automation that monitors the state of all my switches in case any of them went offline, and i noticed that the automation sends that the sonoff switches went offline "Unavailable" from time to time, but when i check on them they seem online; does the code lose connectivity or state tracking from time to time ?

again, thanks alot, this just saved me alot of work in my automations.

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@gregcsw i'll have to do some more testing on my side, just yesterday i've learned how to add a light to HA and even though it's similar to a switch it is a bit more complex

@max-rh thanks for follow up too! regarding the unavailable stuff, i'll prefer if we keep this in a separated thread. also i think it's better to start from scratch, use the latest code available and start reporting from there (i don't know if you used the polling version - that was more prone to errors - or websocket version)

from hass-sonoff-ewelink.

stephanerosi avatar stephanerosi commented on May 26, 2024

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@gregcsw regarding the mentioned problems above:

  1. i pushed an update regarding this but i have to admit, without a testing bulb i feel like i'm becoming the victim of my own creation :((. i did create a basic automation so that my dummy-test light to copy the state of another switch and it works on my side when I toggle the parent switch from inside HA or the mobile app
  2. i really don't know why this doesn't work - maybe the 1) fixed this too. have you tried to define the automation like here https://community.home-assistant.io/t/individual-brightness-in-automation/15105/2 ? again, i tried it on my side same setup as 1) and the brightness value changes accordingly and the request that changes the bulb is executed also
    ps: right now the brightness/color temp is not sent back from ewelink app to HA, i'm aware of this but i'm tired & hungry right now, will be fixed ;)

@stephanerosi

  1. i think the variation in the light are due to inconsistencies in the leds power, code-wise as you mentioned everything is linear (no testing device can't tell what's the output :P). right now i'm focused on having everything working as expected and then we'll work out the finishing touches later
  2. i literally have no idea what i'm sending here :)) i'm using a conversion function of values provided by HA on hoped for the best. just like 1) i will later send some instructions over on how to provided some needed data to sync them.
    ps: cannot access the files, can you make them public? or just post them somewhere else with a password, like https://send.firefox.com

global ps: i think i broke the compatibility with devices that have more outlets like sonoff ch4, soo until i can confirm it still works please do not use this branch for everyday use

from hass-sonoff-ewelink.

stephanerosi avatar stephanerosi commented on May 26, 2024

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@stephanerosi i got to look at the photos, nicely done πŸ‘ it really gives me a real life view of what's happening. what i can say right now is that i have no idea how to quickly fix the colour offset, as it implies some type of conversion from hue/saturation + offset to RGB and i must admit i'm not quite in the mood to figure it out right now πŸ˜… but for sure it'll be fixed!

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@stephanerosi i see that you're quite into helping soo regarding the rgb-offset problem do you think you can generate a more detailed debug log file for me?

here's what i need you to do:

  • download and install the latest master branch version, this will not have the sonoff b1 listed as a light (but as the old style as a switch, simply just ignore it for now)
  • in the project's documentation there's a new section regarding a new flag debug: True, read carefully the explanation and it'll be perfect if could use the shared sonoff device to a 2nd account setup.
  • after everything above is setup here comes the tricky part: i need you to execute an action on eWeLink app and right after that to take a screenshot of the colour represented on mobile app. it's very important that you execute 1 action and take 1 screenshot for it otherwise the log gets desynced. this way i will be able to match the expected colour with the data sent by mobile app and calculate the HA offset.

redo the same steps (a different log) for the brightness part on warm/cold lightning... if you want obviously!
thanks

from hass-sonoff-ewelink.

2016for avatar 2016for commented on May 26, 2024

from hass-sonoff-ewelink.

stephanerosi avatar stephanerosi commented on May 26, 2024

@peterbuga Yes, I will do it and send the log/pictures.

One question : I'm not sure I understand what the 2nd account is for. Is it to limit the debug output to the bulb only ?
Thanks

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

yes, limiting the log to only 1 device is one part of making the log lighter to read.

long story short-ish the 2nd account is to be able to control and query the device with HA and mobile application in the same time. due to a stupid limitation you can either connect to HA or to eWeLink app with the same account (you might've noticed that you need to login all the time into the app, that's because HA keep re-login in :P and kicking you out of the app, with shared devices you can be stay all the time logged in the app ;) )

from hass-sonoff-ewelink.

stephanerosi avatar stephanerosi commented on May 26, 2024

Ahah, I was wondering why the ewelink app was so buggy ;-)

Nevertheless, the following link contains the screenshots and the corresponding logs : https://drive.google.com/file/d/13UIm6bd4W6qdnXlAyCNGZzbJHCI9fpxQ/view?usp=drivesdk

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@stephanerosi the logs are good but you didn't follow the steps as I mentioned them :P it would've been much easier for you + a richer log i'm highly interested in the websocket messages sent back by coolkit servers to communicate with the app (might be my lack of properly explaining it, i'll try to make it somehow clear πŸ˜“) for the record I was talking about this part from documentation:

debug if enabled this will give you the ability to generate a log of messages from ewelink that can be easily posted here to debug/implement new devices. it works by creating a pseudo switch switch.sonoff_debug (notice it won't show up automatically in frontend in lovelace you have to manually add it or toggle it manually from Developer tools > Services section).
to generate a sonoff debug log toggle the pseudo-switch ON, the capture of messages starts in the background. now pick up the phone -> open eWeLink app and start changing settings of your Sonoff device but not faster than 10 seconds, when you finish, toggle the pseudo-switch OFF and a new (very long) persistent notification will show up, go to Developer tools > States section and look for a persistent_notification.notification entity (impossible to miss) and copy the message from there (to remove this notifications and others Dismiss them from main HA notifications area and you can restart the process if needed).
INFORMATION: it'll be better if you share the device-to-debugged to a 2nd eWeLink account and use this in HA and main one in mobile app
NOTICE: you should NOT leave debug-mode enabled for everyday use, please just please don't!

from hass-sonoff-ewelink.

stephanerosi avatar stephanerosi commented on May 26, 2024

@peterbuga My mistake, I wasn't the right debug section :-)
(I was reading the one in sonoff-debug...)

Here is the log :

------------COPY-FROM-HERE-------------- 2019-04-10 21:53:42.432 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926022755", "params": {"channel0": "0", "channel4": "0", "zyx_mode": 2, "channel1": "0", "channel3": "0", "channel2": "255", "type": "middle"}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"} 2019-04-10 21:53:57.022 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926037344", "params": {"channel0": "0", "channel4": "173", "channel1": "0", "channel3": "0", "channel2": "255", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"} 2019-04-10 21:54:10.953 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926051256", "params": {"channel0": "0", "channel4": "255", "channel1": "0", "channel3": "0", "channel2": "111", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"} 2019-04-10 21:54:12.026 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926052339", "params": {"channel0": "0", "channel4": "255", "channel1": "0", "channel3": "0", "channel2": "127", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"} 2019-04-10 21:54:28.330 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926068632", "params": {"channel0": "0", "channel4": "255", "channel1": "0", "channel3": "71", "channel2": "0", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"} 2019-04-10 21:54:40.620 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926080958", "params": {"channel0": "0", "channel4": "255", "channel1": "0", "channel3": "244", "channel2": "0", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"} 2019-04-10 21:54:55.059 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926095370", "params": {"channel0": "0", "channel4": "95", "channel1": "0", "channel3": "255", "channel2": "0", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"} 2019-04-10 21:55:07.596 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926107909", "params": {"channel0": "0", "channel4": "0", "channel1": "0", "channel3": "255", "channel2": "123", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"} 2019-04-10 21:55:18.846 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926119198", "params": {"channel0": "0", "channel4": "0", "channel1": "0", "channel3": "215", "channel2": "255", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"} 2019-04-10 21:55:33.356 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926133661", "params": {"channel0": "0", "channel4": "10", "channel1": "0", "channel3": "0", "channel2": "255", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"} ---------------END-OF-COPY----------------

Or via the states attributes

{
"title": "Sonoff debug",
"message": ".\n--------------COPY-FROM-HERE--------------\n\n2019-04-10 21:53:42.432 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926022755", "params": {"channel0": "0", "channel4": "0", "zyx_mode": 2, "channel1": "0", "channel3": "0", "channel2": "255", "type": "middle"}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"}\n\n2019-04-10 21:53:57.022 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926037344", "params": {"channel0": "0", "channel4": "173", "channel1": "0", "channel3": "0", "channel2": "255", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"}\n\n2019-04-10 21:54:10.953 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926051256", "params": {"channel0": "0", "channel4": "255", "channel1": "0", "channel3": "0", "channel2": "111", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"}\n\n2019-04-10 21:54:12.026 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926052339", "params": {"channel0": "0", "channel4": "255", "channel1": "0", "channel3": "0", "channel2": "127", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"}\n\n2019-04-10 21:54:28.330 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926068632", "params": {"channel0": "0", "channel4": "255", "channel1": "0", "channel3": "71", "channel2": "0", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"}\n\n2019-04-10 21:54:40.620 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926080958", "params": {"channel0": "0", "channel4": "255", "channel1": "0", "channel3": "244", "channel2": "0", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"}\n\n2019-04-10 21:54:55.059 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926095370", "params": {"channel0": "0", "channel4": "95", "channel1": "0", "channel3": "255", "channel2": "0", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"}\n\n2019-04-10 21:55:07.596 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926107909", "params": {"channel0": "0", "channel4": "0", "channel1": "0", "channel3": "255", "channel2": "123", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"}\n\n2019-04-10 21:55:18.846 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926119198", "params": {"channel0": "0", "channel4": "0", "channel1": "0", "channel3": "215", "channel2": "255", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"}\n\n2019-04-10 21:55:33.356 [W] {"action": "update", "ts": 0, "deviceid": "1000371541", "userAgent": "app", "sequence": "1554926133661", "params": {"channel0": "0", "channel4": "10", "channel1": "0", "channel3": "0", "channel2": "255", "zyx_mode": 2}, "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "tempRec": "1000371541"}\n\n---------------END-OF-COPY----------------"
}

And the screenshots
Screenshots.zip

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

Perfect, thanks! I'll take a swing to it these days, I'm curious to see if I can sort it out πŸ˜…

@gregcsw could you please retry to test the bugs you reported above on the #34 (comment) they should be fixed by now... should

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@gregcsw terrible sorry to hear that :( i was really hoping for a positive reply...

this will sound extremely stupid but have you updated component with the latest code from sonoff-bulb branch (i'm asking just to be sure)? i'm a bit confused of what might be actually happening, especially the automation-brightness part which should work just fine as long as the brightness-slider works on frontend (they literally execute the same instructions!).
i might be extremely wrong but it might be a super small possibility that something goes wrong on your side so i will wait out and see if anyone else is willing to do the same tests and confirm/deny the bugs, otherwise i'm pretty clueless of what's happening Β―\_(ツ)_/Β―

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

from hass-sonoff-ewelink.

stephanerosi avatar stephanerosi commented on May 26, 2024

@gregcsw
I haven't tried with color/brightness, but light.turn_on works for me in an automation, and HA status is updated as well.

from hass-sonoff-ewelink.

stephanerosi avatar stephanerosi commented on May 26, 2024

@gregcsw But I just tried with color, and I confirm the bug: the light turns on with the selected color, but it doesn't show up on HA.

Doesn't need to be inside an automation, it also happens if I use the service light.turn_on with color_name parameter.

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

some good news: i think i might've isolated the the problem! but then again i might not... it's a real challenge to debug it without a device πŸ™ˆ

can you please @stephanerosi @gregcsw post the EXACT settings you used above to do the tests?
i need the exact yaml entry in automation (just the light part not whole automation) and / or the json used in developer tools > service area that instructs the change of the light. you can obviously obfuscate the entity_id value, i'm not interested in that and let's hope it'll shed some light (pun intended :P) sorry to keep asking for tests/info but as I said above no device available

bad news: i started to completetly rewrite the whole component to hopefully make it compatible with the official HA rules 🀞 so if it this error cannot be fixed by this request i really don't know where more to debug :/

from hass-sonoff-ewelink.

stephanerosi avatar stephanerosi commented on May 26, 2024

Hi,

Here is what I do in services.

Works fine
Screenshot_20190414-093010~2

Turn the light on, but nothing in HA nor in ewelink app
Screenshot_20190414-093037~3

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

Here is the automation:

The light turns on to the specified color, but the brightness doesn't change, stays on the last set brightness in the ui. HA and Ewelink don't update the status of the entity.

  • id: '16'
    alias: Nursery Night Light Bed Time (Pink)
    initial_state: true
    trigger:
    platform: time
    at: '20:00:00'
    action:
    • service: light.turn_on
      data:
      entity_id: light.sonoff_1234567890
      rgb_color: [255,0,127]
      brightness: 125
      image

Also tested, If I turn the bulb on using the HA UI, and then turn the bulb off using an automation, the ui updates accordingly.

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

ok ok as a result of what seems to be a more than needed long thread i think i isolated the problem, but more than that the logic got a bit more complicated than i was expecting 😞!

@gregcsw your information confirms one of my findings: in the current code (to be fixed!) you cannot physically turn on the light with the automation pasted above. (if you try) you'll have to first basic light.turn_on the entity (no extra settings) and then progressively one by one send the rgb_color value followed by brightness (basically having 3x light.turn_on actions, with hopefully some delay between them). but don't update your automations just yet because it's a bug and it'll be fixed. the reason for this bug is that i believed HA is sending this information one-by-one too, not all at once...
also, i tend to believe that in example above you were trying to change the color from with previous warmcool mode + (possible)50% brightness to color mode + 100% brightness which accordingly to current buggy code should in: NOT updating the HA state, updating physical light to mentioned rgb_color and no brightness change + update to eWeLink app (not sure why this one doesn't happen, i suspect some new message-rules for this device vs. what i've been encountering so far)

@stephanerosi the 2nd not working example from you, it's more or less a subset-bug of what @gregcsw reported. right now, i sort of believe that the command should not turn on the physical light, but god knows what's happening on coolkit servers :|

ps: as a small reminder for the future, any color + brightness HA setting will be reseted to 100% brightness + chosen color if updated with eWeLink app. i might be able to stop this kind of reset but involves even more logic... argh (maybe one day if i secure enough funding to buy sonoff devices and test them myself πŸ˜… )

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

@gregcsw aaaaand i pushed another fix. I really hope it's among the last ones cuz' i'm really getting tired of this bug 😩
based on my (basic) tests you should be able to set all the light type (color/warmcool) + brightness in the same action entry just like you did before (no need for separate entries) but don't add in the same time color_name / rgb_color with color_temp as they are different settings (in theory i could light up all the LEDs but i'm not sure if itead allows this and i'm lazy to test it)

one other missing feature that i'm aware and i'm not going to add it now, is that color/brightness changes sourcing from eWeLink app won't update HA instantly, they will update in about <60sec when the fallback of polling completes

happy testing ;)!

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰
PERFECT THANK YOU!

It is working just as I want it to!

from hass-sonoff-ewelink.

peterbuga avatar peterbuga commented on May 26, 2024

hi @gregcsw @stephanerosi and everyone else,
any news/bugs related to this device and its implementation? if everything works decent-ish i would like to (finally) close this issue because it's getting too long already and open separated issues (like the color offset problem or maybe a transition service or whatever might be next) that are easier to maintain.

thanks!

from hass-sonoff-ewelink.

gregcsw avatar gregcsw commented on May 26, 2024

from hass-sonoff-ewelink.

stephanerosi avatar stephanerosi commented on May 26, 2024

Hello, yes, happy with it too :-)

from hass-sonoff-ewelink.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.