-
Notifications
You must be signed in to change notification settings - Fork 7
WIP: Multi light support #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Closes #4
73123fd to
9ee063a
Compare
|
anything I can do to help? |
|
Thanks, I think I can find some time next weekend to continue this. Then I would appreciate your help with testing |
|
Happy to help if needed 😃 |
|
Waiting for this eagerly :D If you need help, let me know. I just don't want to spend time on it that might just get merged as is tomorrow :D |
|
Hi there! I was testing the current work. So far the functionality works without major issue. I noticed that there are some settings overlap when changing one light configuration. This is originating from reading from the settings where the brightness, temperature and status of the light is saved "globally" instead per device. {
"file-version": "2.0",
"settings": {
"light_active": 0,
"brightness": 21,
"temperature": 236
}
}Does the settings allow to store config based on the IP/Device name? Something like this: {
"file-version": "2.0",
"settings": {
"10.0.0.1": {
"device_name:": "KeyLight 1"
"light_active": 0,
"brightness": 21,
"temperature": 236
},
"10.0.0.2": {
"device_name:": "KeyLight 2"
"light_active": 0,
"brightness": 22,
"temperature": 156
}
}
}That way we can store device wise configuration without affecting other devices configuration Edit: I just have checked the Singleton implementation to get the current configuration from the Keylight API. Then, is it possible to have the IP assigned over each knob? |
|
I believe if we switch from the Plugin_base configuration to action_base configuration we can achieve individual IP per action? Will try to implement it and push over here so it can be tested |
|
Hi there, I was able to implement the get_data_from_light method and use it to fetch and update the data of each light individually: I tried pushing the commits under the same branch so they can be tested but seems that I don't have access to modify the repository, therefore I have forked the project so you guys can review it https://github.com/DavidVallaLope/StreamControllerElgatoKeyLight |
|
Amazing, time flies, thank you very much for this. You should have an invite for accessing this repo |
|
Perfect, now changes should be on this repository. I will add through the day the remaining functionality for the Dial and check on the race thing with the requests. For testing purposes, what works right now is the Dial Brightness and Toggle so if anybody wants to test it, please do |
On update_light implementation, changed the requirement to request the elgato api to fetch the current values, to use the class properties
- New implementation of a json-object for local cache to avoid requesting to elgato API every operation - Add set_property method to apply changes into json-object and request - Change request implementation, TODO async lockeable request
|
If anyone has another idea please let us know so we can include that in the design for the json data manipulation |
|
Ended up adding a data dictionary with each IP associated to store locally all configurations making the gets and puts faster, right now almost all the interactions with the Dial feels really smoothly. So far only affected actions are: Toggle and Dial Brightness and Temperature. Tomorrow will add for the remaining 2 actions and call it a day I notice a bug related to the IP's list where sometimes the action will take the first available IP instead of the stored one. We might need to refactor to take the dial settings IP and avoid the overwriting. Other than that I havent found any other bug related to implementation TODO
Please let me know your thoughts and please test out the changes and let us know the bugs you find CC. @cozybuild |
|
I'd be happy to try testing this, but I'd probably need instructions of how to run this from a checkout as opposed to however the main app pulls in plugins. |
|
Hi @istathar! Thx for checking into this, in order to test the plugin you will have to do the following steps (you need to know the data folder of the StreamController, you can get that information going into StreamController > Open Settings > Developer > Data path, I will refer to this data path as $SC_DIR).
After that you should get all the changes made on this branch |
|
Hi! As per the IP functionality, seems intermittent to me, but there are times where the IP on the second device gets overwritten to the IP of the first device when trying to set up an action. Seems to me to be just a visual bug since its not affecting functionality but we will need to test more |
|
As of know I believe only code cleaning is necessary. If somebody test this and finds a bug please let me know |
|
Thank you so much for all of your amazing work @DavidVallaLope! Really good stuff! I only have an issue (which is not really plugin-related) with the pre-selection of entries.
So you have to select another entry in the list and switch back to the original entry. Can you reproduce the issue? |
Core.py:
1. Line 113 - Fixed typo: Changed return data[ip] → return Core.data[ip]
2. Lines 134-167 - Added null-safety to all property getters:
- current_status, current_brightness, current_temperature
- Now check for None IP addresses and failed API calls
- Return safe defaults instead of crashing
3. Lines 60-87 - Added null-safety to set_property():
- Validates IP address exists before accessing data
- Handles missing data gracefully
4. Lines 94-113 - Added null-safety to _send_to_api():
- Checks for None IP address
- Validates data exists before sending
- Improved error messages
5. Lines 291-298 - Fixed preselect_device_by_ip() crash:
- Added if not hasattr(self, 'device_list'): return check
6. Lines 221-227 - Removed obsolete modify_brightness() and modify_temperature() methods that tried to use non-existent setters
7. Line 254 - Fixed toggle_light():
- Changed to use self.set_property("on", None)
8. Lines 294-299 - Added IP address validation in on_ip_address_added():
- Uses imported ipaddress.ip_address() for validation
9. Lines 42-51 - Removed unused self.json_data instance variable
SetButton.py:
10. Lines 94, 99 - Fixed live update to use set_property():
- Changed self.current_brightness = ... → self.set_property("brightness", ...)
- Changed self.current_temperature = ... → self.set_property("temperature", ...)
fix: diverse issues
|
Hi @cozybuild and @DavidVallaLope Amazing work until now. |
|
Thanks for merging my PR 💐 |
|
Perfect, thanks for testing! I'm rarely on my Linux streaming environment at the moment, sorry about that. But I'll boot into it this week, merge it, and build a new version. |





TODO:
Improve global events to trigger changes by device/ip to update only related actions(follow up: Backend - Upgrade plugin with latest StreamController.EventManager support #10 )