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

How do I create the prefs for naming the lights on the webbased install? #38

Closed fribse closed 2 years ago

fribse commented 2 years ago

Hi @taburineagle Still working very very nicely here, my youtube studio is almost fully automatic, when I press the correct button on the stream deck, it lowers the blinds, saves the states of the normal lights, turns on the studio light when the blind is low enough, just perfect! I had previously removed the prefs files for naming of the lights, as they messed up everything. You solved that afterwards, but I can't create new namings for the lights in the webinterface, so how do I create them manually? I know they are placed under light_prefs, but what is the naming scheme of the file, and the format inside the file?

taburineagle commented 2 years ago

Hello @fribse! It's been a while 😊

I'm glad everything's working out for you so far! I'm working on a few NeewerLite-Python things (and quite a few other things, hence the delay), but haven't had a chance to make the CLI preferences engine yet. Here is the format:

The files are named after the MAC address of the light, with the colons removed, and in all caps - so: AA:22:BB:33:CC:44 would result in a file called AA22BB33CC44 in the light_prefs folder.

The file itself is laid out with 3 parameters, delimited with a pipe character (|): up to 0.11 - (custom name for light)|True/False (whether to allow wider CCT ranges)|True/False (only allow CCT mode for non-RGB lights) 0.12 (not released yet) - (custom name for light)|min,max (custom color temp range for CCT)|True/False (only allow CCT mode for non-RGB lights)

In 0.12, based on a list of Neewer lights from their website suggested a few months back by @PrezP, I'm working on adding the entire list of Neewer lights known (at least up to the current day) and their specs, color ranges, RGB-ability, etc., and also adding custom CCT temperature ranges for lights that might not be in the list yet - that's upcoming.

fribse commented 2 years ago

Hmm, the name doesn't show in the WebUI. The lights billede So I created a file called CB7258582664 and placed it under light_prefs The file just contains a single line: Front venstre|False|False I've also updated it to 0.12, so I guess the second parameter is wrong? But the custom name is just empty.

taburineagle commented 2 years ago

Hmm... even with the "False" in the 2nd position, that should still work... interesting. I'm wondering if the program's still seeing the custom file when it loads. Does the log output say A custom preferences file was found for CB:72:58:58:26:64! when it finds that light? I'm wondering if something odd is going on with where NeewerLite-Python is installed, because I think I remember you had it in /opt/NeewerLite-Python, correct? Odd in that I haven't really extensively tested NL-P on the Pi yet.

Unless, is this still a running session from before? NeewerLite-Python only looks up the custom prefs when it first finds the light... so maybe that's it?

taburineagle commented 2 years ago

I also want to add the ability to change the name of the light from the HTTP server eventually - I think I found a JavaScript function I can use which I can then tie into the existing commands on the HTTP server to prompt someone for a new name, and save it if the user clicks on "Rename light" or something along those lines.

taburineagle commented 2 years ago

OK - @fribse - it's not commited yet, but I have a JavaScript solution written for custom names - click on "Edit", it'll prompt you what you want to change the name to. Give it a new name, it'll change the name, write the light_prefs file with the new name and continue on - cancel out or keep the name the same, it doesn't do anything.

image

taburineagle commented 2 years ago

I've added the JavaScript button to the HTML page for renaming lights in the last series of commits - I'm not 100% ready to release it as the new version yet, as I want to go over everything first, but I should be done with all of that by the end of the weekend!

taburineagle commented 2 years ago

@fribse - OK, I've officially released 0.12 now. The JavaScript button should be good to go on the HTML page, if you click that, with or without a pre-existing preference for the light in the light_prefs folder, and provide a new name, it will change the name of the light in the HTML UI, as well as generate the requisite prefs file.

fribse commented 2 years ago

Wow cool, I did make it work with the prefs file, but I had to restart the neewerlite software to get it to pick it up. I'll close this issue, thankyou for the great work!

fribse commented 2 years ago

Oh, and the naming works perfectly with 0.12

taburineagle commented 2 years ago

You're welcome! Yeah, you would need to close it and re-open it < 0.12, or disconnect from the light and rediscover it, but 0.12 changes that - good to know that's sorted 😊