-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
detect_non_ha_changes
fixes/additions - tests pending
#450
detect_non_ha_changes
fixes/additions - tests pending
#450
Conversation
also fixed formatting for potential use in future PR
test build ready
compared to `master` and reverted any changed newlines, and moved code around to more closesly match master
tested and working.
detect_non_ha_changes
fixes/additions
@basnijholt Why are you only reviewing formatting concerns in my PRs? I don't mind fixing those for you! But I'd honestly love to hear your opinion and get feedback on the overall implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall makes sense to me, but I don't have much context on this repo or HA best practices.
Max int value is 2147483647 or 0x7FFFFFFF
@th3w1zard1, that’s a fair question 😄 The honest answer is that I am super busy with moving and work. So I haven’t properly read everything, but when quickly glancing over the code I just notice these small things and leave some replies. Hope to get some time soon to properly review these 😊 |
@basnijholt No worries! Thank you so much for blessing us with your project! I'm grateful for any time you have regardless. |
c2345a3
to
24f0464
Compare
…y()` unnecessarily. `take_over_control` is required for the following: `detect_non_ha_changes: true` `strict_adapting: false` `alt_detect_method: true` if any of the above config options are set, and `take_over_control: false`, a logger message will warn the user that take_over_control will be automatically enabled. All of the above config options no longer rely on each other, and can be used separately or in harmony without combinational issues arising. `alt_detect_method` no longer will call `update_entity()` unnecessarily
removed `_last_adapted_state` from switch class as `last_service_data` already contains that data. Class TurnOnOffListener now knows how to get an AdaptiveSwitch object from a light's entity_id. `detect_non_ha_changes` option now functions exactly the same as the main build
@nathang21 Perfect! I believe you have the build I'm looking for. Could you post the |
detect_non_ha_changes
fixes/additionsdetect_non_ha_changes
fixes/additions - tests pending before merging with master
…nges-during-transition
detect_non_ha_changes
fixes/additions - tests pending before merging with masterdetect_non_ha_changes
fixes/additions - tests pending
6974e9c
to
c05e0cc
Compare
Sorry for the delay, here is the latest one I had. |
Looks like both my kitchen lightstrips, and my office desk_lightstrip are still getting flagged with manual control despite not changing anything. I installed the latest build from this PR, restarted HA, and noticed manual control was set on all 3. I toggled AL on/off to clear it, and within a few minutes it was re-applied to all 3. Logs: Let me know if I should use #449 or file another issue. |
@nathang21 Thanks for the update. Come back in an hour then check #486 I should be done by then. |
* Fixes #423 #423 * Do not adapt lights turned on with custom payloads. * Update switch.py * Issue fixes #423, #378, #403, #449 * quickly test #274 * Revert feature requests, this branch only has fixes. Reverted FR 274 * pre-commit fix * Create automerge.yaml * test * Delete automerge.yaml My bad. * Fix #460 and #408 * see @basnijholt 's comment in #450. * @basnijholt requested changes. --------- Co-authored-by: Bas Nijholt <[email protected]>
* Fixes #423 #423 * Do not adapt lights turned on with custom payloads. * Update switch.py * Issue fixes #423, #378, #403, #449 * quickly test #274 * Revert feature requests, this branch only has fixes. Reverted FR 274 * pre-commit fix * Create automerge.yaml * test * Delete automerge.yaml My bad. * Fix #460 and #408 * see @basnijholt 's comment in #450. * @basnijholt requested changes. --------- Co-authored-by: Bas Nijholt <[email protected]>
* Change (WIP) * Update test_switch.py * Refactor * Revert "Revert "Small refactor"" This reverts commit 3731c99. * Update README.md * Fix the test * Bump to 1.9.0 (#518) * Basic community fixes PR (#460) * Fixes #423 #423 * Do not adapt lights turned on with custom payloads. * Update switch.py * Issue fixes #423, #378, #403, #449 * quickly test #274 * Revert feature requests, this branch only has fixes. Reverted FR 274 * pre-commit fix * Create automerge.yaml * test * Delete automerge.yaml My bad. * Fix #460 and #408 * see @basnijholt 's comment in #450. * @basnijholt requested changes. --------- Co-authored-by: Bas Nijholt <[email protected]> * Undo accidental changes introduced in #509, but adds the changes from #460 (#521) * Release 1.9.1 (#522) * Bump to 1.9.1 * Add CODEOWNERS --------- Co-authored-by: Benjamin Auquite <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Add auto_reset_manual_control with async timer * cherry-pick wait for transition stuff * Update switch.py * not renamed in this branch yet. * Update switch.py * update tests * Update switch.py * merge related fix * cleanup * Revert "cleanup" This reverts commit 3aa2f32. * Update switch.py * Update switch.py * Update switch.py * Small refactor * Move test to old position for better diffs * Revert "Small refactor" This reverts commit b986b3f. * Update README.md * fix the test last_state_change isn't updated quick enough. * #510 changes (#516) * Change (WIP) * Update test_switch.py * Refactor * Revert "Revert "Small refactor"" This reverts commit 3731c99. * Update README.md * Fix the test * Bump to 1.9.0 (#518) * Basic community fixes PR (#460) * Fixes #423 #423 * Do not adapt lights turned on with custom payloads. * Update switch.py * Issue fixes #423, #378, #403, #449 * quickly test #274 * Revert feature requests, this branch only has fixes. Reverted FR 274 * pre-commit fix * Create automerge.yaml * test * Delete automerge.yaml My bad. * Fix #460 and #408 * see @basnijholt 's comment in #450. * @basnijholt requested changes. --------- Co-authored-by: Bas Nijholt <[email protected]> * Undo accidental changes introduced in #509, but adds the changes from #460 (#521) * Release 1.9.1 (#522) * Bump to 1.9.1 * Add CODEOWNERS --------- Co-authored-by: Benjamin Auquite <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * No need to wrap the reset * Remove unused attrs * Shorter log message * revert unrelated tests change * remove unused function * Use patch * Bump to 1.10.0 --------- Co-authored-by: Bas Nijholt <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Bas Nijholt <[email protected]>
A couple of suggested fixes for #447 , tested and working on my setup.EDIT: Do not use, a recent merge with upstream/master broke this PR. Please see #486 for the updated PR.
3 new config options:
strict_adapting: false
will check if the last_adapted value matches the current state after an update_entity() call. If they don't match within the already preconfigured error range, this will setmanual_control: true
for that switch.alt_detect_method: true
will check for any significant changes in the opposite direction of whereadaptive-lighting
tried to adapt last. Ex: during a transition from 255 to 3 the brightness may change like 255->237->210->178->159->184->255, if this option is set, it'll detect 159->184->255 as a manual change.autoreset_control_time: <seconds>
was a feature I added solely because I already added 90% of this feature from code from the other config options. If a light is set as manually controlled, after this number of secondsadaptive-lighting
will resetmanual_control
for that specific light.Important things to note:
>
I've no idea if this will break working setups using the currentdetect_non_ha_changes: true
as that feature doesn't work on my setup, hence why I wrote this PRdetect_non_ha_changes
will now do exactly what is already does in the main build, all config options are separate>
strict_adapting: false
utilizeshomeassistant.update_entity()
.>
autoreset_control_time
applies to all lights on the switch equally. Couldn't be bothered to code it per light.this now operates on each light individually! Max value is 2147483647 or 0x7FFFFFFF, which is ~24855.13 days>
autoreset_control_time
will possibly not reset an ongoing timer if a new manual event happens. If you notice this happening, please post debug logs.>When
strict_adapting: false
is set,_async_update_at_interval
(the basic interval function) will always wait for any ongoing transitions from prior adapt calls before attempting another adapt.Again please see #447 for more info, specifically #447 (comment)
Current TODO list:
Any user wishing to test this may download the pr here: detect_non_ha_changes_during_transition
Press the Download ZIP button, extract, and upload the
custom_components
folder to your HASS/config
directoryplease don't post issues with this PR in the main repo! Post all issues on this specific thread
If you'd like to test all of my changes in one build, checkout the
dev-branch