-
-
Notifications
You must be signed in to change notification settings - Fork 29
Update some deprecated code #360
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?
Conversation
Signed-off-by: Oleksii Shavykin <oshavykin@smarttech.com>
Signed-off-by: Oleksii Shavykin <oshavykin@smarttech.com>
Signed-off-by: Oleksii Shavykin <oshavykin@smarttech.com>
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 <oshavykin@smarttech.com>
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.
@dmamontov Any chance of getting this merged? The plugin is currently broken in later versions of HA without these changes. |
https://dzen.ru/a/Z6nGKuT6lhYnWdor |
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.