-
Notifications
You must be signed in to change notification settings - Fork 104
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
Improvement/recursive handle sensor dependencies #377
Improvement/recursive handle sensor dependencies #377
Conversation
…f visibility and dependencies. Ensure sensors are added to startup set regardless of visibility, and only include them in SOPT if explicitly requested or if they are direct dependencies. Enhance dependency tracking to avoid unnecessary affects tracking.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #377 +/- ##
==========================================
+ Coverage 70.82% 70.96% +0.13%
==========================================
Files 26 26
Lines 1868 1877 +9
==========================================
+ Hits 1323 1332 +9
Misses 545 545 ☔ View full report in Codecov by Sentry. |
self[DEFS.serial] = SensorOption( | ||
sensor=DEFS.serial, schedule=Schedule(), visible=False | ||
) | ||
self._add_sensor_with_deps(DEFS.rated_power, visible=False) |
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.
Is it possible to add rated_power or serial in your config?
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.
(or will visible always be false?)
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.
I made it so that all dependencies that are not defined in the config are hidden by default. There are further improvements to this branch on other branches, but my repo has diverged from this one somewhat.
schedule=get_schedule(dep, SCHEDULES), | ||
) | ||
self[dep].affects.add(sopt.sensor) | ||
self._add_sensor_with_deps(sen, visible=True) |
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.
Don't we need a first=True here as well? (passed to the SensorOptions?) - #374 made me think of this
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.
I made this change because of failing tests. Will look into it if it is necessary.
Thanks @maslyankov - this seems to fix some startup (restart) issues for me as well |
tested and works:
build: https://github.com/maslyankov/sunsynk/actions/runs/12509593568
image: ghcr.io/maslyankov/hass-addon-sunsynk-multi:edge
Resulting improvement in config:
now becomes: