Espmiilighthub for OH3 - Debugging

@matt1 new thread as requested in post:

I have used MQTT (mosquitto) to successfully read and control the ESP8266 setup.

Here are the trace logs requested using the Remote Control to control things, I’ve prefixed comments with “//.” and subcomments with "//… ", also removed date/time info to save a little space.

//.Startup
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/4:{"state":"OFF","level":96,"bulb_mode":"white"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/3:{"state":"OFF","level":100,"bulb_mode":"white"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/2:{"state":"OFF","level":4,"bulb_mode":"white"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/0:{"state":"OFF","bulb_mode":"white"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"OFF","level":100,"bulb_mode":"white"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"OFF","level":100,"bulb_mode":"white"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/2:{"state":"OFF","level":4,"bulb_mode":"white"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/4:{"state":"OFF","level":96,"bulb_mode":"white"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/0:{"state":"OFF","bulb_mode":"white"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/3:{"state":"OFF","level":100,"bulb_mode":"white"}


//.ON/OFF
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"ON","level":100,"bulb_mode":"white"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"OFF","level":100,"bulb_mode":"white"}


//.Brightness (level)
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"ON","level":12,"bulb_mode":"white"}
//....Back to full Brightness
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"ON","level":4,"bulb_mode":"white"}
//....Should be level=100, not level=4, repeated this several times, same result, STRANGE


//.Colour and Level Changes
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"ON","level":100,"hue":144,"bulb_mode":"color"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"ON","level":24,"hue":144,"bulb_mode":"color"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"ON","level":36,"hue":35,"bulb_mode":"color"}
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"ON","level":100,"hue":35,"bulb_mode":"color"}
//.....Set back to White after Colour
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"ON","level":100,"bulb_mode":"white"}


//.Disco Mode
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"ON","level":100,"mode":0,"bulb_mode":"scene"}
//....To next Mode
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"ON","level":100,"mode":1,"bulb_mode":"scene"}
//.....Back to White after Disco Mode
[TRACE] [nternal.handler.EspMilightHubHandler] - Recieved the following new Milight state:milight/states/0x123A/rgbw/1:{"state":"ON","level":100,"bulb_mode":"white"}

So as can be seen, the binding is getting the info when using the Remote Control, thing is this isn’t being relayed back to the UI display, neither OH3 UI or BasicUI using a postUpdate() method or similar means.

I just looked over the code for over an hour and found no issues, it also works fine here.
Please setup 100% only using the UI and adding it as EQUIPMENT as per the new user tutorial. Does it still do the same thing when setup only using the UI and not using textual?

I’m using version 1.10.7 25-11-20 FW (previously had 1.10.5 but udated it to try and fix this issue) on my Nodemcuv2 ESP8266-12E with nRF24 radio, the native FW Web UI updates fine when using the Remote Control.

The version of the binding I’m using is espmilighthub-3.1.0-SNAPSHOT date 29-12-20.

Now if I understand correctly, you want me to disable my 100+ other perfectly working items to use the OH3 UI to configure this binding which is only supporting 4 items, because, as I understand it, OH3 won’t let you mix textual configs and UI configs, this seems rather drastic to me. I can post all my text configs for this binding (which I did in previous thread I’m sure), but to disable/abandon my whole working setup just to re-create an LED Bulb instance is nonsense.

Thing is, the Remote Control events are being seen by the binding, the binding in turn is not relaying those events back to the UI (OH3 or BasicUI), the callback code seems to be buggy.

Here’s my configs.
Things:

Bridge mqtt:broker:0x123A "Milight LEDs" [ host="127.0.0.1", port=1883, secure=false, username="", password="", qos=1]
        Thing mqtt:rgbw:0x123A0 "All Milight Lights" (mqtt:broker:0x123A) @ "Home" [powerFailsToMinimum=false]
        Thing mqtt:rgbw:0x123A1 "Milight Bedroom Lamp" (mqtt:broker:0x123A) @ "Bedroom" [powerFailsToMinimum=false]
        Thing mqtt:rgbw:0x123A2 "Milight Bedroom Light" (mqtt:broker:0x123A) @ "Bedroom" [powerFailsToMinimum=false]
        Thing mqtt:rgbw:0x123A3 "Milight Lounge Light" (mqtt:broker:0x123A) @ "Lounge" [powerFailsToMinimum=false]
        Thing mqtt:rgbw:0x123A4 "Milight Bathroom Light" (mqtt:broker:0x123A) @ "Bathroom" [powerFailsToMinimum=false]

