taburineagle / NeewerLite-Python

NeewerLite-Python is an un-official cross-platform Neewer LED light control app - written in Python, originally based off of the NeewerLite macOS Swift project by @keefo (Xu Lian)
MIT License
61 stars 11 forks source link

HTTP Server Daemon brightness increase/decrease by increments #92

Open zoltak opened 3 months ago

zoltak commented 3 months ago

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.

taburineagle commented 3 months ago

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

zoltak commented 3 months ago

@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

taburineagle commented 3 months ago

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 commented 3 months ago

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.

zoltak commented 2 months ago

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