Kodi Community Forum

Full Version: YeeMee - (Control Yeelight Smart Bulb + Ambi from Kodi)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(2019-10-04, 17:58)DaLanik Wrote: [ -> ]
(2019-10-04, 01:41)wpbpete Wrote: [ -> ]I'm late to the party but anxious to get started. Does this work with the new V2 bulbs? Does it work with anything other than Yeelight? thx

Yes it does. Also lightstrip v1 and v2, v1 and v2 color bulbs, ceiling 650. And some functionality for ceiling lights 320/450/480, v1 and v2 white bulbs.... (no ambi ofcourse) Smile

First of all, I'd like to say that this add-on looks amazing and I hope to have it working at my home soon. The thing is, I haven't bought any bulbs yet because I'm not sure if the version 1S is going to work with your add-on. It's the newest Yeelight bulb with reduced power consumption. Could you please help me decide which version I should buy? Smile
(2020-01-09, 19:53)GhostCasper Wrote: [ -> ]
(2019-10-04, 17:58)DaLanik Wrote: [ -> ]
(2019-10-04, 01:41)wpbpete Wrote: [ -> ]I'm late to the party but anxious to get started. Does this work with the new V2 bulbs? Does it work with anything other than Yeelight? thx

Yes it does. Also lightstrip v1 and v2, v1 and v2 color bulbs, ceiling 650. And some functionality for ceiling lights 320/450/480, v1 and v2 white bulbs.... (no ambi ofcourse) Smile 

First of all, I'd like to say that this add-on looks amazing and I hope to have it working at my home soon. The thing is, I haven't bought any bulbs yet because I'm not sure if the version 1S is going to work with your add-on. It's the newest Yeelight bulb with reduced power consumption. Could you please help me decide which version I should buy? Smile 

I don't know since I don't have that bulb. But all those bulbs use same API, so it should work. And if it doesn't for some reason, I suppose it is not hard to add it, it would be due only to the bulb ID that needs to be added to the addon...
(2020-01-10, 09:35)DaLanik Wrote: [ -> ]
(2020-01-09, 19:53)GhostCasper Wrote: [ -> ]
(2019-10-04, 17:58)DaLanik Wrote: [ -> ]Yes it does. Also lightstrip v1 and v2, v1 and v2 color bulbs, ceiling 650. And some functionality for ceiling lights 320/450/480, v1 and v2 white bulbs.... (no ambi ofcourse) Smile 

First of all, I'd like to say that this add-on looks amazing and I hope to have it working at my home soon. The thing is, I haven't bought any bulbs yet because I'm not sure if the version 1S is going to work with your add-on. It's the newest Yeelight bulb with reduced power consumption. Could you please help me decide which version I should buy? Smile 

I don't know since I don't have that bulb. But all those bulbs use same API, so it should work. And if it doesn't for some reason, I suppose it is not hard to add it, it would be due only to the bulb ID that needs to be added to the addon...

Great, I've ordered 2 of them and will let you know if they work as soon as I receive them.
(2020-01-10, 09:35)DaLanik Wrote: [ -> ]
(2020-01-09, 19:53)GhostCasper Wrote: [ -> ]
(2019-10-04, 17:58)DaLanik Wrote: [ -> ]Yes it does. Also lightstrip v1 and v2, v1 and v2 color bulbs, ceiling 650. And some functionality for ceiling lights 320/450/480, v1 and v2 white bulbs.... (no ambi ofcourse) Smile 

First of all, I'd like to say that this add-on looks amazing and I hope to have it working at my home soon. The thing is, I haven't bought any bulbs yet because I'm not sure if the version 1S is going to work with your add-on. It's the newest Yeelight bulb with reduced power consumption. Could you please help me decide which version I should buy? Smile  

