HUE Wall switch, simple on/off lightbulb

Hi'

I am a Nod-Red beginner, and kindly ask for som guidens for 'a simple light on/off' solution

The wall switch is not given a simple out 'true/on', therefor it must 'through something' before my bulb can use it :slight_smile:

Screendumps of how to, would be very appreciated :slight_smile:

Thanks' in advance..... and for a lots of good topics in this forum

Hi @Rosenlunden

Welcome to the forums.

I don't use HUE in Node RED - but, after a quick glimpse into it:
You can use the toggle command.

so...

Add a function node to check if the wall switch event is:

  • msg.payload.button === 2
  • msg.payload.action === 'short_release'

if so, send the toggle command, to your target light.
You may be able to use the switch node instead of a function node, using JSONata to achieve the same thing.

Again, I don't use HUE in Node RED, so others might have a better approach.

Hi @marcus-j-davies

Thanks' for your effort, helping me on this one... :slight_smile:

I am not sure that I am doing the right thing?

I have put this in 'On message':

But where/how to 'put' the toggle command?

Hi @Rosenlunden

Try this in your function node.
What we are doing here, is checking what has been triggered on the wall switch and sending a toggle command to the light, based on your requirements.

make sure to connect this function node to the bulb.

const Button = msg.payload.button;
const Action = msg.payload.action;

if(Button === 2 && Action === 'short_release'){
    return {payload:'toggle'}
}

Do you have a hue hub as well or just the bulb?

I believe this is the HUE Magic modules based on the nodes in the screenshot, which is for the HUB

I understand that but Philips makes a hub specifically to control their devices, I wonder if he has one of those as it can be used to control the bulb as well.
[Edit] trying to understand fully his environment

I see.

Indeed! I do all my HUE stuff within the HUB its self.
I'm pretty sure the HUE mobile app guides you in setting up the remote to control lights.

My other question would be: when is the last time that node was updated? I never found a hue node that was updated newer than 2 years ago. I also never got any nodes to work so I rolled my own.

The latest HUE API does push notification (via HTTP multipart text streams)
I was able to use it - but its a little cumbersome.

Could be handy for newer implementations.

That's the hue stuff. I question that even if he gets his code right whether the node he is using will work. He may be fighting multiple problems.

Correct, it is the HUE Magic modules that I am using
Because I thought it would be the "best" native way to control the HUE switch's, bulb's ect.

@marcus-j-davies, I am getting close.. learning :slight_smile:

Last step.... How to 'toggle' -> 'true' / 'false' to the bulb

If changing {payload:'toggle'} to {payload:true} I can direct, turn on the bulb

But... what to trigger the off command then? (I think it need to be 'toggle')

Payload:false. Works on the hub
[edit] there is a developers web site by philips, need to sign up but it is free, has an absolute ton of info on their system. I signed up several years ago. They make it real easy to use their stuff and TOTALLY support those of us who roll our own code.

In theory, the toggle command will switch it off/on based on current state.
At least that's my undertsanding.

By extension on @gerry's comment.

You could also store the current state of the light bulb, whenever the bulb node sends an update.
then, when you see the wall switch event - send either {payload:false} or {payload:true}, based on the last status you captured.

storing data is fairly straight forward
flow.set("SomeName","SomeValue")

Retrieving it also
flow.get("SomeName")

As I do not use the HUE Nodes. - these are just best guesses.
but I would have thought the toggle command will be good for you use.

Hi @marcus-j-davies and @gerry

Right now, this 'basic' solution works... not optimal, but for now.... I can turn on/off the bulb

(Had to drop the 'HUE Magic bulb' and go for the 'call service'.... then I could 'toggle')

I think I will just 'remove' the HUE Magic nodes.
But before that, I have a second issue.... :slight_smile:
I am not able to "find" the HUE wall switch in the 'Entity ID' (call service)?

Hi @Rosenlunden

My HA know how is zero!
Not many HA users around here - but i'm sure someone will know.

1 Like

As stated before, I don't think that node has been updated for several years, I never got it to work so don't know what to say about that issue. Other than that you can get hue to work with node red and it works well. You have to program it up yourself though.

1 Like

Hi' @marcus-j-davies and @gerry

Thanks' for your help.... much appreciated :slight_smile:
I will create another topic regarding the "missing" HUE wall switch in the 'Entity ID' (call service)

I think the HUEmagic is still alive:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.