Philips Hue CLIP 2 API v2 Discussion Thread

It may be a timing issue. Can you please try to disable your ‘Lounge’ thing, and then enable it again? I am hoping the scenes will appear again.


EDIT

I suppose I could do it that way too. There are pro’s and con’s of the drop down approach…

Pro…

  • There is only one channel, so less clutter in the UI

Con…

  • If the room or zone has no scenes, the drop down is empty
  • It is more complex for a rule to activate a specific scene dropdown

But please let me know which you prefer?

I had also just tried deleting and re-adding as that is normally required to detect new channels - that did not help.

Also tried disabling and enabling - no change.

Could you perhaps also try leaving the Lounge thing enabled throughout, but disable/enable the Bridge thing?

Sadly, no difference:

hue.log (593.1 KB)

Thanks for looking into this.

From your log, it looks like a timing issue. It seems that the bridge is sending the scene data to the room and zone things BEFORE those things have been initialized to be aware that the should look out for scene data. Or something like that. Weirdly it work for me just fine on my Raspberry Pi4 and on Windows, so it may take some trawling though your logs to fully figure it out…

Thank you. Just fyi i am also running on a windows machine.
Let me know if you need me to try anything else.

Just ror my information for now? What links to the scene channels? A switch? What happens if you turn on two?

Yes, it is a switch. Turning it ON activates the scene. It auto magically resets to OFF so you can use it again. And if you turn two ON, then ‘last’ one will win.

I, for one, strongly prefer the ‘one string channel for scene selection’ approach (IOW, the drop-down). My use case is having a button going through a number of scenes.
With the ‘one switch channel per scene’ model, how does one find out which scene is active if the switch auto-toggles to OFF again? Also, I’m not sure it’s really easier to use: it shouldn’t make much of a difference between ‘send command X to fixed string channel’ and ‘send command ON to switch channel X’.

1 Like

Ok. I will make another attempt tomorrow, with single channel drop down, and fixing the above-mentioned timing issue.

Can you please explain how that works?

This is the rule triggered by the button:

var ids = [ "S2BckvSfgZv93rT" /* Hell */, "ZKgMfKCmokFQudq" /* Sonnenuntergang */ ]
var currentIndexState = items.getItem("BathroomBathtubLightButtonState").state
var currentIndex = currentIndexState == "NULL" || currentIndexState == "UNDEF" ? 0 : parseInt(currentIndexState);
if (++currentIndex >= ids.length) {
  currentIndex = 0
}
items.getItem("BathroomBaththubLightScene").sendCommand(ids[currentIndex])
items.getItem("BathroomBathtubLightButtonState").postUpdate(currentIndex)

Now that I see it again, it would likely work with separate switches as well…I guess the concept of an ‘active’ scene doesn’t exist?
Nevertheless I find a single string channel more intuitive, if only to keep it similar to how it works currently.

1 Like

Sorry, i missed this edit.

I also prefer the one string channel selection that can be activated via a drop down list. This coukd be because that is hiw it wirk in the V1 binding? But also because i do not see how you would be able to easily implement changes to scenes without having to make changes to OH channels and items?

Was actually going to post questions about this today.

EDIT: The scene selection is quite easy with a widget:

    - component: f7-row
      config:
        class:
          - display-flex
          - justify-content-flex-center
          - justify-content-space-around
        style:
          flex-wrap: nowrap
          overflow: hidden
          white-space: nowrap
        visible: "=props.sceneSelect ? true : false)"
      slots:
        default:
          - component: oh-button
            config:
              action: options
              actionItem: =props.sceneSelect
              iconF7: bubble_left
              iconSize: 17
              outline: true
              round: false
              small: false
              style:
                --f7-button-outline-border-color: rgba(163, 161, 159, 0.9)
                --f7-button-outline-border-width: 1px
                --f7-button-small-font-weight: 400
                color: gray
                font-size: min(max(5px, 3vw), 15px)
                text-align: center
                width: 40%
              text: =(items[props.sceneSelect].displayState)
              visible: "=props.sceneSelect ? true : false"

Linked to V1 channel

1 Like

Honestly I’m not (yet) sure. Obviously when you activate a scene (either via a switch or a drop down channel) it becomes ‘active’. But if you then manually dim or switch an individual light in the group, I am not sure if there is any indication that the scene has become inactive. I will do some checks among the SSE event stream.

EDIT: when I do the above, I do see some scene related events, but I have no yet fully figured out what is going on.

Ok. I changed to that model. The new Jars are on the same link as before HERE

EDIT you might need to delete and recreate the respective room / zone things…

EDIT 2: there still seems to be an issue whereby if you activate a scene, the room/zone switch and dimmer state don’t update…

2 Likes

Thanks Andrew

Mine seems to be working perfectly. Both ethe group and individual Lamps seem to be updated (Only Lamps for color changes).

Will keep monitoring and run some tests.

Appreciate the work you have put in.

I understand. It’s rather technical, but the problem is when the SSE event notification is more than 4096 characters long. So it would only occur when activating a scene would simultaneously change the state of a large number of lights…

EDIT: I made a new build that should fix the issue. The new Jars are on the same link as before HERE

Hi Andrew

Thanks for the update. I have tested the latest JAR and all seems good on my side.

I also took some time to try set up the rules I was trying with the V1 API (and gave up due to the response times etc).

I have managed to get it working as I wanted, which is basically as follows:

  • When item triggered
    • Preserve Current state of a lamp (Brightness, Colour, Colour Temp and Power)
    • Set the lamp to a specific colour for a period of time
    • Restore the previous settings

I managed to get that all working using Blockly for the first time (all in less than an hour).

Wil the V1 API I was never able to restore the plamp back to how it was set before the “Alarm” state.

So I am very HAPPY.

1 Like

I am delighted to hear that! :slight_smile:

Note: with great the help of @maniac103 we made some good optimisations of the core communication code, so if you want to try the absolute latest version, it is on the same link as I mentioned before. You would probably not notice any functional difference from the version you are using, but it is just a bit more ‘bomb proof’.

2 Likes

It turns out that the concept does indeed exist. When a scene is activated the Hue Bridge sends an SSE event including the scene that became active, and for all other scenes that thereby became inactive. Also if you manually change a light within the group to which the scene applies, it includes the scene that thereby became inactive in the SSE event.

I made a new Jar HERE in which the scene channel states are dynamically updated; they now either show the name of whichever scene is active, or ‘NULL’ if no scene (for that room or zone) is active. => Enjoy!

1 Like

Will look when i get back after the weekend. Hoping this does not change my alerting rule.
I guess the scene will not reinstate if the individual light is restored.