Repository navigation
fix: add ESPHome DSMR object ID aliases - #9
Conversation
Co-authored-by: Tommy Lindgren <tommy@lindgrens.nu> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be9c9eeaf9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| end | ||
|
|
||
| host.set_make(make_name) | ||
| host.set_poll_interval(poll_ms) |
There was a problem hiding this comment.
Remove the unsupported poll-interval host call
On the declared ftw-core host API v1, scheduling is driven by the number returned from driver_poll; host.set_poll_interval is not part of that runtime contract. Any ESPHome DSMR instance reaches this line during driver_init, so on the packaged target this attempts to call a nil host function and the driver never starts polling; the existing return poll_ms/return backoff_ms() paths should be used instead or the call must be feature-guarded.
AGENTS.md reference: AGENTS.md:L27-L27
Useful? React with 👍 / 👎.
| if phase_w[i] ~= nil then host.emit_metric("meter_l" .. i .. "_w", phase_w[i], "W") end | ||
| if v[i] ~= nil then host.emit_metric("meter_l" .. i .. "_v", v[i], "V") end | ||
| if a[i] ~= nil then host.emit_metric("meter_l" .. i .. "_a", a[i], "A") end |
There was a problem hiding this comment.
Avoid emitting diagnostics through an undeclared host API
When any documented phase alias is present, the poll path reaches these host.emit_metric calls after host.emit("meter", ...), but emit_metric is not in the declared host API v1 for this package target. On hosts that only expose the contract APIs, each successful phase poll will raise attempt to call field 'emit_metric' (a nil value) and mark the poll failed; diagnostic metrics should be omitted or guarded unless the target runtime declares them.
AGENTS.md reference: AGENTS.md:L27-L27
Useful? React with 👍 / 👎.
What changed
esphome-dsmras the public editable source for FTWWhy
ESPHome DSMR firmware often derives object IDs from entity names. FTW only probed Sourceful Zap IDs, so sites such as SlimmeLezer+ lost per-phase current and power data. Tommy Lindgren validated the fix on live hardware in FTW #617, which fixes FTW #613.
This PR moves the editable implementation to this repository. FTW will keep only a traced offline recovery snapshot and host tests.
Checks
make test-driver ID=esphome-dsmruv run --frozen --extra package --extra dev pytest -q drivers/tests/test_esphome_dsmr_aliases.pymake package-driver ID=esphome-dsmr TARGET=ftw-coremake check— 2,585 passed, 490 skipped; all 62 drivers passed sandbox checks