Skip to content

feat(node-red): Local Read node for the Powerwall gateway on the LAN - #201

Merged
Bre77 merged 2 commits into
mainfrom
fm/node-red-local-reads
Nov 18, 2026
Merged

Bre77 merged 2 commits into
mainfrom
fm/node-red-local-reads

Conversation

@Bre77

@Bre77 Bre77 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Adds a Local Read node (teslemetry-local-powerwall-read) on the existing Local Powerwall config node, so Node-RED can read a Powerwall gateway on the LAN without the cloud. It polls inside the node every 10 s by default (2 s to 24 h, 0 reads only on input), also reads once on any input message, and sends the gateway's reply as returned in msg.payload with the read name in msg.topic; the status shows the last read time or the error, a gateway that stays down while polling is logged once rather than every poll, and polling stops on close/redeploy. The read selector covers every read the bundled tesla-fleet-api Powerwall client already has: live status (its cloud-shaped live_status built from aggregates, status and grid status, with null where the gateway has no source), meters aggregates, system status, device controller, grid status, state of energy (app and raw scale), gateway config, Powerwall 3 components, firmware and backup events. Cloud event and command nodes are unchanged and nothing is merged into the cloud live_status; one node with a read dropdown is the default design here and is easy to split into per-read nodes if preferred. Tests drive the node against the fake gateway, which now also answers the REST reads.

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitar has auto-approved this PR (configure)

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitar has auto-approved this PR (configure)

@gitar-bot

gitar-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findings

Adding a Node-RED node that polls authenticated Powerwall LAN endpoints could repeatedly expose gateway status and configuration data to connected flows.

Adds a Local Read node for reading a Powerwall gateway on the LAN without the cloud, with polling, read-on-input, and a read selector covering all bundled Powerwall reads. The resolved finding was a large poll interval overflowing setTimeout into a 1 ms poll loop, now capped at 24 h. No open issues remain.

✅ 1 closed
✅ Edge Case: Large poll interval overflows setTimeout into a 1 ms poll loop

📄 packages/node-red-contrib-teslemetry/src/validation.ts:110-120 📄 packages/node-red-contrib-teslemetry/src/nodes/teslemetry-local-powerwall-read.ts:67
pollInterval puts a floor on the interval but no ceiling. If the result is above 2^31−1 ms (about 24.8 days, e.g. interval: 3000000), Node.js emits a TimeoutOverflowWarning and sets the delay to 1 ms. poll() then re-arms itself almost at once and hits the gateway in a tight loop, which is the opposite of what a long interval asks for. Cap the value in pollInterval, and add the same check to the editor's validate if you want it rejected there too.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Approved

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@Bre77
Bre77 merged commit ddc4ae0 into main Nov 18, 2026
3 checks passed
@Bre77
Bre77 deleted the fm/node-red-local-reads branch November 18, 2026 01:55
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