Update some deprecated code - #360
Open
Alexious-sh wants to merge 4 commits into
Open
Conversation
added 4 commits
January 4, 2025 15:02
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.
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 |
|
+1, please merge this, plugin is not working right now |
|
Check #422 and Update integration |
Check #422 |
This file contains hidden or 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
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_CELSIUSconstants are removed from thehomeassistant.constin favor of UnitOfInformation and UnitOfTemperature subclasses with corresponding fields;SOURCE_TYPE_ROUTERis no longer available in thehomeassistant.components.device_tracker. There is a newSourceType.ROUTERfield;homeassistant.helpers.typing.ServiceCallTypeis deprecated and will be removed soon. Use thehomeassistant.core.ServiceCallinstead;homeassistant.backports.enum.StrEnumis no longer needed and will be removed soon.enum.StrEnumis now available;Should fix the #359
Summary by Sourcery
Update deprecated Home Assistant constants and types.
Bug Fixes:
Enhancements:
homeassistant.constconstants withUnitOfInformationandUnitOfTemperaturesubclasses.homeassistant.components.device_tracker.SOURCE_TYPE_ROUTERwithSourceType.ROUTER.homeassistant.helpers.typing.ServiceCallTypewithhomeassistant.core.ServiceCall.homeassistant.backports.enum.StrEnumsinceenum.StrEnumis now available.