-
Notifications
You must be signed in to change notification settings - Fork 151
fix: Replace deprecated functions for Core 2025.12.1 compatibility #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,11 +4,11 @@ | |||||
| from collections.abc import Mapping, Callable | ||||||
| from typing import Any | ||||||
| from homeassistant.components.automation import DOMAIN as AUTOMATION_DOMAIN | ||||||
| from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN, STATE_IDLE | ||||||
| from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN, CameraState | ||||||
| from homeassistant.components.group import DOMAIN as GROUP_DOMAIN | ||||||
| from homeassistant.components.humidifier import DOMAIN as HUMIDIFIER_DOMAIN | ||||||
| from homeassistant.components.input_boolean import DOMAIN as INPUT_BOOLEAN_DOMAIN | ||||||
| from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN | ||||||
| from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN, LockState | ||||||
| from homeassistant.components.media_player import DOMAIN as MEDIA_PLAYER_DOMAIN | ||||||
| from homeassistant.components.remote import DOMAIN as REMOTE_DOMAIN | ||||||
| from homeassistant.components.scene import DOMAIN as SCENE_DOMAIN | ||||||
|
|
@@ -20,7 +20,7 @@ | |||||
| SERVICE_RETURN_TO_BASE, | ||||||
| SERVICE_START, | ||||||
| SERVICE_STOP, | ||||||
| STATE_CLEANING, | ||||||
| VacuumActivity, | ||||||
| VacuumEntityFeature, | ||||||
| ) | ||||||
| from homeassistant.const import ( | ||||||
|
|
@@ -29,7 +29,6 @@ | |||||
| SERVICE_TURN_ON, | ||||||
| SERVICE_UNLOCK, | ||||||
| SERVICE_LOCK, | ||||||
| STATE_LOCKED, | ||||||
| STATE_ON, | ||||||
| STATE_PLAYING, | ||||||
| ) | ||||||
|
|
@@ -120,7 +119,7 @@ def _supported_domain() -> str: | |||||
| def _msg_generator( | ||||||
| self, | ||||||
| ) -> Callable[[str, ReadOnlyDict[Mapping[str, Any]]], str | int]: | ||||||
| return lambda state, attributes: MSG_OFF if state == STATE_IDLE else MSG_ON | ||||||
| return lambda state, attributes: MSG_OFF if state == CameraState.IDLE else MSG_ON | ||||||
|
||||||
| return lambda state, attributes: MSG_OFF if state == CameraState.IDLE else MSG_ON | |
| return lambda state, attributes: MSG_OFF if state == CameraState.IDLE.value else MSG_ON |
Copilot
AI
Dec 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comparison with LockState.LOCKED will fail because state is a string but LockState.LOCKED is an enum. The enum needs to be converted to its string value for comparison.
Change to:
return lambda state, attributes: MSG_OFF if state == LockState.LOCKED.value else MSG_ONor use:
return lambda state, attributes: MSG_OFF if state == str(LockState.LOCKED) else MSG_ON| return lambda state, attributes: MSG_OFF if state == LockState.LOCKED else MSG_ON | |
| return lambda state, attributes: MSG_OFF if state == LockState.LOCKED.value else MSG_ON |
Copilot
AI
Dec 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comparison with VacuumActivity.CLEANING will fail because state is a string but VacuumActivity.CLEANING is an enum. The enum needs to be converted to its string value for comparison.
Change to:
if state in [STATE_ON, VacuumActivity.CLEANING.value]or use:
if state in [STATE_ON, str(VacuumActivity.CLEANING)]| if state in [STATE_ON, VacuumActivity.CLEANING] | |
| if state in [STATE_ON, VacuumActivity.CLEANING.value] |
Uh oh!
There was an error while loading. Please reload this page.