Fix battery_rate_max validation to accept float sensor values#3642
Merged
springfall2008 merged 2 commits intospringfall2008:mainfrom Mar 24, 2026
Merged
Conversation
battery_rate_max validation required integer but sensors like sigen_plant_ess_rated_discharging_power return float values (e.g. 9.6 kW). The downstream code (inverter.py get_arg with required_unit="W") already handles float-to-watts conversion correctly. Changed sensor_type from "integer" to "float" in config validation, matching the pattern used by export_limit and inverter_limit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two tests fail depending on time of day, causing spurious CI failures: 1. test_ohme_time_next_occurs_tomorrow: uses datetime.now() to compute "1 hour ago", which wraps past midnight after 23:00. Fixed by mocking datetime.now() to a fixed 14:00. 2. test_multi_car_iog_load_slots_regression: uses real now_utc to build IOG slot times. After 21:00 UTC, now+3h crosses midnight creating inconsistent state. Fixed by pinning now_utc to noon. Also added missing args["car_charging_limit"] for 2-car setup. Same class of bug as PR springfall2008#3512 (non-deterministic inverter test failure). The test suite has ~30 instances of datetime.now() across 15 test files without time mocking — consider adopting freezegun or a test helper that provides a fixed `now` as standard practice. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
battery_rate_maxconfig validation requiresintegerbut sensors (e.g. SIG'ssigen_plant_ess_rated_discharging_power) return float values like9.6(kW)int("9.6")raisesValueErrorinvalidate_is_int(), causing a validation error on every cyclesensor_typefrom"integer"to"float"in config.py, matching the pattern used byexport_limitandinverter_limitinverter.pyline 379,get_argwithrequired_unit="W") already handles float-to-watts conversion correctlyTest plan
pre-commit run --all-filespassesmulti_car_iogfailure unrelated)get_argconverts to 9600 W🤖 Generated with Claude Code