Page 2 of 3

Re: New plugin : ESP8266 Milight Hub

Posted: Monday 06 May 2019 10:29
by poudenes
Hi There,

For all RGBW(W) lightning Limitless dzvent script options you must first switchOn() the bulb before you can do any set..... commands.
See below.

current support:

Code: Select all

domoticz.devices(BULB1).setRGB(125,125,125).afterSec(5)
domoticz.devices(BULB1).dimTo(50).afterSec(5)
Your plugin:

Code: Select all

domoticz.devices(BULB1).switchOn()
domoticz.devices(BULB1).setRGB(125,125,125).afterSec(5)
domoticz.devices(BULB1).dimTo(50).afterSec(5)
Problem is that when you want turn on a bulb and change color its not possible. in current The whole action is wait for 5 seconds then it turn the bulb on, then change the color, then dim to given brightness.

With your plugin you cant do this. You can turn on the bulb directly then wait 5 seconds turn set color and brightness. Add the ,afterSec() behind the switchOn() then bulb goes on after 5 seconds, but the set color and brightness have no effect anymore (maybe it send the command earlier then bulb is on)

Below I try to test all the set .... command in dzVents script system to see if they working with you plugin.

setRGB(red, green, blue) - Not working yet

RGB White color: - Not working yet, RGB (255,255,255) seems not work. The previous color is showing instead of white

setColor(r, g, b, br, cw, ww, m, t) - Working

setHex(r, g, b) - Working

setKelvin(Kelvin) - Working, remember that value must be between 0-100

setWhiteMode() - Not working yet, in progress with developer

setDisco - Working

setNightMode - Working

setHue - Working You need to provide hue (0-360) and brightness(0-100), setHue(300,10) makes the lamp dim pink

increaseBrightness / decreaseBrightness - Not working yet, in progress with developer

@dannybloe @waaren maybe you can assist this great programmer and maybe give some advice?

I don't know if this is good information for you ?

Re: New plugin : ESP8266 Milight Hub

Posted: Thursday 16 May 2019 10:34
by poudenes
@galinette you still there?

Re: New plugin : ESP8266 Milight Hub

Posted: Thursday 16 May 2019 23:42
by galinette
Hi, I'm there! I will investigate the dzVents commands, as I run stable domoticz these were not available when I developped the plugin. Now a new stable has been released, I will test.

Regarding the devices not updating when you send a lot of commands, I would really need to see the output of MQTT as I asked you in the previous post. This will hint where the problem is.

Thanks!

Re: New plugin : ESP8266 Milight Hub

Posted: Friday 17 May 2019 8:42
by poudenes
I will send you the results in PM because of limitation max characters of 60000

Re: New plugin : ESP8266 Milight Hub

Posted: Friday 17 May 2019 15:05
by MiloshCZ
Hi nice work, do you have Github repository? It is simplier to use git pull for install plugins.

Thanks

Re: New plugin : ESP8266 Milight Hub

Posted: Friday 17 May 2019 18:52
by galinette
Hi,

I just tested:
setKelvin : it works on my setup. Don't forget that the value is not actual Kelvin, but 0-100
setHue : it works on my setup. You need to provide hue (0-360) and brightness(0-100)
Example : setHue(300,10) makes the lamp dim pink

setRGB : it seems to work. But maybe this depends on the bulb type

setWhite : the command is not implemented. Will do...

increaseBrightness / decreaseBrightness : the command is not implemented. Will do...

Re: New plugin : ESP8266 Milight Hub

Posted: Friday 17 May 2019 18:54
by galinette
Il will do a git repo. I did not know that you could get domoticz plugin directly from git. Is there a documentation somewhere about the proper format so that domoticz downloads the plugins properly?

Re: New plugin : ESP8266 Milight Hub

Posted: Friday 17 May 2019 19:09
by poudenes
Ahh great to see your tests. A idea to make the values like how standart will be?


Verzonden vanaf mijn iPhone met Tapatalk Pro

Re: New plugin : ESP8266 Milight Hub

Posted: Friday 17 May 2019 19:29
by galinette
poudenes wrote: Friday 17 May 2019 19:09A idea to make the values like how standart will be?
What do you mean?

All the functions are implemented now, I will make a git repo to post the new version

Re: New plugin : ESP8266 Milight Hub

Posted: Friday 17 May 2019 20:47
by poudenes
Maybe its nicer and easier to have Kelvin in value like this : 2700-6500
The group All is still in process? No new updates?

