Skip to content

feat(node-red): add charge/precondition schedule CRUD commands - #95

Merged
Bre77 merged 1 commit into
mainfrom
fm/nred-t2-schedule-crud
Aug 6, 2026
Merged

feat(node-red): add charge/precondition schedule CRUD commands#95
Bre77 merged 1 commit into
mainfrom
fm/nred-t2-schedule-crud

Conversation

@Bre77

@Bre77 Bre77 commented Aug 6, 2026

Copy link
Copy Markdown
Member

Intent

  • Node-RED's teslemetry-vehicle-command node exposed the legacy setScheduledCharging/setScheduledDeparture commands but not the location-based charge/precondition schedule CRUD endpoints (add/removeChargeSchedule, add/removePreconditionSchedule) that @teslemetry/api's TeslemetryVehicleApi already wraps.
    • Added four command cases following the existing switch-case pattern, each with validateParameters rules for its required/optional fields (days of week, enabled flags, lat/lon, HH:mm times reusing the node's existing timeToMinutesOfDay helper).
    • add*Schedule accepts an optional msg.id to update an existing schedule in place, matching the SDK/API contract (omit to create).
    • Updated the command dropdown and help text in teslemetry-vehicle-command.html.
    • Added example flows (inject → change → command → debug) to examples/all-features.json and a README bullet.

Add addChargeSchedule/removeChargeSchedule and
addPreconditionSchedule/removePreconditionSchedule cases to
teslemetry-vehicle-command, with parameter validation and example flows.
@Bre77 Bre77 added the fm Opened by a Firstmate crewmate label Aug 6, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ebeb75f468

ℹ️ 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".

Comment on lines +279 to +282
startEnabled: { required: true, type: "boolean" },
endEnabled: { required: true, type: "boolean" },
startTime: { type: "string" },
endTime: { type: "string" },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require times for enabled charge-schedule bounds

When a flow sets startEnabled: true without startTime, or endEnabled: true without endTime, these optional rules let validation pass and the subsequent request drops the corresponding undefined time during JSON serialization. The generated API contract documents start_time/end_time as omitted when the matching enabled flag is false (packages/api/src/client/types.gen.ts lines 16363-16369), so an enabled bound without its minutes value produces an invalid or ineffective schedule request; validate each time conditionally when its flag is true.

Useful? React with 👍 / 👎.

@Bre77
Bre77 merged commit 55c75a4 into main Aug 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fm Opened by a Firstmate crewmate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant