EspMilightHub new binding for milight limitlessLED and easybulb

Never had that problem with the open source hub and this binding. It uses mqtt which is known for being robust on bad networks.

It it very easy to program and you do not need to solder. Read the blog on how to setup the hardware hub.

hi, fightting with Milight RGBW to switch to white in rules. Using text files config.

I tried add RGBW_WHITEMODE_SAT_THRESHOLD=12 and send command

Bulb_hue.sendCommand(ā€œ12,0,100ā€) - it makes some mix white color (hue is colour channel)

I tried set hue to 36 or sat to 32 as i see in PaperUI EspMilightHub detail

Bulb_hue.sendCommand(ā€œ36,0,100ā€)
Bulb_hue.sendCommand(ā€œ100,32,100ā€) - again make some color but not white (hue is colour channel)

So what I am doing wrong? It would be too much create command and send command channel for each bulb and set white over set_white cmd ā€¦

Btw I dont understant this:

When i open milightESP bridge in PaperUI for editing, I dont see this constants and description. Just some other parameters like ā€œThe HUE value that Google home or Echo can use to turn globes back to true white.ā€ but not parameters added over think file ā€¦

FAVOURITE_WHITE
DELAY_BETWEEN_MQTT
DELAY_BETWEEN_SAME_GLOBE
TRIGGER_WHITE_SAT
TRIGGER_WHITE_HUE
DEFAULT_COMMAND
1TRIGGERS_NIGHT_MODE
RGBW_WHITEMODE_SAT_THRESHOLD
POWERFAILS_TO_MINDIM
AUTOCTEMP_MAXDIMMED_TEMPERATURE

By looking in PaperUI at your bridge (click on the pencil icon) you will get descriptions on what these do and what valid ranges are. If you use manual text configuration you can not change them in paperUI otherwise you get a conflict message in paperUI.

Thnx

@CoolTom

The saturation is the middle number in Openhabs HSB and try 1 value under the threshold. Try this for example. Note this only works for RGBW globes and not the newer rgb-cct types.

Bulb_hue.sendCommand("40,11,100") 

If you try and trigger the google home method to switch to white try this command. This should work for newer and older globes.

Bulb_hue.sendCommand("36,32,100")

You donā€™t need to create both a select command control and a send command control if you globally change the binding to send the white mode using the DEFAULT_COMMAND control. You would only need to then create a single button and bind it to the send command channel as it would then send the white command by default. By default the night mode command is sent.

Thank you Matt! I endup with adding channel ā€œcolourtemperatureā€ in espmilighthub.items for all bulbs (same like add one channel ā€œsendbulbcommandā€) and I send any number between 1-100 (as they are RGBW - it will be still same cold white).

espmilighthub.items

Dimmer Bulb_wt "bulb 01 WT" <light> {channel="espmilighthub:rgb_cct:001:0xXXXXY:colourtemperature"}

*.rules

Bulb_wt.sendCommand("100") - wt is colourtemperature channel

And it works.

Thank you

Can anyone please either show me som example on how to turn Milight RGBW bulb
to all white agin after colour ,please show some ithems and sitemaps so i can make it
work ,i am no coder ,but i have o/off and colour working in my 3 kids rooms thats nice , mabye show the disco mode rule,sitemap and item please so we dont have to use the remote to turn on
modes and to white agin

lots of exampels to us none coders helps a lot , thanks a lot :wink:

See the last few posts and that is exactly what they were about. For examples on sitemap and item setup see the very first two posts of this thread. All you are wanting to do is pretty simple, just see what channel/control needs to move to achieve your result and then use the item.sendCommand() in a rule to automate the control.

I need to transfer all the info from the first two posts and other info into a readme file for the github project, if anyone has time and can do this and do a PR that would be great and I will proof read it. After doing the readme and adding some further examples I will look at adding this binding to the marketplace.

1 Like

I will give it a go this week

1 Like

Hello,

This is probably a stupid question (iā€™m a complete noob) but if it isnā€™t nessecairy to install a seperate mqtt binding in openhab because the new milight binding uses paho library, where can i configure the mqtt broker? My problem is openhab will not connect to broker.

Thanks

If you are using linux or openhabian, google mosquitto and how to set it up. A broker must be installed somewhere reachable on your network for this binding to work and you MUST also have built the opensource hub to replace your milight hub with. Sorry I do not support people on how to install and setup brokers, use google to learn what one is and how to setup.

Thanks matt1,

I installed mosquitto and now everything works. Guess i was a little confuised because it said it was not nessecairy to install seperate MQTT binding in paperUI with the new binding. I probably misunderstood (total noob:grinning:)). Thanks for the speedy reply and thanks again for all the great work you are doing to make it possible for noobs like me to get this all working.

Hello, I got this great binding up and running but I still think iā€™m doing something wrong. I can turn on/off individual zones and even the status updates in openhab when i operate the zones by the remote. same if i turn on/off all zones by group0. Now here comes my problem, when i turn on all zones with group0 the state of group 1-4 doesnt get updated in openhab. Can someone tell me what iā€™m doing wrong?

.things

        //----------------//
        //     Living     //
        //----------------//
        //ZONE0
        Thing   rgb_cct 0x55440         "Living spots"  	        //Living spots all
        //ZONE1
        Thing   rgb_cct 0x55441         "Living spots LV"  	        //Living spots front left
        //ZONE2
        Thing   rgb_cct 0x55442         "Living spots RV"  	        //Living spots front right
        //ZONE3
        Thing   rgb_cct 0x55443         "Living spots LA"  	        //Living spots rear left
        //ZONE4
        Thing   rgb_cct 0x55444         "Living spots RA"  	        //Living spots rear right

.items