Items:

// Lights
        /* All Lights */
Switch All_LightsSw             "All Lights Switch - On/Off [%s]"                       (Home,Lights,AllLights) ["Switchable"]  {channel="mqtt:rgbw:0x123A0:level"}
Dimmer All_LightsLD             "All Lights Brightness [%s]"            <slider>        (Home,Lights,AllLights) ["Lighting"]    {channel="mqtt:rgbw:0x123A0:level"}
Color All_LightsCM              "All Lights Colour [%s]"                                (Home,Lights,AllLights) ["Lighting"]    {channel="mqtt:rgbw:0x123A0:colour"}
String All_Lights_Cmd           "All Lights Command"                                    (Home,Lights,AllLights) ["Lighting"]    {channel="mqtt:rgbw:0x123A0:command"}
String All_LightsCBM            "All Lights Current Bulb Mode [%s]"                     (Home,Lights,AllLights) ["Lighting"]    {channel="mqtt:rgbw:0x123A0:bulbMode"}
Number All_LightsDM             "All Lights Disco Mode [%d]"                            (Home,Lights,AllLights) ["Lighting"]    {channel="mqtt:rgbw:0x123A0:discoMode"}

        /* Bedroom Lamp */
Switch Bedroom_LampSw           "Bedroom Lamp Switch - On/Off [%s]"                     (Bedroom,Lights)        ["Switchable"]  {channel="mqtt:rgbw:0x123A1:level"}
Dimmer Bedroom_LampLD           "Bedroom Lamp Brightness [%s]"          <slider>        (Bedroom,Lights)        ["Lighting"]    {channel="mqtt:rgbw:0x123A1:level"}
Color Bedroom_LampCM            "Bedroom Lamp Colour [%s]"                              (Bedroom,Lights)        ["Lighting"]    {channel="mqtt:rgbw:0x123A1:colour"}
String Bedroom_Lamp_Cmd         "Bedroom Lamp Command"                                  (Bedroom,Lights)        ["Lighting"]    {channel="mqtt:rgbw:0x123A1:command"}
String Bedroom_LampCBM          "Bedroom Lamp Current Bulb Mode [%s]"                   (Bedroom,Lights)        ["Lighting"]    {channel="mqtt:rgbw:0x123A1:bulbMode"}
Number Bedroom_LampDM           "Bedroom Lamp Disco Mode [%d]"                          (Bedroom,Lights)        ["Lighting"]    {channel="mqtt:rgbw:0x123A1:discoMode"}

        /* Bedroom Light */
Switch Bedroom_LightSw          "Bedroom Light Switch - On/Off [%s]"                    (Bedroom,Lights)        ["Switchable"]  {channel="mqtt:rgbw:0x123A2:level"}
Dimmer Bedroom_LightLD          "Bedroom Light Brightness [%s]"         <slider>        (Bedroom,Lights)        ["Lighting"]    {channel="mqtt:rgbw:0x123A2:level"}
Color Bedroom_LightCM           "Bedroom Light Colour [%s]"                             (Bedroom,Lights)        ["Lighting"]    {channel="mqtt:rgbw:0x123A2:colour"}
String Bedroom_Light_Cmd        "Bedroom Light Command"                                 (Bedroom,Lights)        ["Lighting"]    {channel="mqtt:rgbw:0x123A2:command"}
String Bedroom_LightCBM         "Bedroom Light Current Bulb Mode [%s]"                  (Bedroom,Lights)        ["Lighting"]    {channel="mqtt:rgbw:0x123A2:bulbMode"}
Number Bedroom_LightDM          "Bedroom Light Disco Mode [%d]"                         (Bedroom,Lights)        ["Lighting"]    {channel="mqtt:rgbw:0x123A2:discoMode"}

        /* Lounge Light */
