Commit graph

683 commits

Author SHA1 Message Date
Bas Nijholt
1133f0defa
Find adaptive_switch in TurnOnOffListener (#635) 1.15.1
* Find adaptive_switch in TurnOnOffListener

* remove unused argument

* Bump to 1.15.1
2023-07-20 08:52:14 -07:00
Mario Guggenberger
1cedb3fbc7
chore: bump manifest version to 1.15.0 (#634) 1.15.0 2023-07-19 18:53:42 +02:00
Mario Guggenberger
ed80bd7829
feat: service call adaptation (#628)
* feat: service call adaptation

* feat: toggle-on service call adaptation

* feat: prefer service call transition
2023-07-19 09:10:21 +02:00
pre-commit-ci[bot]
d16a9a5751
[pre-commit.ci] pre-commit autoupdate (#620)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/pyupgrade: v3.6.0 → v3.7.0](https://github.com/asottile/pyupgrade/compare/v3.6.0...v3.7.0)

* Update README.md, strings.json, and services.yaml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-02 15:32:44 -07:00
Mario Guggenberger
72e140e293
feat: skip redundant adaptation commands (#615)
* feat: skip redundant adaptation commands

* update README

* style

* Remove "experimental"

---------

Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2023-07-02 15:26:07 -07:00
Mario Guggenberger
36c656b795
docs: Ikea light config recommendations (#614) 2023-06-14 09:39:47 -07:00
pre-commit-ci[bot]
42edd5eb8f
[pre-commit.ci] pre-commit autoupdate (#587)
updates:
- [github.com/asottile/pyupgrade: v3.3.2 → v3.6.0](https://github.com/asottile/pyupgrade/compare/v3.3.2...v3.6.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-06-12 17:43:18 -07:00
Bas Nijholt
68d500bd12
Update manifest.json (#613) 1.14.0 2023-06-12 16:13:29 -07:00
Mario Guggenberger
6283158ff7
VS Code Dev Container (dev & test environment) (#605)
* build: dev container

Add a VS Code Dev Container from the blueprint at bceaae212f

* build: dev container test setup

Add support for unit testing in the dev container environment with debugging and code coverage.

* ci: adjust to dev container test restructuring

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* ci: fix coverage collection

* build: add dummy light to HA config

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* build: update dev container to Python 3.11 (for HA 2023.6)

* Add VS Code tasks

* Use pre-commit hooks for linting

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Unpin HA version

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
2023-06-11 15:33:07 -07:00
Mario Guggenberger
12dae4b6a6
fix: 2023.6 compatibility (#607)
* fix: 2023.6.0 compatibility

* ci: test with Python 3.11 against 2023.6.0b4

* Set 2023.06.0

* Bump to 2023.06.1

---------

Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
2023-06-11 14:12:37 -07:00
Bas Nijholt
90b8d6089d
Bump to 1.13.0 in manifest.json (#610) 1.13.0 2023-06-08 16:09:57 -07:00
Mario Guggenberger
2c8a45604a
feat: brightness prioritization (#598)
* feat: optional brightness prioritization

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove config flag and change default split order

* Fix test

* Fix edge case

* Add tests

* Backwards compatiblity

* Fix another edge case

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-06-08 16:01:19 -07:00
Bas Nijholt
4683f083f6
Update version to 1.12.0 in manifest.json (#596) 2023-05-22 12:16:40 -07:00
allcontributors[bot]
bf3b709ba6
docs: add protyposis as a contributor for code (#597) 2023-05-21 13:35:45 -07:00
Mario Guggenberger
2033fcebe9
fix: lights unexpectedly turn back on after switch-off (#590) 2023-05-21 10:36:16 -07:00
Bas Nijholt
29e54185e3
Add "See also" to README (#591) 1.12.0
* Add "See also" section

* Add date

* chore(docs): update TOC

* Add YouTube videos

* Add components.cloud

* verbose loggin

---------

Co-authored-by: basnijholt <basnijholt@users.noreply.github.com>
2023-05-12 11:36:24 -07:00
pre-commit-ci[bot]
9caf645093
[pre-commit.ci] pre-commit autoupdate (#584)
updates:
- [github.com/asottile/pyupgrade: v3.3.1 → v3.3.2](https://github.com/asottile/pyupgrade/compare/v3.3.1...v3.3.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-05-01 16:56:03 -07:00
Benjamin Auquite
47c5ea93e0
Add test_supported_features and fix the problem introduced in #565 (#575)
* Update test_switch.py

* Update test_switch.py

* test is now done.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix the test only.

test is backwards compatible with the old method.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix _supported_to_attributes

everything works now.

* pre-commit fixes

cannot fix the `function too complex` problem.

* ignore test_switch.py in `pre-commit-config.yaml`

* Add ignore C901 to test_supported_features

* remove commented out code

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2023-04-27 12:56:49 -07:00
Benjamin Auquite
adf0d0cf30
Auto reload YAML config changes (#573)
* Update __init__.py

* Update __init__.py

* skip installing codecov

* remove in CI

* test 2023.4.6

---------

Co-authored-by: Bas Nijholt <bas@nijho.lt>
2023-04-26 19:10:52 -07:00
Benjamin Auquite
a888afd6dc
Refactor _supported_features (#565)
* initial commit

* change features to dict

* another slight refactor
2023-04-10 10:07:31 -07:00
Benjamin Auquite
e30b7debe5
Refactor _adapt_lights into _update_manual_control_and_maybe_adapt (#513) 1.11.0
* Add auto_reset_manual_control with async timer

* cherry-pick wait for transition stuff

* Update switch.py

* merge wait_for_transition

* Update switch.py

* not renamed in this branch yet.

* Update switch.py

* update tests

* Update switch.py

* Update switch.py

* merge related fix

* cleanup

* Revert "cleanup"

This reverts commit 3aa2f3242b.

* 0.1 sometimes fails the test

* not in this pr yet

* Update switch.py

* Update switch.py

* Update switch.py

* Update switch.py

* Update README.md, strings.json, and services.yaml

* slight refactor

* Update switch.py

* Update switch.py

* Possible refactor of _update_attrs_and_maybe_adapt_lights

* cleaned up

* Revert "cleaned up"

This reverts commit 441cb1ff5c.

* Possible refactor of _update_attrs_and_maybe_adapt_lights (#537)

Co-authored-by: Benjamin Auquite <halomastar@gmail.com>

* Revert "Revert "cleaned up""

This reverts commit 11b268148b.

* remove bad merge conflict

* revert permissions

* Bump to 1.11.0

* Undo unrelated test changes

* 'else' instead of 'continue'

---------

Co-authored-by: Bas Nijholt <bas@nijho.lt>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
2023-04-08 18:54:06 -07:00
Bas Nijholt
fe7bdd3940
Add auto_reset_time_remaining attribute (#558)
* Add auto_reset_time_remaining attribute

* fix attr

* Add test
2023-04-08 05:39:08 -05:00
Bas Nijholt
39e9d0e74f
Update issue templates (#557) 2023-04-07 19:40:36 -05:00
Bas Nijholt
c0c363136b
Test multiple Home Assistant releases and the dev branch (#552)
* Test for multiple Home Assistant versions

* Install ulid-transform

* remove unnecessary unsafe `async_set` from test

* Skip test_state_change_handlers in <2023.4

* Revert "Skip test_state_change_handlers in <2023.4"

This reverts commit 8d01b6ec4e.

---------

Co-authored-by: Benjamin Auquite <halomastar@gmail.com>
2023-04-06 16:36:57 -07:00
Benjamin Auquite
a01fec0211
Bump to 1.10.1 (#551) 1.10.1
* Update manifest.json

* undo merge mistake

* Version 1.10.1
2023-04-06 13:29:32 -07:00
Bas Nijholt
59877a0343
Make sure context_id is 26 chars and partially conform to ULID standard (#550) 2023-04-06 12:37:02 -07:00
Benjamin Auquite
cb967aeeb7
Create intentionally over-redundant state_change tests and fix #541 (#544)
* add transition_timer test and debug

* syntax error

* test

* Update switch.py

* Revert "test"

This reverts commit b8009e0a1a.

* Update test_switch.py

* add `create_transition_events` to tests.

nearly done

* tests are done!

* pop is for dictionaries

* Update test_switch.py

* combine the tests

* pin markdown-code-runner

* Pin with '=='

* Update test_switch.py

* pin in the correct place 😅

* Update test_switch.py

* Use timer.is_running

* Update test_switch.py

* ensure timer is running in tests

* this passes the test

* Update test_switch.py

* Do not create new list when not needed

* Remove empty deps

* Remove CONF_ULID_MAX_LENGTH (which is not configurable)

* this shouldn't pass the test but it does.

---------

Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2023-04-06 13:53:23 -05:00
Benjamin Auquite
03a2d9cbf6
Fix RGB Color Temp Swaps (#514)
* cherry pick from 486

* Refactor `_add_missing_attributes`

---------

Co-authored-by: Bas Nijholt <bas@nijho.lt>
2023-04-05 18:39:31 -05:00
Benjamin Auquite
f5abf034c4
Fix the docker tests instructions (#543)
* Tested on multiple hardware

Turns out windows 10 and 11 can't use `$(pwd):/app` OR `%cd%:/app` in PowerShell (which replaced cmd prompt), so I looked up the docs and made the necessary changes (again, sorry!)

These changes have been tested on all terminal environments except macOS (the docs say it'll work there)

* allow use of --exitfirst for faster debug

* Remove install in actions

---------

Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2023-04-05 09:13:57 -07:00
Benjamin Auquite
4fcf238360
Update README.md on transition_until_sleep parameter (#539)
* Update README.md

I believe you changed the config option's name after I posted the graph, so I renamed the config option there too.

There was also a deleted user on the contributions list so I went ahead and removed that too.

* chore(docs): update TOC

* Update README.md

---------

Co-authored-by: th3w1zard1 <th3w1zard1@users.noreply.github.com>
2023-04-04 20:52:54 -07:00
allcontributors[bot]
744e43f4bf
docs: add th3w1zard1 as a contributor for maintenance (#538)
* docs: update README.md

* docs: update .all-contributorsrc

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2023-04-04 08:54:54 -07:00
Benjamin Auquite
e4d06476fd
Add windows command for Docker test instructions (#536)
* ( Tiny Change ) Add windows command for dockertest

You said it earlier but the correct command for running the Docker image on windows is:
```bash
docker run -v %cd%:/app basnijholt/adaptive-lighting:latest
```

* Update README.md

---------

Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
2023-04-03 23:47:08 -07:00
allcontributors[bot]
be0735002c
docs: add th3w1zard1 as a contributor for bug (#534)
* docs: update README.md

* docs: update .all-contributorsrc

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2023-04-03 21:59:14 -07:00
pre-commit-ci[bot]
981287edb9
[pre-commit.ci] pre-commit autoupdate (#531)
updates:
- [github.com/psf/black: 23.1.0 → 23.3.0](https://github.com/psf/black/compare/23.1.0...23.3.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-04-03 17:30:07 -07:00
Benjamin Auquite
c7f44e472f
Correctly wait for transitions (#510) 1.10.0
* 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 3aa2f3242b.

* 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 b986b3f77c.

* 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 3731c99936.

* 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 <bas@nijho.lt>

* 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 <halomastar@gmail.com>
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 <bas@nijho.lt>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
2023-04-03 17:04:06 -07:00
Bas Nijholt
b730c7cc90
Add scripts to auto update en.json, strings.json and services.yaml (#520)
* Add scripts to auto update strings.json and services.yaml

* Run services

* simplify

* Run strings

* rerun

* revert

* allow unicode

* Add CODEOWNERS

* Update CODEOWNERS

* set CONF_USE_DEFAULTS docs

* add field_name

* Auto run scripts

* Update desc

* Update README.md, strings.json, and services.yaml

* double quotes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update README.md, strings.json, and services.yaml

* Add newline

* sync changes between en.json and strings.json

* Update README.md, strings.json, and services.yaml

* double quotes

* fix

* Update README.md, strings.json, and services.yaml

* Add comments

* Remove comments

* shorter

* Update README.md, strings.json, and services.yaml

* Rephrase

* Update README.md, strings.json, and services.yaml

* remove key from desc

---------

Co-authored-by: Benjamin Auquite <halomastar@gmail.com>
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-04-03 14:59:14 -07:00
Bas Nijholt
26974c8fd5
Simplify if-statement, (small #460 fix) (#526) 2023-04-03 13:32:38 -05:00
Bas Nijholt
d768a1e825
Release 1.9.1 (#522) 1.9.1
* Bump to 1.9.1

* Add CODEOWNERS
2023-04-03 02:07:05 -07:00
Bas Nijholt
0958feb744
Undo accidental changes introduced in #509, but adds the changes from #460 (#521) 2023-04-03 03:47:01 -05:00
Benjamin Auquite
c6a6cd323f
Basic community fixes PR (#460) 1.9.0
* 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 <bas@nijho.lt>
2023-04-03 08:02:06 +00:00
Bas Nijholt
87391e6d24
Bump to 1.9.0 (#518) 2023-04-03 01:01:58 -07:00
Bas Nijholt
19fcb1d6b9
Automatically generate more service tables in the README (#509)
* Automatically sync more data

* Automatically generate apply table

* Generate manual control

* Add manual control docs

* Update README.md

* Move docs functions to separate file

* Update code

* simple

* no path

* link paths

* Fix link

* missed

* cd core

* Update README.md

* Allow alternative docs

* update readme

* More special

* Fx

* Update README.md

* Remove common descriptions

* Update README.md

* Update README.md

* Rephrase

* Update README.md

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-03 00:58:39 -07:00
allcontributors[bot]
cdc3585a66
docs: add igiannakas as a contributor for code (#517)
* docs: update README.md

* docs: update .all-contributorsrc

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2023-04-03 07:58:20 +00:00
igiannakas
9caf3048f1
Continue to adapt color temperature down to the sleep temperature after sunset (#87)
* Update switch.py

Continue to adapt color temperature down to the sleep temperature after sunset. Results in a gradually warming light during the night time rather than a fixed color temperature throughout the night time.

* Run pre-commit

* Merge branch 'master' into pr/87

* add config option bool `adapt_until_sleep` defaulting to `false`

---------

Co-authored-by: Bas Nijholt <bas@nijho.lt>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
Co-authored-by: Benjamin Auquite <halomastar@gmail.com>
2023-04-03 07:27:07 +00:00
Benjamin Auquite
c915bda9b9
Autoreset_Control_Time - small changes (#515)
* small changes

* Update README.md

* trivial comment change

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
2023-04-03 06:57:12 +00:00
Bas Nijholt
ea2a6b0173
Add auto_reset_manual_control with async timer (#487)
* Add auto_reset_manual_control with async timer

* Add failing test

* Debugging

* Refactor find_switch_for_lights

* Revert changes in is_manually_controlled

* style

* Fix test_manual_control

* add types

* fixes

* dict

* make all tests pass

* text

* Rework find_switch_for_lights

* Style

* Better check

* revert, do in other test!

* No need to log when raising

* Add type hint

* Suggestion https://github.com/basnijholt/adaptive-lighting/pull/488/files#r1152408541 by @th3w1zard1

* Small fixes

* document new config everywhere (#496)

* chore(docs): update TOC

* undo change

* fi

* Update README.md

* Update README.md

* chore(docs): update TOC

* Update README.md

* Use markdown-code-runner

* Remove

* Use markdown-code-runner instead of packaged solution

* fix comment

* Only commit when needed

---------

Co-authored-by: Benjamin Auquite <halomastar@gmail.com>
Co-authored-by: basnijholt <basnijholt@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-03 02:22:23 +00:00
Bas Nijholt
ccf18c3879
Bump to 1.8.0 (#508) 1.8.0 2023-04-02 19:17:35 -07:00
Benjamin Auquite
b081d79b86
Update services.yaml (#497)
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
2023-04-02 18:57:11 -07:00
Bas Nijholt
9e5e9a49e5
Sync main branch to master (#507) 2023-04-02 18:56:56 -07:00
Bas Nijholt
8108bd0a4b
Use markdown-code-runner instead of packaged solution (#505)
* Use markdown-code-runner instead of packaged solution

* add debug
2023-04-02 18:56:36 -07:00