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.
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.
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
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.
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.
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.
I think I will just 'remove' the HUE Magic nodes.
But before that, I have a second issue....
I am not able to "find" the HUE wall switch in the 'Entity ID' (call service)?
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.