Switch Lounge_LightSw           "Lounge Light Switch - On/Off [%s]"                             (Lounge,Lights) ["Switchable"]  {channel="mqtt:rgbw:0x123A3:level"}
Dimmer Lounge_LightLD           "Lounge Light Brightness [%s]"          <slider>        (Lounge,Lights)         ["Lighting"]    {channel="mqtt:rgbw:0x123A3:level"}
Color Lounge_LightCM            "Lounge Light Colour [%s]"                              (Lounge,Lights)         ["Lighting"]    {channel="mqtt:rgbw:0x123A3:colour"}
String Lounge_Light_Cmd         "Lounge Light Command"                                  (Lounge,Lights)         ["Lighting"]    {channel="mqtt:rgbw:0x123A3:command"}
String Lounge_LightCBM          "Lounge Light Current Bulb Mode [%s]"                   (Lounge,Lights)         ["Lighting"]    {channel="mqtt:rgbw:0x123A3:bulbMode"}
Number Lounge_LightDM           "Lounge Light Disco Mode [%d]"                          (Lounge,Lights)         ["Lighting"]    {channel="mqtt:rgbw:0x123A3:discoMode"}

        /* Bathroom Light */
Switch Bathroom_LightSw         "Bathroom Light Switch - On/Off [%s]"                   (Bathroom,Lights)       ["Switchable"]  {channel="mqtt:rgbw:0x123A4:level"}
Dimmer Bathroom_LightLD         "Bathroom Light Brightness [%s]"        <slider>        (Bathroom,Lights)       ["Lighting"]    {channel="mqtt:rgbw:0x123A4:level"}
Color Bathroom_LightCM          "Bathroom Light Colour [%s]"                            (Bathroom,Lights)       ["Lighting"]    {channel="mqtt:rgbw:0x123A4:colour"}
String Bathroom_Light_Cmd       "Bathroom Light Command"                                (Bathroom,Lights)       ["Lighting"]    {channel="mqtt:rgbw:0x123A4:command"}
String Bathroom_LightCBM        "Bathroom Light Current Bulb Mode [%s]"                 (Bathroom,Lights)       ["Lighting"]    {channel="mqtt:rgbw:0x123A4:bulbMode"}
Number Bathroom_LightDM         "Bathroom Light Disco Mode [%d]"                        (Bathroom,Lights)       ["Lighting"]    {channel="mqtt:rgbw:0x123A4:discoMode"}