I don't know since I don't have that bulb. But all those bulbs use same API, so it should work. And if it doesn't for some reason, I suppose it is not hard to add it, it would be due only to the bulb ID that needs to be added to the addon... 
Hi, my 1S bulbs arrived today and I can confirm that they're working Smile The only problem I have is that I can't seem to find the option of returning to previous state when the video is stopped. It doesn't appear in settings. Could you help me with that somehow?
(2020-01-13, 12:35)GhostCasper Wrote: [ -> ]
(2020-01-10, 09:35)DaLanik Wrote: [ -> ]
(2020-01-09, 19:53)GhostCasper Wrote: [ -> ]First of all, I'd like to say that this add-on looks amazing and I hope to have it working at my home soon. The thing is, I haven't bought any bulbs yet because I'm not sure if the version 1S is going to work with your add-on. It's the newest Yeelight bulb with reduced power consumption. Could you please help me decide which version I should buy? Smile  

I don't know since I don't have that bulb. But all those bulbs use same API, so it should work. And if it doesn't for some reason, I suppose it is not hard to add it, it would be due only to the bulb ID that needs to be added to the addon...   
Hi, my 1S bulbs arrived today and I can confirm that they're working Smile The only problem I have is that I can't seem to find the option of returning to previous state when the video is stopped. It doesn't appear in settings. Could you help me with that somehow?  

You mean when it's used normally or as ambi-light?
(2020-01-13, 23:13)DaLanik Wrote: [ -> ]
(2020-01-13, 12:35)GhostCasper Wrote: [ -> ]
(2020-01-10, 09:35)DaLanik Wrote: [ -> ]I don't know since I don't have that bulb. But all those bulbs use same API, so it should work. And if it doesn't for some reason, I suppose it is not hard to add it, it would be due only to the bulb ID that needs to be added to the addon...   
Hi, my 1S bulbs arrived today and I can confirm that they're working Smile The only problem I have is that I can't seem to find the option of returning to previous state when the video is stopped. It doesn't appear in settings. Could you help me with that somehow?   

You mean when it's used normally or as ambi-light? 
When it's used normally, I don't use the ambient function. I wanted to set it in such way that the lights would turn off when the video is played and then would return to their previous setting (e.g. cold light, max. brightness or warm light, 50% brightness) when the video is stopped. If I understood your initial post correctly, it should be possible but there are only three settings in 'On video stop' submenu: 'On', 'Off', 'None'.
Can't test right now, but for stop there is also "Return to original state" action (I see it in settings)....
(2020-01-14, 20:01)DaLanik Wrote: [ -> ]Can't test right now, but for stop there is also "Return to original state" action (I see it in settings)....
That's weird, I'm using the latest version from your repo and it looks like this: https://youtu.be/9vytcLZ_QPo. It was recorded on my phone but the same thing happens on my PC.
:
            if ServiceOn:                                          # normal operation
                if x.stop_action == 3:
                    if x.initial_state == "off":
                        x.turnOff(player_state)
                    else:
                        x.turnOn(player_state)
                elif x.stop_action == 2:
                    x.turnOn(player_state)
                elif x.stop_action == 1:
                    x.turnOff(player_state)

:
            elif ServiceOn:                                        # normal operation
                if x.play_action == 2:
                    x.turnOn(player_state)
                elif x.play_action == 1:
                    x.turnOff(player_state)


Okay, so from a quick comparison between these pieces of code, I figured out that manually changing the
:
<setting id="bulb_1_stop_action">2</setting>
to
:
<setting id="bulb_1_stop_action">3</setting>
might help but unfortunately it didn't. After the change, settings show 'None' and testing the bulb confirms that it is also processed as set to 'None' because nothing happens :/
Found a fix! For some reason, this line 
Code:
<setting id="bulb_1_stop_action" type="enum" label="32041" lvalues="32080|32081|32082|32083" visible="gt(-3,0)" default="0" />
didn't contain the '|32083' part. After adding it, the option is visible. I've just checked your repo manually and it also doesn't contain this part (neither the regular, nor the test one), so I have no idea why it works for you and the others haha and it wasn't for me.

Unfortunately, the option doesn't work as I thought it would. Let's say I have my bulbs set to blue and I'm starting a movie, they switch off. Then after stopping the movie, the bulbs switch on and set themselves to values that I previously set for the 'On' option, not the blue color. Is this an intended behaviour and I misunderstood this 'Return to previous state' option or is it a bug (possibly having something to do with the fact that adding '|32083' isn't enough)?
(2020-01-14, 22:04)GhostCasper Wrote: [ -> ]Found a fix! For some reason, this line 
Code:
<setting id="bulb_1_stop_action" type="enum" label="32041" lvalues="32080|32081|32082|32083" visible="gt(-3,0)" default="0" />
didn't contain the '|32083' part. After adding it, the option is visible. I've just checked your repo manually and it also doesn't contain this part (neither the regular, nor the test one), so I have no idea why it works for you and the others haha and it wasn't for me.

Unfortunately, the option doesn't work as I thought it would. Let's say I have my bulbs set to blue and I'm starting a movie, they switch off. Then after stopping the movie, the bulbs switch on and set themselves to values that I previously set for the 'On' option, not the blue color. Is this an intended behaviour and I misunderstood this 'Return to previous state' option or is it a bug (possibly having something to do with the fact that adding '|32083' isn't enough)?

Yes, I just found it as well. It is error in config file Smile 32083 needs to be added....
I had a look at the source. It only checks to see if the bulb was on or off before the movie start, and then turns it on or off according to the last state....
(2020-01-14, 22:32)DaLanik Wrote: [ -> ]I had a look at the source. It only checks to see if the bulb was on or off before the movie start, and then turns it on or off according to the last state....
That's what I figured out from the source as well but I've just changed the color for 'stop' to #000000, so normally it would give me a disco mode, saved the settings, then switched the setting to 'Return to previous state', played a video - lights off, stopped the video - disco mode. I don't know how it's possible. Before starting the video the bulbs were set to normal day mode and after stopping it, they must've somehow pulled the 'On' setting and applied it...
(2020-01-14, 22:32)DaLanik Wrote: [ -> ]I had a look at the source. It only checks to see if the bulb was on or off before the movie start, and then turns it on or off according to the last state....
Look, I've never learnt Python and only have a little bit of experience with C and MATLAB but doesn't this part:
Code:
if x.stop_action == 3:
                    if x.initial_state == "off":
                        x.turnOff(player_state)
                    else:
                        x.turnOn(player_state)
elif x.stop_action == 2:
                    x.turnOn(player_state)
tell the program to use EXACTLY the same settings for: 1. returning to previous state IF the bulb was on before and 2. simply turning it on?
I think I figured it out. This part of code told me that it would be possible to just send a command to turn on the bulb without specifying color:
Code:
        if (self.model != "mono") and (self.model != "ceiling") and (self.model != "ct_bulb"):                          # color led
            if color != 0:                       # display single color, set scene
                message = {"id": 1, "method": "set_scene", "params": ["color", color, 1]}
                log = "YEEMEE >> " + str(self.bulb_ip) + ": (ON) SET SCENE (COLOR: " + str(hex(color)) + ") RESULT >> "
            else:                                # color is #000000 to display color flow, so just turn on the bulb for the time being
                message = {"id": 1, "method": "set_power", "params": ["on", effect, duration]}
                log = "YEEMEE >> " + str(self.bulb_ip) + ": (ON) POWER ON (COLOR - CF) RESULT >> "

            xbmc.sleep(300)
        else:                                     # mono led, just turn on (or color is 0 - color flow)
            message = {"id": 1, "method": "set_power", "params": ["on", effect, duration]}
            log = "YEEMEE >> " + str(self.bulb_ip) + ": (ON) POWER ON (MONO) RESULT >> "
So I set my bulbs as 'mono' and they partially return to the previous state. The color is correct but brightness still matches the one set for 'On' setting. For now, I can live with that but I'd really appreciate it if you could take a look at it Smile If not, I'll try to do it myself as a side project but only after my exam session Smile