Can't wait to test the new version tomorrow!!!
Will you post the git link here on first post?


Verzonden vanaf mijn iPhone met Tapatalk Pro

Re: New plugin : ESP8266 Milight Hub

Posted: Saturday 18 May 2019 15:21
by galinette
Making the dzVents function work with real kelvin is not something a plugin can do, the plugin doesn't even now dzVents exists. It only respond to API commands. So making setKelvin() work with actual kelvin values is up to the dzVents developpers.

I have put the plugin in a github repo : https://github.com/galinette2000/espmilighthub-domoticz

Version 0.0.7 is out, it fixes most dzVents commands.

Re: New plugin : ESP8266 Milight Hub

Posted: Saturday 18 May 2019 15:27
by poudenes
galinette wrote: Saturday 18 May 2019 15:21 Making the dzVents function work with real kelvin is not something a plugin can do, the plugin doesn't even now dzVents exists. It only respond to API commands. So making setKelvin() work with actual kelvin values is up to the dzVents developpers.

I have put the plugin in a github repo : https://github.com/galinette2000/espmilighthub-domoticz

Version 0.0.7 is out, it fixes most dzVents commands.
Clear :)

Any news about the Group All option?

Go download the new version and do my tests :D

Did you saw my debug info ? Send them to you in PM

Re: New plugin : ESP8266 Milight Hub

Posted: Monday 20 May 2019 11:54
by poudenes
galinette wrote: Friday 17 May 2019 18:52 setRGB : it seems to work. But maybe this depends on the bulb type
The white part is not working, will you test this as well? I current plugin it is working.
On other hand, when setWhite is working then this is not needed, but RGB code: 255.255.255 is a RGB color. :)

I have update my list on previous post, what work and what won't work

Will you add code that it will always turn on the Bulb before you do on e of the set command in dzvents?
Less code in scripts :)

Re: New plugin : ESP8266 Milight Hub

Posted: Tuesday 21 May 2019 16:31
by poudenes
Hi There,

