Skip to content

ina2xx_v2: discovery templates that work before the MQTT state is restored - #44

Merged
KrX3D merged 5 commits into
0_15from
fix/ina2xx-v2-discovery-templates-before-restore
Nov 25, 2026
Merged

KrX3D merged 5 commits into
0_15from
fix/ina2xx-v2-discovery-templates-before-restore

Conversation

@KrX3D

@KrX3D KrX3D commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner
  • Energy keys are only published after the retained MQTT state is restored, but the HA discovery templates always read them, so HA logged template errors (about 70 per day) for every publish in that window.
  • Energy val_tpl now 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.
  • The last_reset templates default the timestamp to 0 and render '' instead of none. A missing key used to make | int raise, and none rendered as "None", which HA logs as an invalid last_reset. timestamp_local is unchanged.

Changelog

🤖 Generated with Claude Code

KrX3D and others added 2 commits November 16, 2026 10:57
…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]>
KrX3D and others added 2 commits November 19, 2026 18:21
…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]>
@KrX3D

KrX3D commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

localy added

@KrX3D
KrX3D merged commit 4ec12fd into 0_15 Nov 25, 2026
@KrX3D
KrX3D deleted the fix/ina2xx-v2-discovery-templates-before-restore branch November 25, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant