openhab-addons: [hue] Wrong additional channel update after sending command (API v2)

For this thing:

Thing device wiser1 [resourceId="00000000-0000-0000-0000-000000000000"]

and this item:

Dimmer DinnerTableLamps_Brightness { channel="hue:device:home:wiser1:brightness" }

when performing this command:

openhab:send DinnerTableLamps_Brightness 100

the following scenario plays out:

2023-10-05 21:32:40.188 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'DinnerTableLamps_Brightness' received command 100
2023-10-05 21:32:40.194 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'DinnerTableLamps_Brightness' predicted to become 100
2023-10-05 21:32:40.198 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DinnerTableLamps_Brightness' changed from 0 to 100
2023-10-05 21:32:40.209 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> handleCommand() put resource id:00000000-0000-0000-0000-000000000001, type:light
2023-10-05 21:32:40.211 [DEBUG] [.internal.handler.Clip2BridgeHandler] - putResource() id:00000000-0000-0000-0000-000000000001, type:light
2023-10-05 21:32:40.213 [TRACE] [.hue.internal.connection.Clip2Bridge] - PUT https://192.168.0.251/clip/v2/resource/light/00000000-0000-0000-0000-000000000001 HTTP/2 >> {"type":"light","id":"00000000-0000-0000-0000-000000000001","on":{"on":true},"dimming":{"brightness":100.0}}
2023-10-05 21:32:40.292 [TRACE] [.hue.internal.connection.Clip2Bridge] - HTTP/2 200 (Content-Type: application/json) << {"data":[{"rid":"00000000-0000-0000-0000-000000000001","rtype":"light"}],"errors":[]}
2023-10-05 21:32:40.308 [TRACE] [.hue.internal.connection.Clip2Bridge] - onEventData() data:[{"creationtime":"2023-10-05T19:32:40Z","data":[{"id":"00000000-0000-0000-0000-000000000001","id_v1":"/lights/40","on":{"on":true},"owner":{"rid":"00000000-0000-0000-0000-000000000000","rtype":"device"},"type":"light"},{"dimming":{"brightness":100.0},"id":"00000000-0000-0000-0000-000000000001","id_v1":"/lights/40","owner":{"rid":"00000000-0000-0000-0000-000000000000","rtype":"device"},"type":"light"}],"id":"00000000-0000-0000-0000-000000000002","type":"update"}]
2023-10-05 21:32:40.310 [DEBUG] [.internal.handler.Clip2BridgeHandler] - onResourcesEventTask() resource count 2
2023-10-05 21:32:40.312 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateChannels() from resource id:00000000-0000-0000-0000-000000000001, type:light
2023-10-05 21:32:40.313 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateState() 'brightness' update with '0' (fullUpdate:false, isDefined:true)
2023-10-05 21:32:40.314 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateState() 'dimming-only' update with '0' (fullUpdate:false, isDefined:true)
2023-10-05 21:32:40.316 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateState() 'on-off-only' update with 'ON' (fullUpdate:false, isDefined:true)
2023-10-05 21:32:40.318 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateState() 'alert' update with 'NO_ACTION' (fullUpdate:false, isDefined:true)
2023-10-05 21:32:40.318 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DinnerTableLamps_Brightness' changed from 100 to 0
2023-10-05 21:32:40.321 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateState() 'last-updated' update with '2023-10-05T21:32:40.321365553+0200' (fullUpdate:false, isDefined:true)
2023-10-05 21:32:40.323 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> onResource() consumed resource id:00000000-0000-0000-0000-000000000001, type:light
2023-10-05 21:32:40.324 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateChannels() from resource id:00000000-0000-0000-0000-000000000001, type:light
2023-10-05 21:32:40.325 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateState() 'brightness' update with '100' (fullUpdate:false, isDefined:true)
2023-10-05 21:32:40.327 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateState() 'dimming-only' update with '100' (fullUpdate:false, isDefined:true)
2023-10-05 21:32:40.328 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateState() 'on-off-only' update with 'ON' (fullUpdate:false, isDefined:true)
2023-10-05 21:32:40.331 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateState() 'alert' update with 'NO_ACTION' (fullUpdate:false, isDefined:true)
2023-10-05 21:32:40.332 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> updateState() 'last-updated' update with '2023-10-05T21:32:40.332583885+0200' (fullUpdate:false, isDefined:true)
2023-10-05 21:32:40.334 [DEBUG] [e.internal.handler.Clip2ThingHandler] - 00000000-0000-0000-0000-000000000000 -> onResource() consumed resource id:00000000-0000-0000-0000-000000000001, type:light
2023-10-05 21:32:40.330 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DinnerTableLamps_Brightness' changed from 0 to 100

Summary to highlight the issue:

  • 2023-10-05 21:32:40.198 Item ‘DinnerTableLamps_Brightness’ changed from 0 to 100
  • 2023-10-05 21:32:40.318 Item ‘DinnerTableLamps_Brightness’ changed from 100 to 0
  • 2023-10-05 21:32:40.330 Item ‘DinnerTableLamps_Brightness’ changed from 0 to 100

Although it ends with the correct state, this additional update is a problem. For example, it will cause unneeded/confusing persisted values. It also causes some strange flickering when using a slider in a sitemap to control the light.

Expected Behavior

I would expect to see only the relevant update setting brightness to 100.

Current Behavior

brightness is updated to 0 after being commanded to 100, then set back to 100.

Possible Solution

I have not looked into the code yet, but might update this issue unless someone will find the issue before me. 😉

Steps to Reproduce

See description.

Context

I have this rule to trick the Wiser dimmer into turning off when the Hue app turns it off without transition time (more details here):

rule "Wiser work-around 1"
when
    Item DinnerTableLamps_Brightness changed to 0
then
    // Work-around for required transition time for LK Wiser
    // relays and dimmers.
    if (Hue_Wiser_WorkAround.state == ON)
    {
        DinnerTableLamps_Brightness.sendCommand("0.0")
    }
end

This will be triggered by the excess update, and as a result, this rule will not work:

rule "Morning wake-up family room"
when
    Time cron "0 30 6 ? * mon,tue,wed,thu,fri"
then
   if (Hue_WakeUp_FamilyRoom.state == ON && Anyone_Home.state == ON && !Ephemeris.isBankHoliday)
   {
       DinnerTableLamps_Brightness.sendCommand(100)
   }
end

Your Environment

  • Version used: 4.0

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I will try tomorrow.