Sitemap

        Group item=AllLights {
                Frame label="All Lights" icon="light" {
                        Switch          item=All_LightsSw
                        Slider          item=All_LightsLD
                        Colorpicker     item=All_LightsCM
// [next_mode='next_mode', previous_mode='previous_mode', mode_speed_up='mode_speed_up', mode_speed_down='mode_speed_down', set_white='set_white', pair='pair',unpair='unpair',level_down='level_down',level_up='level_up',temperature_down='temperature_down',temperature_up='temperature_up',night_mode='night_mode',favourite_white='favourite_white']
                        Selection       item=All_Lights_Cmd mappings=[favourite_white='favourite_white', set_white='set_white',night_mode='night_mode', level_up='level_up', level_down='level_down', next_mode='next_mode', previous_mode='previous_mode', mode_speed_up='mode_speed_up', mode_speed_down='mode_speed_down', pair='pair', unpair='unpair'] icon="blinds-100"
                        Setpoint        item=All_LightsDM minValue=0 maxValue=8 step=1
                        Text            item=All_LightsCBM
                }
                Frame label="Bedroom Lamp" icon="light" {
                        Switch          item=Bedroom_LampSw
                        Slider          item=Bedroom_LampLD
                        Colorpicker     item=Bedroom_LampCM
                        Selection       item=Bedroom_Lamp_Cmd mappings=[favourite_white='favourite_white', set_white='set_white',night_mode='night_mode', level_up='level_up', level_down='level_down', next_mode='next_mode', previous_mode='previous_mode', mode_speed_up='mode_speed_up', mode_speed_down='mode_speed_down', pair='pair', unpair='unpair'] icon="blinds-100"
//                      Setpoint        item=Bedroom_LampDM minValue=0 maxValue=8 step=1
                        Selection       item=Bedroom_LampDM
                        Text            item=Bedroom_LampCBM
                }
                Frame label="Bedroom Light" icon="light" {
                        Switch          item=Bedroom_LightSw
                        Slider          item=Bedroom_LightLD
                        Colorpicker     item=Bedroom_LightCM
                        Selection       item=Bedroom_Light_Cmd mappings=[favourite_white='favourite_white', set_white='set_white',night_mode='night_mode', level_up='level_up', level_down='level_down', next_mode='next_mode', previous_mode='previous_mode', mode_speed_up='mode_speed_up', mode_speed_down='mode_speed_down', pair='pair', unpair='unpair'] icon="blinds-100"
                        Setpoint        item=Bedroom_LightDM minValue=0 maxValue=8 step=1
                        Text            item=Bedroom_LightCBM
                }
                Frame label="Lounge Light" icon="light" {
                        Switch          item=Lounge_LightSw
                        Slider          item=Lounge_LightLD
                        Colorpicker     item=Lounge_LightCM
                        Selection       item=Lounge_Light_Cmd mappings=[favourite_white='favourite_white', set_white='set_white',night_mode='night_mode', level_up='level_up', level_down='level_down', next_mode='next_mode', previous_mode='previous_mode', mode_speed_up='mode_speed_up', mode_speed_down='mode_speed_down', pair='pair', unpair='unpair'] icon="blinds-100"
                        Setpoint        item=Lounge_LightDM minValue=0 maxValue=8 step=1
                        Text            item=Lounge_LightCBM
                }
                Frame label="Bathroom Light" icon="light" {
                        Switch          item=Bathroom_LightSw
                        Slider          item=Bathroom_LightLD
                        Colorpicker     item=Bathroom_LightCM
                        Selection       item=Bathroom_Light_Cmd mappings=[favourite_white='favourite_white', set_white='set_white',night_mode='night_mode', level_up='level_up', level_down='level_down', next_mode='next_mode', previous_mode='previous_mode', mode_speed_up='mode_speed_up', mode_speed_down='mode_speed_down', pair='pair', unpair='unpair'] icon="blinds-100"
                        Setpoint        item=Bathroom_LightDM minValue=0 maxValue=8 step=1
                        Text            item=Bathroom_LightCBM
                }

OH3 does let you mix methods, I have done it a number of times. Expecting a volunteer to read over your files looking for syntax or typos is rude to me when you ignore examples. You should try things the easy way instead of expecting others to do things for you. Remember I don’t care if you get a working setup, I dont get paid, I have no obligation to help and I certainly wont waste my spare time looking for issues when someone does not wish to read and follow examples in documentation.

discoMode is a STRING channel and not a Number channel, that is wrong. The readme has an example to follow and once again you have not used it. Please see the readme here and compare anything which does not work with the examples, I wont do this for you.

openhab-addons/bundles/org.openhab.binding.mqtt.espmilighthub at espmilighthub · Skinah/openhab-addons (github.com)

This is WRONG, it is a STRING channel, you can not send numbers or increase commands to it.

Remove the mappings, they are not needed and if you don’t give the right syntax it will cause issues. Binding should provide the options.

Make sure you are using the latest binding from here until it is merged and built into an openHAB future version.

Index of /openhab/espmilighthub/ (pcmus.com)

Well Disco Mode works now, but only if Light is already on, sure it used to turn on automatically in OH2.
But getting these ERRORS in log.

2021-01-09 17:49:30.191 [ERROR] [org.openhab.core.items.GenericItem  ] - Tried to set invalid state 0.0 (DecimalType) on item All_LightsDM of type StringItem, ignoring it
2021-01-09 17:49:30.192 [ERROR] [org.openhab.core.items.GenericItem  ] - Tried to set invalid state 0.0 (DecimalType) on item Bedroom_LampDM of type StringItem, ignoring it
2021-01-09 17:49:30.193 [ERROR] [org.openhab.core.items.GenericItem  ] - Tried to set invalid state 0.0 (DecimalType) on item Bedroom_LightDM of type StringItem, ignoring it
2021-01-09 17:49:30.195 [ERROR] [org.openhab.core.items.GenericItem  ] - Tried to set invalid state 0.0 (DecimalType) on item Lounge_LightDM of type StringItem, ignoring it
2021-01-09 17:49:30.196 [ERROR] [org.openhab.core.items.GenericItem  ] - Tried to set invalid state 0.0 (DecimalType) on item Bathroom_LightDM of type StringItem, ignoring it
2

In the document you referred, ‘command’ is listed as a Switch type for both Items and Sitemap, this doesn’t work. Shouldn’t it be a String in Items and a Selection in Sitemap. I removed mappings btw, made no functional difference.

I am using the latest version from that link, that was mentioned in my previous post.

With changing any of these suggestions, UI still doesn’t get updates.

Those errors are telling you what is wrong, your sending a number to a string channel as my last post pointed out. You need to try using the UI as I won’t fault find textual configs.

You can use a switch with a string channel that has options as it should setup a separate switch per option, but you can use a selection as well.

I’m not using a switch with a string.

Created a UI switch (on/off on the level channel) and it’s working well, still doesn’t update when using the Remote Control though.

Do I have to put a JSONPath Expression in there so it gets the callbacks, this is what I tried so far:

Callbacks not working obvs.

No do not select any transforms that will break it, the binding does all on its own and should be super simple to use if using the UI.

Well I tried with no transforms first and nothing was happening then, that’s why I’ll tried the transform. Ok removed whole Thing, then recreated from Inbox, added a Dimmer and Switch to ‘level’, took the defaults except name of Item (they had to be different of course). Still doesn’t reflect Remote Control state.

The path is correct ‘milight/states/0x123A/rgbw/1’, double checked this.

EDIT: Deleted then recreated, got it working now using UI config, gonna try text again now with some settings from that.

@matt1, Using UI config is working as expected but I only have 2 channels, ‘level’ and ‘color’ which means I can only create 3 items, Switch(level), Dimmer(level) and Color(color).

What about the other channels ‘command’, ‘discoMode’ and ‘bulbMode’, how do I create them in the UI if they’re not showing up?

EDIT: I can see them present in ‘/var/lib/openhab/jsondb/org.openhab.core.thing.Thing.json’, but they are not showing up in the UI for some reason.

You tick show advanced and the channels are then seen.

Yeah found it an hour or so ago, just setting up those channels before I reported back.

The only one I had trouble with is command, in the README it says it should be a Switch in both Item and Sitemap contexts, this doesn’t work. Only way I could get it to work in BasicUI was to have it as String in Items and Selection in Sitemap.

EDIT: Disco Mode doesn’t remember it’s last setting, it starts from 0 everytime another mode (not Disco) is chosen.

That is correct, that is the way the remotes and the protocol works. Only the ESP does a hack to allow you to jump directly to X disco number.

Try this: Set the item to be a String then use this in the sitemap…

Switch item=FrontHall_BulbCommand mappings=[next_mode='Mode +', previous_mode='Mode -', mode_speed_up='Speed +', mode_speed_down='Speed -', set_white='White', night_mode='Night' ]

It’s working firne as a Selection and is auto populated by the binding, so no mappings required.

Also I noticed there wasn’t an All Lights thing, so I edited ‘org.openhab.core.thing.Thing.json’ and copied another Light and modified by hand, it works fine. Perhaps All Lights thing should be auto generated by the binding.

I see you’re making changes to the README as we go along, that’s good.

One thing though, in this post:

You say not to use mappings, now you are saying to use mappings.

And as mentioned in last post, using Selection instead of Switch the mappings are auto supplied by the binding.