//----------------//
//     Living     //
//----------------//
//ZONE0
Switch Milight_ID0x5544_G0_State        "Alles aan/uit"                 (milight_Living)            {channel="espmilighthub:rgb_cct:001:0x55440:level"}
//ZONE1
Switch Milight_ID0x5544_G1_State        "Spots LV aan/uit"              (milight_Living_LV)         {channel="espmilighthub:rgb_cct:001:0x55441:level"}
Dimmer Milight_ID0x5544_G1_Level        "Spots LV helderheid"           (milight_Living_LV)         {channel="espmilighthub:rgb_cct:001:0x55441:level"}
Dimmer Milight_ID0x5544_G1_CTemp        "Spots LV kleur temp"           (milight_Living_LV)         {channel="espmilighthub:rgb_cct:001:0x55441:colourtemperature"}
Color  Milight_ID0x5544_G1_Hue          "Spots LV kleur"                (milight_Living_LV)         {channel="espmilighthub:rgb_cct:001:0x55441:colour"}
String Milight_ID0x5544_G1_Cmd 	        "Spots LV Command to Send"      (milight_Living_LV)         {channel="espmilighthub:rgb_cct:001:0x55441:bulbcommand"}
Switch Milight_ID0x5544_G1_SndCmd       "Spots LV Send Command" 		(milight_Living_LV)         {channel="espmilighthub:rgb_cct:001:0x55441:sendbulbcommand"}
//ZONE2
Switch Milight_ID0x5544_G2_State        "Spots RV aan/uit "             (milight_Living_RV)         {channel="espmilighthub:rgb_cct:001:0x55442:level"}
Dimmer Milight_ID0x5544_G2_Level        "Spots RV helderheid"           (milight_Living_RV)         {channel="espmilighthub:rgb_cct:001:0x55442:level"}
Dimmer Milight_ID0x5544_G2_CTemp        "Spots RV wit kleur temp"       (milight_Living_RV)         {channel="espmilighthub:rgb_cct:001:0x55442:colourtemperature"}
Color  Milight_ID0x5544_G2_Hue          "Spots RV kleur"                (milight_Living_RV)         {channel="espmilighthub:rgb_cct:001:0x55442:colour"}
String Milight_ID0x5544_G2_Cmd 	        "Spots RV Command to Send"      (milight_Living_RV)         {channel="espmilighthub:rgb_cct:001:0x55442:bulbcommand"}
Switch Milight_ID0x5544_G2_SndCmd       "Spots RV Send Command" 		(milight_Living_RV)         {channel="espmilighthub:rgb_cct:001:0x55442:sendbulbcommand"}
//ZONE3
Switch Milight_ID0x5544_G3_State        "Spots LA aan/uit"              (milight_Living_LA)         {channel="espmilighthub:rgb_cct:001:0x55443:level"}
Dimmer Milight_ID0x5544_G3_Level        "Spots LA helderheid"           (milight_Living_LA)         {channel="espmilighthub:rgb_cct:001:0x55443:level"}
Dimmer Milight_ID0x5544_G3_CTemp        "Spots LA wit kleur temp"       (milight_Living_LA)         {channel="espmilighthub:rgb_cct:001:0x55443:colourtemperature"}
Color  Milight_ID0x5544_G3_Hue          "Spots LA kleur"                (milight_Living_LA)         {channel="espmilighthub:rgb_cct:001:0x55443:colour"}
String Milight_ID0x5544_G3_Cmd 	        "Spots LA Command to Send"      (milight_Living_LA)         {channel="espmilighthub:rgb_cct:001:0x55443:bulbcommand"}
Switch Milight_ID0x5544_G3_SndCmd       "Spots LA Send Command" 		(milight_Living_LA)         {channel="espmilighthub:rgb_cct:001:0x55443:sendbulbcommand"}
//ZONE4
Switch Milight_ID0x5544_G4_State        "Spots RA aan/uit"              (milight_Living_RA)         {channel="espmilighthub:rgb_cct:001:0x55444:level"}
Dimmer Milight_ID0x5544_G4_Level        "Spots RA helderheid"           (milight_Living_RA)         {channel="espmilighthub:rgb_cct:001:0x55444:level"}
Dimmer Milight_ID0x5544_G4_CTemp        "Spots RA wit kleur temp"       (milight_Living_RA)         {channel="espmilighthub:rgb_cct:001:0x55444:colourtemperature"}
Color  Milight_ID0x5544_G4_Hue          "Spots RA kleur"                (milight_Living_RA)         {channel="espmilighthub:rgb_cct:001:0x55444:colour"}
String Milight_ID0x5544_G4_Cmd 	        "Spots RA Command to Send"      (milight_Living_RA)         {channel="espmilighthub:rgb_cct:001:0x55444:bulbcommand"}
Switch Milight_ID0x5544_G4_SndCmd       "Spots RA Send Command" 		(milight_Living_RA)         {channel="espmilighthub:rgb_cct:001:0x55444:sendbulbcommand"}

.rules

//----------------//
//     Living     //
//----------------//
//ZONE0
// Rule for updating controls in Openhab when a milight remote is used //
// Only use postUpdate in here to prevent Openhab sending a command in response and causing pot. feedback//
rule "Milight_ID0x5544_G0_HubStates"
  when
	Item Milight_ID0x5544_G0_EspMilightHub changed
  then
	var sJSONBLOB = Milight_ID0x5544_G0_EspMilightHub.state.toString
	var sMODE =	transform("JSONPATH","$.bulb_mode", sJSONBLOB)
	var sSTATE=	transform("JSONPATH","$.state", sJSONBLOB)
	var sLEVEL=	transform("JSONPATH","$.level", sJSONBLOB)
	var Number iLEVEL= Integer::parseInt(sLEVEL).intValue //convert the string to an int.
	
	if(Milight_ID0x5544_G0_State.state!=sSTATE)
	Milight_ID0x5544_G0_State.postUpdate(sSTATE)
	
	if(sMODE=="white") // Code to handle a white JSON blob
	{
		var sCTEMP=transform("JSONPATH","$.color_temp", sJSONBLOB)
		var iTempScaled=(((Integer::parseInt(sCTEMP)/2.17)-171)*-1).intValue //Dirty but seems to work. Converts string to int and scale range.
		Milight_ID0x5544_G0_CTemp.postUpdate(iTempScaled) //send CT to globe
		Milight_ID0x5544_G0_Brightness.postUpdate(iLEVEL) //send new brightness to globe
	}
	
	else if(sMODE=="color") // Code to handle a colour JSON blob
	{		
		var String sHUE			= transform("JSONPATH","$.hue", sJSONBLOB)
		var String sSATURATION	= transform("JSONPATH","$.saturation", sJSONBLOB)
		Milight_ID0x5544_G0_Brightness.postUpdate(iLEVEL) 	//update main dimmer item
		Milight_ID0x5544_G0_Hue.postUpdate(sHUE+","+sSATURATION+","+sLEVEL)		//update color item      
	}
