feat(power): implement true LED on/off, CLI flag and tests
[Feature] Added the ability to turn the LEDs off and on #20
Summary:
- Added true device power control — sends cmd "turn" with value 0/1.
- New helpers: power_on/power_off in devices.py
- CLI: --power on|off support in lumisync.py (uses settings or falls back to discovery).
- Tests: added test_power_offline.py and test_power_toggle.py; offline tests mock sockets.
- GUI: [DeviceController.turn_on_off] uses the same connection primitive (no behavior changes needed).
- Status: all tests pass locally.
@Minlor I have enhanced the feature. Please review it and let me know.Thankyou.
Here's the code health analysis summary for commits c1c2ad0..b74bdad. View details on DeepSource ↗.
Analysis Summary
| Analyzer | Status | Summary | Link |
|---|---|---|---|
| ❌ Failure | ❗ 44 occurences introduced 🎯 22 occurences resolved | View Check ↗ |
💡 If you’re a repository administrator, you can configure the quality gates from the settings.
@Minlor I have implemented and corrected every bug. Every test I performed gave me 100% passed result locally. But these deepsource python issues kept on getting on every push. Can you please see into this once. If there is any solution to this, let me know, I will try my best to correct everything. Thankyou.
I'm sorry for getting back to you so late, I'm sick at the moment so I'm just mostly trying to rest. Could you explain to me why the new on-off logic is argument based and within the menu which we have in the CLI? Also could you explain to me why the f-string were replaced with % formatting? 🤔
-
[x] Why the on/off is a CLI argument ?
I added --power on|off as a non‑interactive CLI mode so users and scripts can toggle device power quickly and safely without launching the interactive menu or GUI. The CLI path calls the new [power_on]/[power_off] helpers which manage their own socket lifecycle for simplicity and testability.
-
[x] Why f-strings were changed to %-format ?
-
I replaced f-strings in logging/error paths with logger-parameter or single-format usage to follow logging best practices (lazy formatting) and satisfy static checks.
-
Logging performance & best practice: for logger calls we use lazy formatting (e.g. [logger.info("Found %d devices", n)]) so the message isn’t interpolated unless the log level is enabled — this avoids wasted work and satisfies pylint’s W1203.
-
Reuse of one message: sometimes we build a single formatted [error_msg] (using %) so the exact same text can be both [print()]ed and [logger.error()]d without interpolating twice.
-
We kept simple f-strings where immediate interpolation is fine (e.g. plain prints); only logging or duplicated messages were changed.
-
[x] I validated the change with unit tests, import checks and CLI smoke tests so it’s non-invasive and safe.
This will not cause any harm to functionality but if there is a change needed, let me know.
But this isn't meant to be ran as a script? and It should be within the CLI I don't see a reason as to why this would exist