Commit graph

43 commits

Author SHA1 Message Date
Adam DeMuri
623dd65aef
Register service actions in async_setup for Bronze tier compliance (#1403)
* Register service actions in async_setup for Bronze tier compliance

- Move 'apply' and 'set_manual_control' service registration from async_setup_entry to async_setup.
- Move service handlers to module-level functions in switch.py.
- Update apply_service_schema to support dynamic defaults for transition duration.
- Clean up related unused imports and fix Python 3.10 syntax compatibility.

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

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

* Clean up and add tests

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

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

* Fix lint errors

* Automated update of generated docs

* Re-add types

* Make transition not required again

* fix: validate global service targets

* fix: document optional apply transition

* fix: derive service docs from schema markers

* docs: clarify service target options

* fix: preserve entity service target handling

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2026-09-06 13:04:18 +02:00
Mario Guggenberger
5886eee04c
Code cleanup (#1348) 2025-12-12 13:37:42 -08:00
Dobby
19d30430bb
Friendly names (#1258) 2025-11-27 12:01:05 -08:00
ams2990
32719eabae
Fix some type hint issues (#1280) 2025-11-27 09:35:09 -08:00
Daniel
bf7d109c98
fix: async entry setup (#1141)
* Update __init__.py

* Update strings.json
2025-01-01 14:19:31 -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
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
Bas Nijholt
69592938db
Rename TurnOnOffListener to AdaptiveLightingManager (#654)
* Rename TurnOnOffListener to AdaptiveLightingManager

* Bump Python version
2023-07-22 17:57:49 -07: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
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
Bas Nijholt
1ca3bf0f6a
Retroactive review changes for #443 (#485)
* Retroactive review changes for #443

* Move up __init__

* Add test for test_change_switch_settings_service

* Add docs

* Add test for defaults

* Remove unused function

* Add skip var

* move pylint marker

* Refactor validate

* Update README.md

---------

Co-authored-by: Benjamin Auquite <halomastar@gmail.com>
2023-03-27 20:56:54 -05:00
Benjamin Auquite
c05e0cc244 Change attributes in AdaptiveSwitch via service call (#443) 2023-03-27 09:05:24 -07:00
Benjamin Auquite
08ff04141e
Feature requests: Switch now optional for service calls | New default icons | Reload .yaml w/o restart | adapt_delay ms (#459)
* added #274

* attempt getSwitchFromLightId()

* Update switch.py

* changed from register_entity_service to hass.services.async_register

* Update switch.py

* Update switch.py

* Update switch.py

* Update switch.py

* Update switch.py

* Update switch.py

* Update services.yaml

* Update switch.py

* test

* test builds ready

* target selector may not be possible with current syntax

priority is backwards-compatibility as I know most people will smash that update button

* expanded light groups

* test builds ready

* add feature #104

* Update custom_components/adaptive_lighting/switch.py

Co-authored-by: Chris <firstof9@gmail.com>

* Might as well type both. No reason not to.

Co-authored-by: Chris <firstof9@gmail.com>

* Might as well type both. No reason not to.

Co-authored-by: Chris <firstof9@gmail.com>

* Reformatted debug messages.

Reimported ServiceCall as suggested

* Multiple switches allowed again in services.

Apparently this was possible before.

With this change, the `lights` argument must not be passed with multiple switches, or the integration has no way of knowing what the user wants to do. Integration did not make this check in prior versions.

Also reformatted the debug messages.
Removed `automerge.yaml` (my apologies)

* Reload config without restart.

You can now reload any changes to the yaml file without restarting your home assistant. Should show a 'reload' button in your integrations page or you can call the homeassistant reload integration service call.

See https://community.home-assistant.io/t/how-to-allow-custom-compontent-for-yaml-configuration-reloading/391190/4

* Use snake_case for function name 'parseServiceArgs'

* Slight rephrase

* Small style changes

* Rephrased debug messages.

Removed `integration_entities` as we rewrote the code from that function already in parse_service_args. Reference function now above parse_service_args.

* removed: `these_switches = data = None`

* Factor out _find_switch_with_lights

* Rename function and add log statement

* Remove pylint marker

* Handle multiple switches found

* Small changes

* Rename _parse_service_args to _get_switches_from_service_call

* Rephrase log messages

* Add type hint

---------

Co-authored-by: Chris <firstof9@gmail.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2023-03-25 20:22:05 -07:00
Bas Nijholt
01fd7f96e2 Run all pre-commit filters 2022-08-28 15:08:03 -07:00
Bas Nijholt
b6419bd09e remove unused imports 2022-04-17 19:51:44 -07:00
Bas Nijholt
44a7e41e80 use pyupgrade 2022-04-17 19:50:55 -07:00
Bas Nijholt
4b31281cf5 remove long doc-string 2020-10-17 16:54:15 +02:00
Bas Nijholt
7ce7f4e2c1 fix tz bug 2020-10-17 15:43:24 +02:00
Bas Nijholt
313c1addf4 track state_changed 2020-10-05 23:41:57 +02:00
Bas Nijholt
7f6deaa7da bug fixes 2020-10-03 17:36:26 +02:00
Bas Nijholt
09b835c72c fix unsubs 2020-09-30 00:42:27 +02:00
Bas Nijholt
297539adda fixes 2020-09-29 13:13:08 +02:00
Bas Nijholt
58b4c639dd define and use switch._unsub_trackers 2020-09-29 10:48:35 +02:00
Bas Nijholt
d18b2a9da6 fix unsub sub 2020-09-28 23:39:55 +02:00
Bas Nijholt
6a5ded6981 update to latest PR 2020-09-28 13:10:41 +02:00
Bas Nijholt
52fa727c75 sync with HA/core PR 2020-09-26 17:39:17 +02:00
Bas Nijholt
5be04625b6 fix ha/core pre-commit issues and submit this code as PR 2020-09-26 16:38:22 +02:00
Bas Nijholt
2109921eee rename function 2020-09-26 13:13:44 +02:00
Bas Nijholt
685e4cd39b rephase some text 2020-09-26 13:12:06 +02:00
Bas Nijholt
34acd03f46 rename replace_none -> replace_none_str 2020-09-26 13:01:43 +02:00
Bas Nijholt
59f8f743ab simplify setting up DOMAIN_SCHEMA 2020-09-24 23:42:21 +02:00
Bas Nijholt
e9ee147e20 fix data in switch 2020-09-24 20:56:01 +02:00
Bas Nijholt
b67b25da23 coerce to serializable type 2020-09-24 20:41:24 +02:00
Bas Nijholt
d4123ee20a use defaults 2020-09-23 19:09:35 +02:00
Bas Nijholt
3b275e1dd3 start with YAML config validation 2020-09-23 18:20:25 +02:00
Bas Nijholt
5ff1da3c1b simplify schema creation 2020-09-23 13:11:50 +02:00
Bas Nijholt
d33a96fd04 simplify validation 2020-09-23 12:59:58 +02:00
Bas Nijholt
5a4da9512a use VALIDATION in switch.py 2020-09-23 12:35:57 +02:00
Bas Nijholt
a18a312ea9 styling 2020-09-20 18:38:01 +02:00
Bas Nijholt
d63abb4d28 commit working version but not with all options 2020-09-20 18:33:36 +02:00
Bas Nijholt
aea2e83a20 cleanup unused imports 2020-09-19 11:35:28 +02:00
Bas Nijholt
9d06be0883 WIP 2020-09-19 11:10:54 +02:00
Bas Nijholt
f444a8a142 need to change the name of folder to get strings.json working 2020-09-13 10:46:33 +02:00
Renamed from custom_components/circadian_lighting/__init__.py (Browse further)