-
Notifications
You must be signed in to change notification settings - Fork 0
Changes to be committed: #8
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
Conversation
modified: .devcontainer.json modified: .github/ISSUE_TEMPLATE/bug.yml modified: .github/ISSUE_TEMPLATE/feature_request.yml modified: CONTRIBUTING.md modified: config/configuration.yaml renamed: custom_components/utility_meter_evolved/__init__.py -> custom_components/utility_meter_next_gen/__init__.py renamed: custom_components/utility_meter_evolved/config_flow.py -> custom_components/utility_meter_next_gen/config_flow.py renamed: custom_components/utility_meter_evolved/const.py -> custom_components/utility_meter_next_gen/const.py renamed: custom_components/utility_meter_evolved/diagnostics.py -> custom_components/utility_meter_next_gen/diagnostics.py renamed: custom_components/utility_meter_evolved/icons.json -> custom_components/utility_meter_next_gen/icons.json renamed: custom_components/utility_meter_evolved/manifest.json -> custom_components/utility_meter_next_gen/manifest.json renamed: custom_components/utility_meter_evolved/readme.md -> custom_components/utility_meter_next_gen/readme.md renamed: custom_components/utility_meter_evolved/select.py -> custom_components/utility_meter_next_gen/select.py renamed: custom_components/utility_meter_evolved/sensor.py -> custom_components/utility_meter_next_gen/sensor.py renamed: custom_components/utility_meter_evolved/services.yaml -> custom_components/utility_meter_next_gen/services.yaml renamed: custom_components/utility_meter_evolved/strings.json -> custom_components/utility_meter_next_gen/strings.json renamed: custom_components/utility_meter_evolved/translations/en.json -> custom_components/utility_meter_next_gen/translations/en.json modified: hacs.json modified: scripts/develop modified: tests/components/utility_meter_evolved/test_sensor.py
Reviewer's GuideThis PR renames the custom component from utility_meter_evolved to utility_meter_next_gen, introduces a new “source_calc_multiplier” configuration option throughout the config flow, schemas, sensor logic, migration routines and documentation, refines tariff handling to remove “total” case-insensitively, and bumps the integration version to support the new option. Class diagram for UtilityMeterSensor with source_calc_multiplierclassDiagram
class UtilityMeterSensor {
- _attr_multiplier
- _attr_calculated_value
+ __init__(..., source_calc_multiplier, ...)
+ async_reset_meter(entity_id)
+ extra_state_attributes()
}
UtilityMeterSensor : +source_calc_multiplier
UtilityMeterSensor : +_attr_multiplier
UtilityMeterSensor : +extra_state_attributes includes source_calc_multiplier
Class diagram for config flow schemas with source_calc_multiplierclassDiagram
class ConfigFlowSchema {
+create_option_schema_cron(data)
+create_option_schema_predefined(data)
+PREDEFINED_CYCLES_SCHEMA
+CRON_CYCLES_SCHEMA
}
ConfigFlowSchema : +CONF_SOURCE_CALC_MULTIPLIER in schemas
ConfigFlowSchema : +create_option_schema_cron includes source_calc_multiplier
ConfigFlowSchema : +create_option_schema_predefined includes source_calc_multiplier
ConfigFlowSchema : +PREDEFINED_CYCLES_SCHEMA includes source_calc_multiplier
ConfigFlowSchema : +CRON_CYCLES_SCHEMA includes source_calc_multiplier
Class diagram for migration routine with source_calc_multiplierclassDiagram
class MigrationRoutine {
+async_migrate_entry(hass, config_entry)
}
MigrationRoutine : +adds CONF_SOURCE_CALC_MULTIPLIER with default 1 on version 2->3
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 @cabberley - I've reviewed your changes - here's some feedback:
- The migration logic logs success twice and may re‐migrate version 2 entries—consider updating the entry version immediately after each migration step and consolidating the log to avoid duplicate runs.
- The same vol.Required(CONF_SOURCE_CALC_MULTIPLIER) selector is repeated across multiple schemas—extract it into a shared helper to reduce duplication.
- Avoid checking for “total” in multiple cases; normalize tariff strings to lower‐case once and compare against a single value for more maintainable logic.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The migration logic logs success twice and may re‐migrate version 2 entries—consider updating the entry version immediately after each migration step and consolidating the log to avoid duplicate runs.
- The same vol.Required(CONF_SOURCE_CALC_MULTIPLIER) selector is repeated across multiple schemas—extract it into a shared helper to reduce duplication.
- Avoid checking for “total” in multiple cases; normalize tariff strings to lower‐case once and compare against a single value for more maintainable logic.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
modified: .devcontainer.json
modified: .github/ISSUE_TEMPLATE/bug.yml
modified: .github/ISSUE_TEMPLATE/feature_request.yml
modified: CONTRIBUTING.md
modified: config/configuration.yaml
renamed: custom_components/utility_meter_evolved/init.py -> custom_components/utility_meter_next_gen/init.py
renamed: custom_components/utility_meter_evolved/config_flow.py -> custom_components/utility_meter_next_gen/config_flow.py
renamed: custom_components/utility_meter_evolved/const.py -> custom_components/utility_meter_next_gen/const.py
renamed: custom_components/utility_meter_evolved/diagnostics.py -> custom_components/utility_meter_next_gen/diagnostics.py
renamed: custom_components/utility_meter_evolved/icons.json -> custom_components/utility_meter_next_gen/icons.json
renamed: custom_components/utility_meter_evolved/manifest.json -> custom_components/utility_meter_next_gen/manifest.json
renamed: custom_components/utility_meter_evolved/readme.md -> custom_components/utility_meter_next_gen/readme.md
renamed: custom_components/utility_meter_evolved/select.py -> custom_components/utility_meter_next_gen/select.py
renamed: custom_components/utility_meter_evolved/sensor.py -> custom_components/utility_meter_next_gen/sensor.py
renamed: custom_components/utility_meter_evolved/services.yaml -> custom_components/utility_meter_next_gen/services.yaml
renamed: custom_components/utility_meter_evolved/strings.json -> custom_components/utility_meter_next_gen/strings.json
renamed: custom_components/utility_meter_evolved/translations/en.json -> custom_components/utility_meter_next_gen/translations/en.json
modified: hacs.json
modified: scripts/develop
modified: tests/components/utility_meter_evolved/test_sensor.py
Summary by Sourcery
Rebrand the utility meter component to utility_meter_next_gen, introduce a source calculation multiplier with config flow support and migration, and refine tariff selection behavior.
New Features:
Enhancements:
Documentation:
Tests:
Chores: