Philips Hue CLIP 2 API v2 Discussion Thread

I can’t say if it ‘guarantees’ the order, but I can say that during my testing I have never observed handleCommand() being called out of order.

In the meantime I observed another more difficult issue, (which would cause problems both with my solution, and with a rules based solution). The problem is as follows..

  1. Light starts off at (say) brightness == 1%
  2. User sends a complex command e.g. set brightness to 100% over 20 seconds
  3. Binding sends complex command to bridge
  4. Bridge IMMEDIATELY sends SSE event with (target) brightness == 100%
  5. After about ~15 seconds bridge sends another SSE event with (actual) brightness == about 70%
  6. Binding informs OH with brightness == 70%
  7. OH core sends unsolicited handleCommand() with brightness == 70%
  8. This causes the binding to send brightness == 70% to the bridge
  9. Which STOPS the planned transition to brightness == 100%

The problem is with the OH core step 7. above; and I don’t know how to fix it. Note: the problem does not arise with transitions less than about 15 seconds, since steps 5, 6, 7, etc. do not occur.

Tried the latest version (logs via email)

openhab> bundle:list|grep hue
356 │ Active │  80 │ 3.4.3.202304230854     │ openHAB Add-ons :: Bundles :: hue Binding

Now scenes seem to be working while sending commands, but the active scenes are still not showing correctly after startup. Mix of UNDEF and NULL.

Best regards

No 7 sounds really strange - there should be no command sent from the framework AFAIK?

Exactly. That is why, if you send a command (without precessor) it will be executed immediately. Whereas if you send a command that had been preceded by a delay command, it will be executed with the respective delay.

Me too. It’s upsetting. Maybe a bug in OH?

EDIT: yes, it is a bug in OH Core resp. Main UI.

  1. If you use (say) the Hue app to send a channel command, and that same channel is being displayed in Main UI, then OH will accept the new value, the Main UI will update, and OH will send a handleCommand() to the thing.
  2. If you use (say) the Hue app to send a channel command, and that same channel is NOT being displayed in Main UI, then OH will accept the new value, and OH will NOT send a handleCommand() to the thing.

https://github.com/openhab/openhab-core/issues/3571

Ok. In the latest build, I implemented it BOTH ways.

  1. Send a DecimalType(transitionDuration) to the dynamics channel, and then within ten seconds send (say) a PercentType(100) to the brightness channel, or ..

  2. From within a rule send dynamicCommand(String channelId, Command command, DecimalType durationMSec)

The Jar is in the usual place..

Works, thanks!

BTW Did you consider keeping the same rule action name? Easier migration for rule users.

Regards

Yes I did. However one of the advantages of API v2 is that dynamics do not only apply to lights, but also to scenes and rooms and zones. So the old name is not completely appropriate. It is probably a trade off between making it easier for existing users, versus making it easier for new users.

@seime apologies for the delay, but there is a new Jar which fixes the scene actualisation and dynamics. It is in the usual place HERE

Thanks @AndrewFG,

openhab> bundle:list|grep hue
356 │ Active │  80 │ 3.4.3.202304251442     │ openHAB Add-ons :: Bundles :: hue Binding

Found this:

  • 3dcdda92-3d88-4ef0-80b1-3530bb110ebe -> updateState() 'light-level' updated to '11853' - light-levels are reported by a factor of 100 I guess?
  • Something still isn’t right with scenes. Restarted openhab, and suddenly two my room/zones do no longer have a scene channel - which they had before restart
    CleanShot 2023-04-26 at 19.01.07

Logs via mail,

Regards

See the following from the Hue API v2 documentation:

Light level in 10000*log10(lux) +1 measured by sensor. Logarithmic scale used because the human eye adjusts to light levels and small changes at low lux levels are more noticeable than at high lux levels. This allows use of linear scale configuration sliders.

EDIT: notwithstanding the comment about linear scales, I could imagine that OH users might prefer if this channel would reverse the above mentioned transformation formula and present the actual light level in Lux. => WDYT?

EDIT 2: i.e. rather than the channel being a Number (:Dimensionless), it should perhaps be Number:Illuminance ??

EDIT 3: to answer my own question, I think the answer should be ‘yes’..

1 Like

Can you please give me the resource id (the Hue resource id) of those things, so I can find them easier in your logs?

Bridge hue:bridge-api2:stue "Hue Bridge Stue, Trapp og kjøkken (Ny)" [.. ]  {

Thing zone trappSpotter "Trapp spotter (lysgruppe)" [resourceId="2d5e0450-7b54-4c00-86cb-e487c041512c"] // Zone idV1:/groups/10
Thing room stue "Stue (lysgruppe)" [resourceId="b207b5ce-4cc4-4b4d-9242-74d938d66c17"] // Room idV1:/groups/17

...
}

String Light_Stue_Scene "Stue scene (navn)" { channel="hue:room:stue:stue:scene"}
String Light_Trapp_Spotter_Scene "Trapperom spotter scene (navn)" { channel="hue:zone:stue:trappSpotter:scene"}

Definately :slight_smile:

1 Like

@seime I made yet another attempt to fix the scene initialization timing, and also the units of measure of the light level and dynamics channels. Jars in the usual place..

1 Like

Im having an issue with the brightness of a hue ambiance candle bulb.
If I use “openhab:send 1” to the bulb, the bulb goes dark and is 0% in the hue app.
If I use “openhab:send 2”, the bulb goes on and is 2% in the hue app.
All numbers from 2-100 are correctly set and are shown with the same number in the hue app.
If I set 1% in the hue app, openhab is update to 0% for this bulb.

I see the same for a “Hue Fugato color spot”:
Change Brightness in hue app for the spot to 1% → event.log →
Item ‘xx:color’ changed from 264.005,35.2200,18.11 to 264.005,35.2200,0

I’m using the lates version from your pull-request (commit from yesterday).

All lights when they are on have a maximum and minimum lumen output. If you command below the minimum, it is interpreted as off. Apparently the minimun for your particular light is between 1% and 2%..

can be, don’t know for sure, the old hue binding did stay on with sendCommand(1) with the same bulb

Probably true. But the lamp would not have been actually on at 1% ..

PS I am adding a property in OH that will show the respective range..

image

When I add a smart button and want to configure the channel I have the following problem:

image

It says it is missing a profile and I cannot click on any of the shown one. Changing the type to Number doesn’t make a difference either.

I checked the code

      if ((this.channel ? this.channel : this.selectedChannel).kind === 'TRIGGER') {
      debugger
        if (!this.compatibleProfileTypes.length) {
          this.$f7.dialog.alert('There is no profile available for the selected item')
          return
        }
        if (!this.currentProfileType || !this.compatibleProfileTypes.includes(this.currentProfileType)) {
          this.$f7.dialog.alert('Please configure a valid profile')
          return
        }
      }

and it reveals that this.compatibleProfileTypes is indeed empty.

I checked Philips Hue - Bindings | openHAB but this even doesn’t mention to add a particular profile. Do you know what the issue is?