end

//ZONE1
// Rule for updating controls in Openhab when a milight remote is used //
// Only use postUpdate in here to prevent Openhab sending a command in response and causing pot. feedback//
rule "Milight_ID0x5544_G1_HubStates"
  when
	Item Milight_ID0x5544_G1_EspMilightHub changed
  then
	var sJSONBLOB = Milight_ID0x5544_G1_EspMilightHub.state.toString
	var sMODE =	transform("JSONPATH","$.bulb_mode", sJSONBLOB)
	var sSTATE=	transform("JSONPATH","$.state", sJSONBLOB)
	var sLEVEL=	transform("JSONPATH","$.level", sJSONBLOB)
	var Number iLEVEL= Integer::parseInt(sLEVEL).intValue //convert the string to an int.
	
	if(Milight_ID0x5544_G1_State.state!=sSTATE)
	Milight_ID0x5544_G1_State.postUpdate(sSTATE)
	
	if(sMODE=="white") // Code to handle a white JSON blob
	{
		var sCTEMP=transform("JSONPATH","$.color_temp", sJSONBLOB)
		var iTempScaled=(((Integer::parseInt(sCTEMP)/2.17)-171)*-1).intValue //Dirty but seems to work. Converts string to int and scale range.
		Milight_ID0x5544_G1_CTemp.postUpdate(iTempScaled) //send CT to globe
		Milight_ID0x5544_G1_Brightness.postUpdate(iLEVEL) //send new brightness to globe
	}
	
	else if(sMODE=="color") // Code to handle a colour JSON blob
	{		
		var String sHUE			= transform("JSONPATH","$.hue", sJSONBLOB)
		var String sSATURATION	= transform("JSONPATH","$.saturation", sJSONBLOB)
		Milight_ID0x5544_G1_Brightness.postUpdate(iLEVEL) 	//update main dimmer item
		Milight_ID0x5544_G1_Hue.postUpdate(sHUE+","+sSATURATION+","+sLEVEL)		//update color item      
	}
.
.
.

Hope i posted this the right way, iā€™m not so formilliar with posting on forums :sweat_smile:

Good question I should cover in the readmeā€¦

I use Openhabs groups instead of using Zone 0 of the milights. See Openhabs documentation on groups but this example should help.

Group:Color LinenHallLights "Linen Hall" ["Lighting"]
Color LinenHall1 "First Linen Hall" (LinenHallLights) ["Lighting"] {channel="espmilighthub:rgb_cct:001:0x55442:colour"}
Color LinenHall2 "Second Linen Hall" (LinenHallLights) ["Lighting"] {channel="espmilighthub:rgb_cct:001:0x55443:colour"}

EDIT: You do not need those rules, they may be from the OLD way and not the newer way of using this binding. Just get rid of the rules and it should still work.

yep, thanks. Works like a charm. :+1:

