Skip to content

feat(node-red): choose the energy command route: automatic, local only or cloud only - #198

Merged
Bre77 merged 1 commit into
mainfrom
fm/nodered-command-build-5
Nov 10, 2026
Merged

Bre77 merged 1 commit into
mainfrom
fm/nodered-command-build-5

Conversation

@Bre77

@Bre77 Bre77 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Adds a Route setting to the Energy Command node. Automatic is today's behaviour and what a node saved without the setting gets. Local only sends through the Local gateway with no cloud fallback: it errors when the node has no gateway for the site, when the gateway gives no answer, or when the gateway does not take the command (earlier names hit a cloud stand-in that refuses instead of reaching the cloud). Cloud only ignores the gateway, so signed commands need the site paired. In the editor the gateway row is hidden for Cloud only, Local only greys out every command the gateway does not take (from the endpoint's local flag), Cloud only no longer lets the gateway unlock paired commands, and the node label shows a non-automatic route. Checked in a local Node-RED 4.1 with a stubbed paired site; no Powerwall was contacted, and the local, no-answer and refusal paths are covered by tests against the fake gateway.

Local only: only commands the gateway takes

Cloud only: no gateway row

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Next included review available in 41 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 70 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8835e41 and b24dd0d.

Files selected for processing: 5

  • .changeset/node-red-energy-route.md
  • packages/node-red-contrib-teslemetry/README.md
  • packages/node-red-contrib-teslemetry/src/nodes/teslemetry-energy-command.html
  • packages/node-red-contrib-teslemetry/src/nodes/teslemetry-energy-command.ts
  • packages/node-red-contrib-teslemetry/test/teslemetry-energy-command-local.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@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)

@Bre77
Bre77 force-pushed the fm/nodered-command-build-4 branch from e83c5ba to 77b4665 Compare November 10, 2026 12:12
@Bre77
Bre77 force-pushed the fm/nodered-command-build-5 branch from 08a3f05 to 71f5595 Compare November 10, 2026 12:13

@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)

@Bre77
Bre77 force-pushed the fm/nodered-command-build-4 branch from 382f71a to 56753e8 Compare November 10, 2026 19:45
@Bre77
Bre77 force-pushed the fm/nodered-command-build-5 branch from b7dd532 to b168488 Compare November 10, 2026 19:45

@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)

@Bre77
Bre77 force-pushed the fm/nodered-command-build-5 branch from b168488 to 7f345da Compare November 10, 2026 19:59
Base automatically changed from fm/nodered-command-build-4 to main November 10, 2026 20:05
@Bre77
Bre77 force-pushed the fm/nodered-command-build-5 branch from 7f345da to b24dd0d Compare November 10, 2026 20:06

@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 10, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🟡 Medium risk · Adding Local-only and Cloud-only routing for energy commands could send site controls over an unintended path or cause commands to fail.

Adds a Route setting to the Energy Command node (Automatic, Local only, Cloud only) that controls whether commands go through the Local gateway, cloud, or both, with editor and label updates to match. No issues found.

✅ 1 closed
Closed: Bug: Local only greys out earlier-name commands that the gateway does run

📄 packages/node-red-contrib-teslemetry/src/nodes/teslemetry-energy-command.html:67-75 📄 packages/node-red-contrib-teslemetry/src/nodes/teslemetry-energy-command.ts:225-239
With Route set to Local only, updateCommands disables any option whose catalog[this.value] is missing or has no local flag. The legacy options under "Earlier names (still supported)" (setBackupReserve, setOperationMode*, gridExport*, dispatchBatteryPower, resumeBatteryOperation, goOffGrid, reconnectGrid) are not catalog keys, so they all get greyed out. At runtime, though, these commands go through run(...) and are sent to the gateway, and the new test Local only never reaches the cloud… uses legacy setBackupReserve on a local route. The editor therefore hides working choices, and the README's claim that "only commands the gateway takes are offered" is wrong for these names. One fix is to mark the legacy options that have a local form (for example with a teslemetry-local class) and treat that class as local in the check.

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 7e7b734 into main Nov 10, 2026
4 checks passed
@Bre77
Bre77 deleted the fm/nodered-command-build-5 branch November 10, 2026 20:11
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