NeewerLite-Python icon indicating copy to clipboard operation
NeewerLite-Python copied to clipboard

HTTP Server Daemon brightness increase/decrease by increments

Open zoltak opened this issue 1 year ago • 5 comments

Would it be possible to add support to increase/decrease brightness by increments from current setting e.g.

Increase brightness by 10 increment from current value: http://127.0.0.1:8080/NeewerLite-Python/doAction?light=11:22:33:44:55:66&bri=+10

Decrease brightness by 5 increment from current value: http://127.0.0.1:8080/NeewerLite-Python/doAction?light=11:22:33:44:55:66&bri=-5

The requirement is for using Stream Deck and having a button to tap to increase or decrease the brightness by increments while streaming without having to keep state on the client side.

zoltak avatar Aug 26 '24 09:08 zoltak

Got you - that should be doable @zoltak, I'll add it to the list of things for the next version!

taburineagle avatar Aug 26 '24 15:08 taburineagle

@taburineagle I have generated code that provides this functionality. I haven't tested with the GUI and may need more testing around the validation. You can find the update here

zoltak avatar Aug 29 '24 03:08 zoltak

Ah, excellent, thank you @zoltak! I'll have to check that out over the weekend and make the changes on my end as well.

taburineagle avatar Aug 29 '24 22:08 taburineagle

OK, I've taken a quick look at the code changes @zoltak, and everything looks good, still need to do a few things first before making a PR, but looks good - I also saw you improved the logistics for that one section in processHTMLCommands, that makes more sense to get the list of lights first... One thing I'm a little bit confused by though, is why did you convert the brightness value to a float? Neewer lights only use integer math (there's no 55.5% brightness, only 55% and 56%), so I'm assuming it needs to be a float to work more nicely with max/min?

Ah, I think I see why - if you try to coerce a string with a decimal into an int, it throws an error... interesting.

taburineagle avatar Aug 30 '24 11:08 taburineagle

@taburineagle I think it should be ok cast as a int. I did a quick test and it didn't throw any errors.

zoltak avatar Aug 30 '24 22:08 zoltak