Repository navigation
ina2xx_v2: discovery templates that work before the MQTT state is restored - #44
Merged
Merged
Conversation
…TT restore
Energy keys are only published after the retained state is restored, but
the HA discovery templates always read them, so HA logged template errors
on every publish in that window. The energy val_tpl now uses default(''),
and the last_reset templates default the timestamp to 0 and render ''
instead of none; HA ignores empty values and keeps the last state.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tore Brings in #33. This branch had converted ina2xx_v2.cpp from CRLF to LF, so its diff rewrote the whole file and reverted #33. The merge keeps 0_15's line endings and re-applies only the template change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tore Brings in #41. Its last_reset template replaces this branch's (it already treats a missing timestamp as 0); only its 'else none' becomes 'else ''' so HA skips it instead of logging an invalid last_reset. Co-Authored-By: Claude Opus 5.5 <[email protected]>
value_json.<key>|int(0) still fails with 'dict object has no attribute' when the key is missing (checked with HA's template API). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
Author
|
localy added |
…tore Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
val_tplnow uses| default(''). For numeric sensors HA ignores an empty state and keeps the last value, so the sensors don't flash to unknown after a reboot.last_resettemplates default the timestamp to 0 and render''instead ofnone. A missing key used to make| intraise, andnonerendered as"None", which HA logs as an invalid last_reset.timestamp_localis unchanged.Changelog
0_15in (brings ina2xx_v2: fix total energy doubling on every boot #33). This branch had turned ina2xx_v2.cpp from CRLF into LF, so its diff rewrote the whole file and reverted ina2xx_v2: fix total energy doubling on every boot #33; the merge keeps 0_15's line endings and only the template change remains. Compiles for esp32dev with WLED_DEBUG.0_15in (brings ina2xx_v2: retry after I2C errors instead of disabling, fix HA last_reset offset #41). The last_reset part now builds on ina2xx_v2: retry after I2C errors instead of disabling, fix HA last_reset offset #41's template inina2xx_v2.h: a missing timestamp defaults to 0 and 0 renders''instead ofnone. Rendered in HA's template API: real timestamp -> local midnight, 0 and missing key -> empty, no error. Compiles for esp32dev with WLED_DEBUG.0_15in (brings ina2xx_v2: publish on relative change plus heartbeat #42 and themainsync); no conflicts, PR diff unchanged. Compiles for esp32dev with WLED_DEBUG.🤖 Generated with Claude Code