-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Update some deprecated code #360
Open
Alexious-sh
wants to merge
4
commits into
dmamontov:main
Choose a base branch
from
Alexious-sh:fix/deprecated-2025.1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+18
−18
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Oleksii Shavykin <[email protected]>
Signed-off-by: Oleksii Shavykin <[email protected]>
Signed-off-by: Oleksii Shavykin <[email protected]>
This change fixes the warning light.miwifi_* (<class 'custom_components.miwifi.light.MiWifiLight'>) does not set supported color modes, this will stop working in Home Assistant Core 2025.3 Signed-off-by: Oleksii Shavykin <[email protected]>
Reviewer's Guide by SourceryThis PR updates deprecated code from Home Assistant core and some libraries. It also fixes the light component to report supported color modes. Class diagram showing updated type changesclassDiagram
class MiWifiServiceCall {
+get_updater(service: ServiceCall) LuciUpdater
+async_call_service(service: ServiceCall)* void
}
class MiWifiCalcPasswdServiceCall {
+salt_old: str
+salt_new: str
+async_call_service(service: ServiceCall) void
}
class MiWifiRequestServiceCall {
+async_call_service(service: ServiceCall) void
}
class MiWifiLight {
-_attr_is_on: bool
-_attr_color_mode: ColorMode
-_attr_supported_color_modes: Set~ColorMode~
+_handle_coordinator_update() void
}
MiWifiServiceCall <|-- MiWifiCalcPasswdServiceCall
MiWifiServiceCall <|-- MiWifiRequestServiceCall
note for MiWifiServiceCall "Updated to use ServiceCall instead of ServiceCallType"
note for MiWifiLight "Added color mode support"
State diagram for updated constants and enumsstateDiagram-v2
[*] --> Constants
Constants --> UnitOfInformation: DATA_MEGABYTES replaced
Constants --> UnitOfTemperature: TEMP_CELSIUS replaced
Constants --> SourceType: SOURCE_TYPE_ROUTER replaced
state Constants {
UnitOfInformation: MEGABYTES
UnitOfTemperature: CELSIUS
SourceType: ROUTER
}
note right of Constants
Updated deprecated constants
to use new enum classes
end note
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @Alexious-sh - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are several slight refactorings to get rid of errors and warnings, caused by deprecated HA code usage, including:
DATA_MEGABYTES
,TEMP_CELSIUS
constants are removed from thehomeassistant.const
in favor of UnitOfInformation and UnitOfTemperature subclasses with corresponding fields;SOURCE_TYPE_ROUTER
is no longer available in thehomeassistant.components.device_tracker
. There is a newSourceType.ROUTER
field;homeassistant.helpers.typing.ServiceCallType
is deprecated and will be removed soon. Use thehomeassistant.core.ServiceCall
instead;homeassistant.backports.enum.StrEnum
is no longer needed and will be removed soon.enum.StrEnum
is now available;Should fix the #359
Summary by Sourcery
Update deprecated Home Assistant constants and types.
Bug Fixes:
Enhancements:
homeassistant.const
constants withUnitOfInformation
andUnitOfTemperature
subclasses.homeassistant.components.device_tracker.SOURCE_TYPE_ROUTER
withSourceType.ROUTER
.homeassistant.helpers.typing.ServiceCallType
withhomeassistant.core.ServiceCall
.homeassistant.backports.enum.StrEnum
sinceenum.StrEnum
is now available.