Edit: 23-05-2019:
When I use setColor(r,g,b,br) then it is working PERFECT also with afterSec() !! So its a different way of handeling RGB include Brightness option.
Would be nice to see that script is turning on the bulb by itself without doing this in script (domoticz.devices(BulbDressoir1).switchOn()

Original Post:
Some combinations are not working. Also in current working code in Domoticz. The switchOn() is not needed. It turn bulb already on then actions.

Code: Select all

local Version = '19.05.02'
return {
    active = true,
    on = {
    devices = {28},
    },
    execute = function(domoticz, device)

    if (domoticz.devices(28).active) then

        domoticz.devices(BulbDressoir1).switchOn().afterSec(4)
        domoticz.devices(BulbDressoir1).setRGB(255,50,1).afterSec(4)
        domoticz.devices(BulbDressoir1).dimTo(5).afterSec(4)
        
        domoticz.devices(BulbDressoir2).switchOn().afterSec(0)
        domoticz.devices(BulbDressoir2).setRGB(255,50,1).afterSec(0)
        domoticz.devices(BulbDressoir2).dimTo(100).afterSec(0)
        
        domoticz.devices(BulbDressoir3).switchOn().afterSec(2)
        domoticz.devices(BulbDressoir3).setRGB(255,50,1).afterSec(2)
        domoticz.devices(BulbDressoir3).dimTo(50).afterSec(2)

    elseif (not domoticz.devices(28).active) then

        domoticz.devices(BulbDressoir1).switchOff()
        domoticz.devices(BulbDressoir2).switchOff()
        domoticz.devices(BulbDressoir3).switchOff()
        
    end
end
}
swtichOn() the bulb
setRGB() the color
dimTo() to select right brightness

This is not working, it skip the setRGB part. In current code in Domoticz this is working. I use it in global_data file

Code: Select all

BulbDressoir1         = 1
BulbDressoir2           = 2 
BulbDressoir3           = 3 

local COLORS = {
                ['White']       = {255,255,255},
                ['Red']         = {255,50,1},
                ['Blue']        = {0, 33, 255},
                ['Leeg']        = {0,0,0}
            }
            
return {
    helpers = {
-- setRGB(r, g, b, br, sec)        
        RGB = function(domoticz,idx,color,dim,sec)
             if (color == nil)   then rgb = COLORS['White']  else rgb = COLORS[color] end
             if (dim == nil)     then dim = 100 end
            if (sec == nil)     then sec = 0 end
            domoticz.devices(idx).switchOn().afterSec(sec)
            domoticz.devices(idx).setRGB(rgb[1], rgb[2], rgb[3]).afterSec(sec)
            domoticz.devices(idx).dimTo(dim).afterSec(sec)
        end
    }
}
Then my normal dzVent script look like this:

Code: Select all

local Version = '19.05.02'
return {
    active = true,
    on = {
    devices = {28},
    },
    execute = function(domoticz, device)

    if (domoticz.devices(28).active) then
        
        domoticz.helpers.RGB(domoticz,BulbDressoir1,'Red',5,4)
        domoticz.helpers.RGB(domoticz,BulbDressoir2,'Red',100,nil)
        domoticz.helpers.RGB(domoticz,BulbDressoir3,'Red',50,2)

    elseif (not domoticz.devices(28).active) then

        domoticz.devices(BulbDressoir1).switchOff()
        domoticz.devices(BulbDressoir2).switchOff()
        domoticz.devices(BulbDressoir3).switchOff()
        
    end
end
}

Re: New plugin : ESP8266 Milight Hub

Posted: Wednesday 19 June 2019 12:45
by poudenes
Test a lot with the plugin and everything is working correct. When you have some issues maybe I can help you also.
For me the challenge was how to solve RGB colours (No white) and White. Because RGB cant set always white then you need the kelvin option.

Here how I did it. Remember I use global_data for some returning script lines:

in the global_data file:

Code: Select all

local COLORS = {
                ['White']       = {255,225,255},
                ['Red']         = {255,0,0},
                ['Green']       = {0,255,0},
                ['Blue']        = {0,0,255},
                
                ['Orange']      = {255,127,0},
                ['Yellow']      = {255,255,0},
                ['Purple']      = {145,0,255},
                ['LightGreen']  = {191,255,114},
                ['Romantic']    = {128,0,1}
            }
            
        RGB = function(domoticz,idx,dim,color,sec)
            if (color == nil)   then rgb = COLORS['Red']  else rgb = COLORS[color] end
            if (dim == nil)     then dim = 100 end
            if (sec == nil)     then sec = 0 end
            domoticz.devices(idx).switchOn().checkFirst().afterSec(sec)
            domoticz.devices(idx).setColor(rgb[1], rgb[2], rgb[3],dim,0,0,3,0).afterSec(sec)
            status = 'aangezet'
            movement = 'beweging gedecteerd'
        end,
        
        KELVIN = function(domoticz,idx,dim,kelvin,sec)
            if (dim == nil)     then dim = 100 end
            if (kelvin == nil)  then kelvin = 255 end
            if (sec == nil)     then sec = 0 end
            domoticz.devices(idx).switchOn().checkFirst().afterSec(sec)
            domoticz.devices(idx).setColor(0,0,0,dim,0,0,2,kelvin).afterSec(sec)
            status = 'aangezet'
            movement = 'beweging gedecteerd'
        end,
In dzVent system you can use

Code: Select all

domoticz.helpers.KELVIN(domoticz,BulbLivingroomAll,nil,255,nil)
domoticz.helpers.RGB(domoticz,BulbDressoirAll,75,'Blue',nil)
or when you not use it:

RGB:

Code: Select all

domoticz.devices(idx).setColor(200, 123, 12,100,0,0,3,0)
- RGB1,RGB2,RGB3,BRIGHTNESS, 0,0,3,0

RGB1,RGB2,RGB3 is RGB color code

KELVIN:

Code: Select all

domoticz.devices(idx).setColor(0,0,0,100,0,0,2,255)
- 0,0,0,BRIGHTNESS,0,0,2,KELVINLEVEL

KELVINLEVEL is from 0-255

Re: New plugin : ESP8266 Milight Hub

Posted: Tuesday 30 July 2019 11:32
by Pandabeer
Hi Galinette,

Thanks for the great work you did - I cann't figure out how to add my MiLights - can you help me a bit?

I installed Mosquitto - running on latest betà of Domoticz - no errors in Log - but I cann't find the lightbulbs I have in my wireless network (standard LimmetesLed plugin works well!) Also other hardware is automaticly added - can you give me a hint?

Code: Select all

2019-07-30 11:25:41.318 (MiLight Hub) 'HardwareID':'7'
2019-07-30 11:25:41.318 (MiLight Hub) 'HomeFolder':'/home/pi/domoticz/plugins/espmilighthub/'
2019-07-30 11:25:41.318 (MiLight Hub) 'StartupFolder':'/home/pi/domoticz/'
2019-07-30 11:25:41.318 (MiLight Hub) 'UserDataFolder':'/home/pi/domoticz/'
2019-07-30 11:25:41.318 (MiLight Hub) 'Database':'/home/pi/domoticz/domoticz.db'
2019-07-30 11:25:41.318 (MiLight Hub) 'Language':'nl'
2019-07-30 11:25:41.318 (MiLight Hub) 'Version':'0.0.7'
2019-07-30 11:25:41.318 (MiLight Hub) 'Name':'MiLight Hub'
2019-07-30 11:25:41.318 (MiLight Hub) 'Address':'127.0.0.1'
2019-07-30 11:25:41.318 (MiLight Hub) 'Port':'1883'
2019-07-30 11:25:41.318 (MiLight Hub) 'Key':'MilightESP8266'
2019-07-30 11:25:41.318 (MiLight Hub) 'Mode2':'milight/:device_id/:device_type/:group_id'
2019-07-30 11:25:41.318 (MiLight Hub) 'Mode3':'milight/states/:device_id/:device_type/:group_id'
2019-07-30 11:25:41.318 (MiLight Hub) 'Mode6':'Normal'
2019-07-30 11:25:41.318 (MiLight Hub) 'DomoticzVersion':'4.11062'
2019-07-30 11:25:41.318 (MiLight Hub) 'DomoticzHash':'77d4961e5'
2019-07-30 11:25:41.318 (MiLight Hub) 'DomoticzBuildTime':'2019-07-29 12:39:01'
2019-07-30 11:25:41.318 (MiLight Hub) Device count: 0
2019-07-30 11:25:41.318 (MiLight Hub) Plugin options: {'addDiscoveredDeviceUsed': True}
2019-07-30 11:25:41.369 (MiLight Hub) Successful connect to: 127.0.0.1:1883
2019-07-30 11:25:41.369 (MiLight Hub) MQTT CONNECT ID: 'Domoticz_MilightESP8266_7_1564478741'
2019-07-30 11:25:41.068 Status: (MiLight Hub) Started.
2019-07-30 11:25:41.317 Status: (MiLight Hub) Entering work loop.
2019-07-30 11:25:41.317 Status: (MiLight Hub) Initialized version 0.0.7

Re: New plugin : ESP8266 Milight Hub

Posted: Tuesday 30 July 2019 16:54
by Pandabeer
Pandabeer wrote: Tuesday 30 July 2019 11:32 Hi Galinette,

Thanks for the great work you did - I cann't figure out how to add my MiLights - can you help me a bit?

I installed Mosquitto - running on latest betà of Domoticz - no errors in Log - but I cann't find the lightbulbs I have in my wireless network (standard LimmetesLed plugin works well!) Also other hardware is automaticly added - can you give me a hint?

Code: Select all

2019-07-30 11:25:41.318 (MiLight Hub) 'HardwareID':'7'
2019-07-30 11:25:41.318 (MiLight Hub) 'HomeFolder':'/home/pi/domoticz/plugins/espmilighthub/'
2019-07-30 11:25:41.318 (MiLight Hub) 'StartupFolder':'/home/pi/domoticz/'
2019-07-30 11:25:41.318 (MiLight Hub) 'UserDataFolder':'/home/pi/domoticz/'
2019-07-30 11:25:41.318 (MiLight Hub) 'Database':'/home/pi/domoticz/domoticz.db'
2019-07-30 11:25:41.318 (MiLight Hub) 'Language':'nl'
2019-07-30 11:25:41.318 (MiLight Hub) 'Version':'0.0.7'
2019-07-30 11:25:41.318 (MiLight Hub) 'Name':'MiLight Hub'
2019-07-30 11:25:41.318 (MiLight Hub) 'Address':'127.0.0.1'
2019-07-30 11:25:41.318 (MiLight Hub) 'Port':'1883'
2019-07-30 11:25:41.318 (MiLight Hub) 'Key':'MilightESP8266'
2019-07-30 11:25:41.318 (MiLight Hub) 'Mode2':'milight/:device_id/:device_type/:group_id'
2019-07-30 11:25:41.318 (MiLight Hub) 'Mode3':'milight/states/:device_id/:device_type/:group_id'
2019-07-30 11:25:41.318 (MiLight Hub) 'Mode6':'Normal'
2019-07-30 11:25:41.318 (MiLight Hub) 'DomoticzVersion':'4.11062'
2019-07-30 11:25:41.318 (MiLight Hub) 'DomoticzHash':'77d4961e5'
2019-07-30 11:25:41.318 (MiLight Hub) 'DomoticzBuildTime':'2019-07-29 12:39:01'
2019-07-30 11:25:41.318 (MiLight Hub) Device count: 0
2019-07-30 11:25:41.318 (MiLight Hub) Plugin options: {'addDiscoveredDeviceUsed': True}
2019-07-30 11:25:41.369 (MiLight Hub) Successful connect to: 127.0.0.1:1883
2019-07-30 11:25:41.369 (MiLight Hub) MQTT CONNECT ID: 'Domoticz_MilightESP8266_7_1564478741'
2019-07-30 11:25:41.068 Status: (MiLight Hub) Started.
2019-07-30 11:25:41.317 Status: (MiLight Hub) Entering work loop.
2019-07-30 11:25:41.317 Status: (MiLight Hub) Initialized version 0.0.7
Sorry - I see probably what the problem is.... I don't have the ESP8266 Milight hub :oops: - How will I get one of those hubs?

Re: New plugin : ESP8266 Milight Hub

Posted: Tuesday 30 July 2019 17:55
by poudenes
Pandabeer wrote: Tuesday 30 July 2019 16:54 Sorry - I see probably what the problem is.... I don't have the ESP8266 Milight hub :oops: - How will I get one of those hubs?
Hardware:
https://blog.christophermullins.com/201 ... n-esp8266/

ESP Firmware:
https://github.com/sidoh/esp8266_milight_hub

Re: New plugin : ESP8266 Milight Hub

Posted: Thursday 12 September 2019 7:38
by CV8R
Hi @galinette,

Thank you for your plugin!

I set it up today and everything went reasonably smooth apart from a caching issue in Mosquito causing me grief when i deleted some of the added lamp devices in Domoticz. Deleted lamps kept re-appearing, deleting them in Domoticz and the Mosquitto cache fixed that.

I have run into one issue with RGB+CCT FUT013 globes. The globes are discovered as RGBWW in Domoticz as they where when using the Milight iBox v2 and when in RGB mode the globes respond as expected.

However, when using them in white (Kelvin) mode the color temp doesn't work as expected. When a setting is made, the color temp is set and then jumps to the last mode set via the ESP Hub's webpage. Note, via the ESP Hub's webpage the Kelvin and RGB respond as expected.

Here is a Domoticz log showing the single change, then the responses from the lamp.

2019-09-12 15:17:00.745 (ESP8266 Milight Hub) 001/Jaden's Bedside Lamp: Command: 'Set Color', Level: 79, Color:{"b":0,"cw":23,"g":0,"m":2,"r":0,"t":232,"ww":232}
2019-09-12 15:17:00.998 (ESP8266 Milight Hub) 001/Jaden's Bedside Lamp: State change: '{'state': 'ON', 'brightness': 201, 'color_temp': 348, 'bulb_mode': 'white', 'color': {'r': 255, 'g': 255, 'b': 255}}
2019-09-12 15:17:03.575 (ESP8266 Milight Hub) 001/Jaden's Bedside Lamp: State change: '{'state': 'ON', 'brightness': 201, 'color_temp': 348, 'bulb_mode': 'white', 'color': {'r': 255, 'g': 255, 'b': 255}}
2019-09-12 15:17:06.093 (ESP8266 Milight Hub) 001/Jaden's Bedside Lamp: State change: '{'state': 'ON', 'brightness': 201, 'color_temp': 355, 'bulb_mode': 'white', 'color': {'r': 255, 'g': 255, 'b': 255}}

Do you have any ideas on what could be going on?

Thanks
CV8R

Re: New plugin : ESP8266 Milight Hub

Posted: Wednesday 09 October 2019 8:22
by rensbr
Hi @galinette,

Thank your for creating this awesome plugin, it works a lot better then the UDP method.

But I also have a problem with RGB=CCT bulbs, like @CV8R. When I'm setting a warm white color, the bulb flashed to warm white, and immediately after that it switches back to cold white.

Do you have any ideas on what the problem might be?