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
9112bb9f73
Bump to 1.19.0 in manifest.json ( #734 )
2023-08-09 19:06:48 -07:00
Bas Nijholt
5b7ee44629
Fix length of descriptions in UI (config flow) ( #732 )
...
* Fix length of strings in UI
* Update README.md, strings.json, and services.yaml
* fix
* add desc
* Update README.md, strings.json, and services.yaml
* mention webapp
* Add desc
* link
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-10 00:17:25 +00: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
da5147a583
Bump to 1.19.0b5 in manifest.json ( #728 )
2023-08-09 13:56:00 -07: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
00ec76a467
Bump to 1.19.0b4 in manifest.json ( #718 )
2023-08-06 19:21:39 -07: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
104664d358
Bump to 1.19.0b3 in manifest.json ( #713 )
2023-08-06 11:21:54 -07: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
Bas Nijholt
d2c6811e63
Bump to 1.19.0b2 in manifest.json ( #710 )
2023-08-05 23:06:27 -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
11a4489cb5
Bump to 1.19.0b1 manifest.json ( #706 )
2023-08-05 14:42:40 -07: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
9a7cff9d6a
feat: change the order of options in config flow ( #700 )
...
* Change the order of options in config flow
* Update README.md, strings.json, and services.yaml
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-04 21:45:12 +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
4251ccacc5
Bump to 1.18.3 in manifest.json ( #698 )
2023-08-04 00:46:19 +00: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
e98f0dfa55
Bump to 1.18.1
2023-07-30 13:11:30 -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
8967747f31
Release 1.18.0 (fixes lights accidentally turning on 🚀 🎉 ) ( #676 )
2023-07-28 17:25:50 -07: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
f23aeb269b
Bump to 1.17.5
2023-07-27 18:09:37 -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
9e15d1bd22
Update to 1.17.4 in manifest.json ( #670 )
2023-07-27 16:51:59 +00: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
Bas Nijholt
8696092879
Avoid adapting lights with nothing in service_data, closes #661 ( #662 )
2023-07-26 02:17:11 +00:00
Bas Nijholt
f9b6753e6d
Ensure that interpolation is in [0, 1], fixes #624 ( #660 )
...
* Ensure that interpolation is in [0, 1], fixes #624
* Bump to 1.17.1
* Add assert
* Interpolate via HSV space
* Add test
2023-07-25 10:46:34 -07:00
Bas Nijholt
7650a1b3e6
Bump to 1.17.0 in manifest.json ( #657 )
2023-07-23 21:44:17 +00:00
Bas Nijholt
bb84684bce
Style with ruff and logging ( #643 )
...
* Formatting with ruff
* more logging
* Require on_only
* Different implementation
* More ruff
* Remove new logging statements
* Remove 'pylint: disable=protected'
* style
* fixes
* ruff
* Switch to ruff
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix .github
* Fix
* Add ignores
* fix arg
* fix B905
* Fix D
* Fix more
* Fix more
* order
* use path
* moer path
* Remove unused ignores
* fix tes deps
* fix typo
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-23 14:24:22 -07:00