One more quick question, is it possible when there are alot of bulbs (8) in one zone that some bulbs react wrong or not at all? I have some lights that react correctly and some do change color, but change to a random color or donā€™t react at all. I tried moving the hub directly under the lights, this was an improvement but still 1 or two bulbs didnā€™t react or reacted wrong. could this be because 8 bulbs need to get their own radio package? is there any parameter i can change to improve this? Like i said iā€™m a total noob :grin:

No it can not be caused by number of globes as the globes do not transmit, they only recieve rf that the hub transmits. My guess is the nrf pcb is a fake and needs more power to be reliable. Search this thread for my post with pictures in it for different nrf boards for more info. The rf repeats may help but is a band aid solution.

Ok, thanks. Just ordered a couple of E01-ML01DP5 from different suppliers. I will test if this is an improvement. Thanks again

Please, let us know if any improvement
Thanks

Ok will do. I allso noticed i still had an original IBOX2 pluged in in this room (this was linked to the bulbs at one time, not sure if it still was linked). I unplugged this IBOX2 and now the lights are much more responsive. I rarely get one light that reacts incorrect to a command. But iā€™m still moving to the better quality tranceivers.

Hello guys, just ran into a new problem. when I dim a bulb to 50% with a slider in the sitemap and then turn bulb off and back on with a switch, the light comes on at 50% but the slider in the sitemap says 100%. When i click on the 100%-side of the slider the bulb comes on fully.

.item

Color  Milight_ID0x0005_G1_Hue "Plafond kleur" <colorlight> (milight_Office_Color) {channel="espmilighthub:rgb_cct:001:0x00051:colour"}

.sitemap

Switch item=milight_Office_Color label="aan/uit [%s]"
Slider item=milight_Office_Color label="Dimmer [%d%%]"
Colorpicker item=milight_Office_Color label="Kleur [%d]" icon="colorlight"

First i tried it like this but then the slider of the level doesnā€™t react to the switch and vice versa:

.items

Switch Milight_ID0x0005_G1_State "Plafond aan/uit [%s]" <switch> (milight_Office_State) {channel="espmilighthub:rgb_cct:001:0x00051:level"}
Dimmer Milight_ID0x0005_G1_Level "Plafond helderheid [%d%%]" <light> (milight_Office_Level) {channel="espmilighthub:rgb_cct:001:0x00051:level"}
Color  Milight_ID0x0005_G1_Hue "Plafond kleur" <colorlight> (milight_Office_Color) {channel="espmilighthub:rgb_cct:001:0x00051:colour"}

.sitemap

Switch item=milight_Office_State label="aan/uit [%s]"
Slider item=milight_Office_Level label="Dimmer [%d%%]"
Colorpicker item=milight_Office_Color label="Kleur [%d]" icon="colorlight"

I think both cases should work but i must be doing something wrong :worried:. Any ideaā€™s

EDIT:
Now I noticed nothing gets updated when using the first case (controlling everything by hue) when using an offichial milight remote. But when i control with status & level (second case) values in openhab do get updated. So this would be the way to go. but i still have the prementioned problem. Iā€™ll keep trying. :grin:

The second way (switch and dimmer directed to the ā€˜levelā€™ channel) is what I consider the ā€˜correctā€™ way to do it because the colorpicker has its own brightness fader. The examples in the first two post of this thread show this way as it is how I test and write the binding doing it this wayā€¦

If you think there is a bug please let me know the steps to reproduce it and Iā€™ll take a look. I have spent a lot of time making sure the faders jump back to previous values especially when you change from a color back to white, it should change the faders position to the last position when it was white last. These are extra features I added and not the normal behaviour of the hub.

I am loving this binding my lights have never been so reliable.

I have noticed one thing which doesnā€™t really bother me but catches the wife every time. I use the OH2 skill with Alexa to turn the lights on. I also use commands like ā€œturn the lamp blueā€ or ā€œTurn the wall lights purpleā€.These commands work fine but when I ask it to turn one of the lights white it turns them red.

Any ideas?