Jeff Wilson
2623aafa61
Remove deprecated @bind_hass ( #1207 )
...
* remove @bind_hass decorator
* attempt to pass hass
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2025-06-15 21:47:26 -07:00
Rasmus Lundsgaard
6cb99e80b0
suggested fix for HA2025 deprecation warnings ( #1168 )
...
* suggested fix for HA2025 deprecation warnings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2025-06-15 21:47:06 -07:00
pre-commit-ci[bot]
9aee234955
[pre-commit.ci] pre-commit autoupdate ( #972 )
...
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v5.0.0 )
- [github.com/astral-sh/ruff-pre-commit: v0.3.5 → v0.8.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.5...v0.8.4 )
- [github.com/psf/black: 24.3.0 → 24.10.0](https://github.com/psf/black/compare/24.3.0...24.10.0 )
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix issues
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2025-01-01 23:28:15 -08:00
rwjack
fc46ed73b6
Fix #1017 ( #1038 )
2024-08-25 11:03:13 -07:00
allcontributors[bot]
318d921b91
docs: add MizterB as a contributor for code ( #1039 )
2024-08-25 09:00:56 -07:00
MizterB
d3b2d00bf1
Treat Hue groups as individual lights ( #1037 )
2024-08-25 09:00:14 -07:00
Björn Ebbinghaus
618e2ccf4a
Add service to group switches ( #998 )
2024-05-15 09:07:59 -07:00
Frosh
b746e5f19c
Remove deprecated 'run_immediately' ( #991 )
2024-05-12 11:32:46 -07:00
Bas Nijholt
1a2cd7399d
Fix for HA <= 2024.3, closes #973 ( #974 )
...
* Fix for HA <= 2024.3, closes #973
* Link
2024-04-08 23:59:18 -07:00
Bas Nijholt
d23f6ec63a
Fix test_proactive_adaptation_with_separate_commands ( #970 )
...
* Add link script
* Set run_immediately=False
* Add await hass.async_block_till_done()
* Use scripts/link
* Rename scripts
* Links in devcontainer
* Install from setup script
2024-04-07 14:01:05 +02:00
Jonathan Kang
8fe532748a
Do not adapt lights that are turned on with an effect ( #844 )
...
* Do not adapt lights that are turned on with an effect
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
2024-03-03 11:38:31 -08:00
droans
92aa50411a
Test that switch is on before updating time listeners ( #936 )
...
Co-authored-by: Michael Carroll <mjoecarroll@gmail.com>
2024-02-21 13:10:00 -08:00
pre-commit-ci[bot]
95a59438b6
[pre-commit.ci] pre-commit autoupdate ( #882 )
...
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.6 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.6...v0.2.0 )
- [github.com/psf/black: 23.11.0 → 24.1.1](https://github.com/psf/black/compare/23.11.0...24.1.1 )
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-02-05 14:13:13 -08:00
Kyle Bjordahl
dce2a35147
Protect for None attributes after HA core change ( #846 )
2023-11-19 17:21:05 -08:00
pre-commit-ci[bot]
7a7baafcb3
[pre-commit.ci] pre-commit autoupdate ( #748 )
...
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.282 → v0.0.284](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.282...v0.0.284 )
* Ruff fixes
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2023-08-15 15:25:19 -07:00
Bas Nijholt
0e23e906da
Fix #745 , first time YAML setup ( #752 )
...
* Check whether this is the first time setup
* Keep list
* simplify
* no UI tracking
2023-08-15 14:47:43 -07:00
Bas Nijholt
e9b7988868
Fix skipped path in multi light intercept ( #751 )
...
* Fix skipped path in multi light intercept
* Deepcopy to make sure that _service_interceptor_turn_on_single_light_handler doesn't moddify
* fix
2023-08-15 12:52:39 -07:00
Bas Nijholt
68feb3d931
Make instantaneous light.turn_on adaptation configurable with intercept ( #750 )
...
* Make intercept configurable
* Update README.md, strings.json, and services.yaml
* import
* skip
* split
* do not pass config_entry
* add to conf
* Update README.md, strings.json, and services.yaml
* spacing
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-15 12:23:56 -07:00
Bas Nijholt
435b2ce5d0
Fix adapt_only_on_bare_turn_on and apply does not result in manual_control ( #729 )
...
* Fix adapt_only_on_bare_turn_on and apply does not result in manual_control
Closes #723
* fix style
2023-08-09 21:48:18 +00:00
Bas Nijholt
597e050ab2
Prevent light.turn_on of light that was just turned off ( #727 )
...
Closes #726
2023-08-09 13:54:18 -07:00
Bas Nijholt
f8e7880a96
Split up SunLightSettings and improve https://basnijholt.github.io/adaptive-lighting/ ( #719 )
...
* Split up SunLightSettings
* Renames
* factor out SunEvents
* more renames
* rewrite
* rewrite more
* simpler
* refactor
* refact
* raise
* refact
* rename
* move method
* clean
* Move to new module 'sun.py'
* make sun independent of HA
* rename
* Move to webapp/homeassistant_util_color.py
* Rework app
* Add link
* new plotting
* app changes
* fix tests
* test clean
* tz fixes
* fix
* use sed
* verbose
* fix tz
* fix
* tiem
2023-08-08 21:31:17 +00:00
Bas Nijholt
ef1546b6b9
Fix min_sunrise_time and max_sunset_time ( #717 )
...
Closes #714
2023-08-07 02:21:16 +00:00
Bas Nijholt
cb9ae39ee4
Fix adaptive_lighting.change_switch_settings service ( #712 )
...
* Fix adaptive_lighting.change_switch_settings service
Closes #623
* filter defaults
* fix mutable
* Revert debugging logs
2023-08-06 11:15:14 -07:00
Benjamin Auquite
fec50ad526
Adapt lights simultaneously instead of one by one ( #529 )
...
* Update switch.py
* Update test_switch.py
* Revert "Update test_switch.py"
This reverts commit 87ea5243b9 .
* remove unnecessary create_task
* remove unneeded len()
* Revert "remove unnecessary create_task"
This reverts commit 2c5da6d739 .
* use `hass.async_create_task`
---------
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2023-08-05 21:19:18 -07:00
Bas Nijholt
d44cb66148
Add adapt_only_on_bare_turn_on which instantly triggers manual_control when turning on with brightness or color ( #709 )
2023-08-05 20:56:32 -07:00
Bas Nijholt
72419cb60f
Add a min_sunrise_time and max_sunset_time ( #707 )
2023-08-05 22:08:45 +00:00
Bas Nijholt
51a18f2afb
Allow adaptive_lighting.apply to turn on lights and do not issue log message ( #705 )
2023-08-05 20:59:58 +00:00
Bas Nijholt
e3a84ffd96
Logging fixes in significant_changes ( #704 )
2023-08-05 13:52:54 -07:00
Bas Nijholt
a1cec19351
feat: add different brightness ramping mechanisms ( #699 )
...
* feat: add different brightness ramping mechanisms
* Rephrase
* Fix curves
* update images
* link to other graphs
* update images
2023-08-05 20:14:21 +00:00
Bas Nijholt
1ef7ed507e
Implement call intercept for multiple lights ( #679 )
...
* Implement call intercept for multiple lights
* remove comment
* skip if no eids
* add comment
* fix type
* Fix skipped
* indentation
* Add logging and fix error
* Fix for HA ≤2023.04
* simplify
* remove unused ignores
* Debug mode
* Add test
* Make test failing
* rename switch
* rename lights
* Fix tests
* Rename lights in tests
* Remove unused dependencies
* Improve tests
* More tests
* Remove the DEBUG_MODE
* Add doc-string
* Extra test
* assert
* extra test
* Comments
* fix
* fix
* expand light groups
* more logging
* sort
* Revert is_proactively_adapting checks
This reverts commit 39fd8f2be0 .
* simplify the mapping
* Revert "Revert is_proactively_adapting checks"
This reverts commit 18803e8e50 .
* test
* no light groups
* do not expand
* Do not expand_light_groups in intercept
* more logging
* Fix
* add comment
* Add multi_light_intercept config option
* Update README.md, strings.json, and services.yaml
* add light group
* fix platform
* add simple test
* turn off again
* Test without take over control
* improve test and fix it in one way
* Fixes
* add cleanup fixture
* format
* Update test_switch.py
* add __str__
* remove unneeded call
* simplify service_data construction
* Generalize is_our_context
* Fix multi_light_intercept: false
* add comments
* add docs
* Update README.md, strings.json, and services.yaml
* Add feature line
* move function
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-03 17:47:09 -07:00
Bas Nijholt
b80b253fa1
Warning when calling light.turn_on with brightness=0 ( #678 )
...
* Do not update the call when calling light.turn_on with brightness=0
* Simplify
* issue warning instead
2023-08-02 23:12:13 -07:00
Bas Nijholt
e0e04da0f6
Before scheduling turn_on do a last-minute check if lights are off ( #671 )
...
* Before scheduling turn_on do a last-minute check if lights are off
* Pass force
* add comment
* fix for proactive
* commetn
* No default for force
* rm newline
* no force
* Return bool
2023-08-02 23:11:45 -07:00
Bas Nijholt
53ed220fa0
Bail adapting if on event equals off event context ( #696 )
...
* Bail adapting if on event equals off event context
Should prevent this (I saw in my logs)
```
2023-08-02 21:49:56.516 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_off('['light.philips_go', 'light.bed_led', 'light.bamboo']', transition=10.0)' event with context.id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:49:56.637 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'on' → 'off' event for 'light.bamboo' with context.id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:49:56.672 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'on' → 'off' event for 'light.bed_led' with context.id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:49:56.747 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'on' → 'off' event for 'light.philips_go' with context.id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:50:00.501 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.philips_go' 'state_changed' event: '{'min_color_temp_kelvin': 2000, 'max_color_temp_kelvin': 6666, 'min_mireds': 150, 'max_mireds': 500, 'effect_list': ['blink', 'breathe', 'okay', 'channel_change', 'candle', 'fireplace', 'colorloop', 'finish_effect', 'stop_effect', 'stop_hue_effect'], 'supported_color_modes': ['color_temp', 'xy'], 'color_mode': <ColorMode.XY: 'xy'>, 'brightness': 10, 'hs_color': (0.0, 100.0), 'rgb_color': (255, 0, 0), 'xy_color': (0.701, 0.299), 'friendly_name': 'Philips Go', 'supported_features': <LightEntityFeature.EFFECT|FLASH|TRANSITION: 44>}' with context.id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:50:00.502 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'off' → 'on' event for 'light.philips_go' with context.id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:50:00.502 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='False', context_id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:50:00.502 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] just_turned_off: Waiting with adjusting 'light.philips_go' for 6.240101
2023-08-02 21:50:00.528 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bed_led' 'state_changed' event: '{'min_color_temp_kelvin': 2000, 'max_color_temp_kelvin': 6535, 'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['blink', 'breathe', 'okay', 'channel_change', 'candle', 'fireplace', 'colorloop', 'finish_effect', 'stop_effect', 'stop_hue_effect'], 'supported_color_modes': ['color_temp', 'xy'], 'color_mode': <ColorMode.XY: 'xy'>, 'brightness': 10, 'hs_color': (10.824, 100.0), 'rgb_color': (255, 46, 0), 'xy_color': (0.689, 0.309), 'friendly_name': 'Bed LED', 'supported_features': <LightEntityFeature.EFFECT|FLASH|TRANSITION: 44>}' with context.id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:50:00.529 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'off' → 'on' event for 'light.bed_led' with context.id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:50:00.529 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='False', context_id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:50:00.529 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] just_turned_off: Waiting with adjusting 'light.bed_led' for 6.129017
2023-08-02 21:50:00.561 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bamboo' 'state_changed' event: '{'min_color_temp_kelvin': 2000, 'max_color_temp_kelvin': 6535, 'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['blink', 'breathe', 'okay', 'channel_change', 'candle', 'fireplace', 'colorloop', 'finish_effect', 'stop_effect', 'stop_hue_effect'], 'supported_color_modes': ['color_temp', 'xy'], 'color_mode': <ColorMode.XY: 'xy'>, 'brightness': 10, 'hs_color': (299.434, 83.137), 'rgb_color': (253, 43, 255), 'xy_color': (0.382, 0.159), 'friendly_name': 'Bamboo', 'supported_features': <LightEntityFeature.EFFECT|FLASH|TRANSITION: 44>}' with context.id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:50:00.562 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'off' → 'on' event for 'light.bamboo' with context.id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:50:00.562 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='False', context_id='01H6WVP8RJF4JZ78SFD98YA0RG'
2023-08-02 21:50:00.562 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] just_turned_off: Waiting with adjusting 'light.bamboo' for 6.072956
```
* log instead
2023-08-02 22:59:01 -07:00
Bas Nijholt
807f7109d4
Require take_over_control for to ignore non-turn_on state off -> on event ( #695 )
2023-08-03 00:59:44 +00:00
Bas Nijholt
e513393653
Keep on and off state tracking in Manager and listen to toggle ( #689 )
...
* Keep on and off state tracking in Manager
* Move manual_control code
* add todo
* check is_on
* Track toggle
* handle toggle
* fix debug
* test
* add comment
* better log
* Fix comment
* log
* test
* get
* check
* cancel early
* rephrase
* add assert
* Remove check
2023-07-31 18:40:32 -07:00
Bas Nijholt
aa9f69a7bb
Set last_service_data in the right place ( #652 )
...
* Set last_service_data in the right place
* Do not get but access key
* rename
2023-07-31 17:52:53 -07:00
Bas Nijholt
d588a5984a
Refactor _update_attrs_and_maybe_adapt_lights ( #688 )
...
* Do not call self.manager.significant_change when not needed
* refact
* fix
* fix
* Add more logging to tests
* remove
2023-07-31 04:57:30 +00:00
Bas Nijholt
1842ac9bd5
Do not assert but issue a warning ( #687 )
...
* Do not assert but issue a warning
* bump to 1.18.2
2023-07-30 13:28:58 -07:00
Bas Nijholt
f4d872a540
Make sure that SimpleSwitches are added before AdaptiveSwitch ( #686 )
2023-07-30 20:01:08 +00:00
Bas Nijholt
2e25af3125
Do not intercept effect and flash calls ( #685 )
...
* Do not intercept effect and flash calls
* log
* Do not intercept flash
2023-07-30 19:32:59 +00:00
Bas Nijholt
2b35ee1e5e
Mark as manually controlled when using flash, effect, or RGBW(W) ( #684 )
...
* Mark as manually controlled when using flash or effect
* Add comment
* Add RGBW and RGBWW
2023-07-30 18:49:40 +00:00
Bas Nijholt
5c897f76da
More typing fixes ( #675 )
2023-07-29 00:17:26 +00:00
Bas Nijholt
5fa74a838f
Typing fixes ( #674 )
...
* Typing fixes
* Ignore tyoe
2023-07-28 16:55:46 -07:00
Bas Nijholt
416f1eb2f1
Rename maybe_cancel_adjusting to just_turned_off ( #673 )
2023-07-28 22:22:16 +00:00
Bas Nijholt
89c90adde0
Only start adapting on light.turn_on when detect_non_ha_changes: false to prevent unwanted light turn ons ( #663 )
...
* Fixes in maybe_cancel_adjusting to possibly fix accidental turn on
* simplify logic in maybe_cancel_adjusting
* Add logging statements
* only control if turn_on called
* more logs
* add TODO
* Add _state_event_is_from_our_turn_on
* Ignore off->on state switches that are not accociated with light.turn_on
* improve logging
* rename
* Update docs
* Update README.md, strings.json, and services.yaml
* Add caution message to README
* Change order of emojis
* Update README.md, strings.json, and services.yaml
* Check that platform is not None
* log the call
* fix args
* Do not re-add already added configs
* Do not re-add already added configs
* Use async_remove
* remove unused code
* [pre-commit.ci] pre-commit autoupdate (#627 )
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.279 → v0.0.280](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.279...v0.0.280 )
- [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0 )
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
* Extra logging statement
* Add to README
* log context_id
* return right indent
* move comment
* Skip on self.manager.is_proactively_adapting
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-28 15:17:17 -07:00
Bas Nijholt
9d6f93538f
Do not create multiple AdaptiveLightingManager instances ( #672 )
...
I didn't realize that setdefault always executes the default.
2023-07-28 01:01:06 +00:00
Bas Nijholt
f699486fd0
Only cancel ongoing adaptation calls if still running ( #668 )
2023-07-27 17:34:56 -07:00
Bas Nijholt
c64d9cefbe
Delete AdaptiveLighting instances that have been removed from YAML ( #669 )
...
* Do not re-add already added configs
* Use async_remove
2023-07-26 23:40:54 -07:00
Bas Nijholt
1cda675bbe
Add @bind_hass to functions ( #667 )
2023-07-26 15:01:29 -07:00
Bas Nijholt
e9297d562f
Cleanup after add_to_platform_abort is called, try-except intercept, update strings.json, fixes #658 ( #659 )
...
* Cleanup after add_to_platform_abort is called, fixes #658
* Add note
* try-catch because of priv
* Catch all exceptions
* Bump to 1.17.3 in manifest.json
* assert that hass is not None
* Rename _light_event_action -> _light_state_event_action
* update .github/update-strings.py
* Update README.md, strings.json, and services.yaml
* update name
* Fixes
* Update README.md, strings.json, and services.yaml
* Add name
* Do not add name
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-26 12:52:03 -07:00