Skip to content

Conversation

@ademuri
Copy link
Contributor

@ademuri ademuri commented Jan 17, 2026

  • 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.

Addresses a point from #1195.

@ademuri ademuri marked this pull request as ready for review January 19, 2026 04:40
@ademuri ademuri requested a review from basnijholt as a code owner January 19, 2026 04:40
@basnijholt
Copy link
Owner

Awesome! Thanks for all the PRs. There seems to be one failing job still (pre-commit).

@ademuri ademuri marked this pull request as draft January 20, 2026 06:28
@ademuri ademuri force-pushed the bronze-action-setup branch 3 times, most recently from 999fda6 to 0020cdd Compare January 20, 2026 06:43
@ademuri ademuri marked this pull request as ready for review January 20, 2026 06:52
@basnijholt
Copy link
Owner

@all-contributors please add @ademuri for code

@allcontributors
Copy link
Contributor

@basnijholt

I've put up a pull request to add @ademuri! 🎉

@basnijholt
Copy link
Owner

basnijholt commented Jan 20, 2026

Thanks for working on this!

Python 3.12 type syntax

The change from type AdaptiveSwitches = ... to AdaptiveSwitches = ... isn't needed - our earliest supported HA version (2024.12.5) requires Python 3.12, and the type statement was introduced in Python 3.12 (PEP 695). Why did you make this change?

Comment on lines 1684 to 1685
type AdaptiveSwitches = list[AdaptiveSwitch]
type AdaptiveSwitchMap = dict[AdaptiveSwitch, list[str]]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a result of running ruff check . --fix. Looks like the Ruff target Python version is currently set to 3.10.

I ran Ruff because Home Assistant core requires it, but I don't see it in either of the READMEs. Should it be used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted this change.

README.md Outdated
| `entity_id` | The `entity_id` of the switch with the settings to apply. 📝 | ✅ | list of `entity_id`s |
| `lights` | A light (or list of lights) to apply the settings to. 💡 | ❌ | list of `entity_id`s |
| `transition` | Duration of transition when lights change, in seconds. 🕑 | | `float` 0-6553 |
| `transition` | Duration of transition when lights change, in seconds. 🕑 | | `float` 0-6553 |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you make it a required attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was unintentional, I think related to initial_transition not being present for apply_service_schema. The default is now None in the schema - will that cause any issues?

ademuri and others added 7 commits January 20, 2026 22:07
- 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.
@ademuri ademuri force-pushed the bronze-action-setup branch from 0020cdd to d3190be Compare January 21, 2026 05:07
@ademuri ademuri force-pushed the bronze-action-setup branch from d3190be to 9c3f4ab Compare January 21, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants