Philips Hue - Dashboard inconsistency

Hello,

I don’t know if the subject/bug has already been discussed or reported but I noticed something yesterday and I don’t know if this behavior is normal:

  • I turn on the Philips Hue lights in my kitchen with the main button to turn on all the lights in the room.

  • I ask Google Home (outside of Gladys Assistant) to turn off the lights in X minutes.

  • The Gladys dashboard indicates that the lights are on (even though they are off). Same observation after a refresh (F5).

Is this related to the fact that the lights are turned off via an external system? Or is it simply a bug?

Thanks for your clarification :blush:

Hi @Kevin! That’s a good question :slight_smile:

For integrations that can be controlled outside of Gladys, and notably the Philips Hue integration, what we do in Gladys is refresh the state of these devices every 60 seconds to be able to retrieve the latest state if it was changed outside of Gladys.

So normally if you don’t see the change immediately, that’s normal — it should show up within 0 to 60 seconds!

Unfortunately we don’t have much choice; ideally Philips Hue would broadcast an event to notify third-party applications that a new state is available, but they don’t, so we have to use the available APIs ^^

1 Like

Indeed, when re-running tests yesterday, I noticed that at certain times it would update. And I thought that you must, in one way or another, be calling the available APIs every x amount of time. At least that answers my question.

However, where it never changes is the bulb’s color state. Gladys seems to remember what was selected the last time. But that doesn’t match reality if the change was made using the Philips Hue app, for example.

It’s not an issue that prevents proper operation but I prefer to report this minor bug :slight_smile:

Ah, that one is a bug :slight_smile: do you have development skills to help us fix it or not?

Otherwise I invite you to create an issue on our GitHub repo so we don’t lose track of the bug!

I have development skills, but they’re mainly limited to .NET C# (and related technologies); as for Node.js, I only used it once out of curiosity.
I should look into it a bit — it shouldn’t be too tricky to fix such a bug.

But in the meantime, I’ll go create an issue on GitHub.

1 Like

Thanks for your GitHub issue, @Kevin!

I’m reposting it here:

If anyone happens to be around and has Philips Hue, could they help us find the bug? @cicoub13 I think you have Philips Hue? :slight_smile:

1 Like

I’ve resold my Philips Hue Bridge to control my bulbs via Zigbee2Mqtt :neutral_face: but I’ll test the color reporting just in case (from Zigbee)

Ah darn :stuck_out_tongue: @VonOx you have Philips Hue with a bridge, right?

Yes, I have that only for one Living Color, the rest is on z2m.

Ok, so you have color control on that Living Color? Could you test this bug and see if you can find a solution?

Yes, I’m away on a trip; I’ll test it at the end of the week when I’m back home.

2 Likes

I confirm that it doesn’t work if an external control is used (Hue app / Voice etc)

Correct state:

The sync only happens on the on/off

1 Like

Only the On/Off poll has been developed. I commented on the issue, pointing to the code that needs to be updated.

1 Like

Good catch @cicoub13!

@VonOx Could you check what the state looks like at this line: Gladys/server/services/philips-hue/lib/light/light.poll.js at master · GladysAssistant/Gladys · GitHub?

Then you need to do a this.gladys.event.emit with the color

{
  on: true,
  bri: 120,
  hue: 45780,
  sat: 254,
  effect: 'none',
  xy: [ 0.1397, 0.0985 ],
  alert: 'select',
  colormode: 'xy',
  mode: 'homeautomation',
  reachable: true
}

I foolishly did that, but I think the color needs to be converted

logger.info(state);
this.gladys.event.emit(EVENTS.DEVICE.NEW_STATE, {
      device_feature_external_id: `${LIGHT_EXTERNAL_ID_BASE}:${bridgeSerialNumber}:${lightId}:${DEVICE_FEATURE_TYPES.LIGHT.COLOR}`,
      state: state.hue,
    });

You have the hsbToRgb function then rgbToInt in servers/utils/colors.js!

You use hue + sat + bri!

Hue direct, it works — I hadn’t waited long enough (it’s not exactly the same blue but in any case it comes back)

1 Like

Yes, the saturation and brightness are missing to get the same blue :slight_smile:

Cool, if that works, thanks for taking a look!

Hi @cicoub13, I’m reposting my GitHub message here, I saw that you made commits on GitHub mentioning this topic, do you have a PR? :slight_smile:

I’m talking about this: https://github.com/cicoub13/Gladys/commit/85d9b8d8f15a514783d4d1a6fddfee5daaf4897d

Hello. Yes, I’ll look into it this week, but I’ll need someone to test it in real life (no more Philips Hue bridge thanks to Zigbee compatibility).

2 Likes