Repository navigation
Commit c660fa6
fix(inverter): don't read Predbat's own dummy entity back as user config
is_real_entity_configured() accepted any value with a domain in it, but
create_entity() writes its own 'sensor.{prefix}_{type}_{id}_{field}' id
back into self.base.args - which is process-lifetime state, never re-read
from apps.yaml. Inverters are rebuilt from scratch on the balance path
(execute.py) as well as at startup, so from the second construction the
dummy is already sitting in args and read back as though the user had
configured it. Recreation is then skipped, leaving created_attributes
unpopulated on the new object and the state unrestored if it has gone
away; after an inverter type change, writes stay pointed at the stale
sensor named for the old type.
Add is_own_dummy_entity() and exclude those ids. The type sits in the
middle of the id and is matched loosely, so a dummy left from a previous
type is still recognised as ours rather than preserved as user intent.
Covered by two new cases in test_custom_type_respects_configured_time_entity
(rebuild, and rebuild across a type change); both fail with the new guard
stubbed out, so they exercise the fix rather than passing vacuously.
Patch from the triage bot on #4745, which could not push it itself.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent ddabc2f commit c660fa6
2 files changed
Lines changed: 71 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
304 | 323 | | |
305 | 324 | | |
306 | 325 | | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
312 | 332 | | |
313 | 333 | | |
314 | 334 | | |
315 | 335 | | |
316 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
317 | 340 | | |
318 | 341 | | |
319 | 342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
| |||
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
113 | 153 | | |
114 | 154 | | |
115 | 155 | | |
116 | 156 | | |
117 | 157 | | |
118 | 158 | | |
119 | 159 | | |
| 160 | + | |
| 161 | + | |
120 | 162 | | |
121 | 163 | | |
122 | 164 | | |
| |||
0 commit comments