Foddy / node-red-contrib-huemagic

Philips Hue node to control bridges, lights, groups, motion sensors, temperature sensors and Lux sensors using Node-RED.
https://flows.nodered.org/node/node-red-contrib-huemagic
Apache License 2.0
201 stars 67 forks source link

Added incrementBrightness support for groups #417

Open fjulian79 opened 1 year ago

fjulian79 commented 1 year ago

Hi folks ..

I have added the missing incrementBrightness support for groups which is reported in issue #380. In my opinion it is mandatory when huemagic shall be used to connect KNX switches to Philips Hue. I have done it in the following way:

This is the best way to get this done because:

  1. Only two hue api calls are needed
  2. The brightness transition itself is flawless as is done inside of the hue system.

But for this approach incrementBrightness support is mandatory .. see also the official v1 api docs on the bri_inc argument. I have found it while searching for a proper way to get the task done as my other attempts have been suboptimal.

If there is a good reason to get the task done in a different way, let me know ;-)

br J.

peterbaker commented 1 year ago

Awesome! Thank you for doing this. Now how do we get @Foddy to merge it so we can get this in the easy Node Red installer?

peterbaker commented 1 year ago

@fjulian79 Could you implement decrementBrightness too?

fjulian79 commented 1 year ago

@peterbaker maybe the name is misleading but you can use negative values too: incrementBrightness +10 --> 10% brighter incrementBrightness -10 --> 10% darker

So what you request is already there, it would be just another name and inverse logic: decrementBrightness -10 --> 10% brighter decrementBrightness +10 --> 10% darker

So I think this would not add a lot but would bloat the code.

Finally .. there is a fork of this repo which is way more agile, see https://github.com/mauricedominic/node-red-contrib-huemagic.git I have filed my pull request over there as well and it has been accepted. So maybe switching to mauricedominic is a valid option.

peterbaker commented 1 year ago

I did notice that increment works both ways after I wrote that, but also I still think it'd be useful (maybe just to me) to have decrementBrightness as that was how HueMagic 3 worked and including it would maintain existing flows.

Either way, just glad to see a path towards actually being able to use HueMagic 4. Thank you!

peterbaker commented 1 year ago

Also, it would then mirror the commands for individual lights (which have both incrementBrightness and decrementBrightness).

fjulian79 commented 1 year ago

@peterbaker Ack, I agree! I have not had those background info's ;-) I will try to get it done in the next days.

fjulian79 commented 1 year ago

@peterbaker I'm done .. I have tested decrementBrightness with my lamps, works fine from my point of view.