Skip to content

Add generic ioBroker vehicle template - #33113

Open
andig wants to merge 3 commits into
masterfrom
iobroker-vehicle
Open

Add generic ioBroker vehicle template#33113
andig wants to merge 3 commits into
masterfrom
iobroker-vehicle

Conversation

@andig

@andig andig commented Aug 23, 2026

Copy link
Copy Markdown
Member

Adds a generic iobroker vehicle template, modeled after the existing ioBroker charger and meter templates (rest-api adapter, basic auth, URL-encoded datapoint ids). Any ioBroker adapter that exposes vehicle data can now be used, not just ioBroker.bmw.

Feature set is on par with the generic Home Assistant vehicle:

Home Assistant ioBroker
soc, range, status, statusA/B/C, limitSoc, odometer, climater, finishTime same param names
start_charging / stop_charging chargeEnable (single writable datapoint)
wakeup, setMaxCurrent same

statusA/B/C accept comma-separated datapoint values and compile into a jq mapping to A/B/C. If none are given the raw value is passed through, so a datapoint that already yields A/B/C works without further configuration.

The BMW-specific ioBroker.bmw template is marked deprecated: true. Existing configurations keep resolving via ByName, it is only hidden from new configurations.


🤖 Generated with Claude Code

Deprecates the BMW-specific ioBroker template in favour of a generic one modeled after the ioBroker charger and meter templates.
@andig andig added the vehicles Specific vehicle support label Aug 23, 2026
@github-actions github-actions Bot added the enhancement New feature or request label Aug 23, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 3 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="templates/definition/vehicle/iobroker.tpl" line_range="12-17" />
<code_context>
+  quote: true
+  jq: {{ .jq }}
+{{- end }}
+{{- if .user }}
+  auth:
+    type: basic
+    user: {{ .user }}
+    password: {{ .password }}
+{{- end }}
+{{- end }}
+
</code_context>
<issue_to_address>
**issue (bug_risk):** The template enables Basic authentication when `.user` is set, even if `.password` is absent. This contradicts the template's documented behavior that no password means no authentication and sends requests with an empty password instead of unauthenticated requests.

**Triggers:** When a configuration supplies `user` without `password`.

**Suggested fix:** Gate the `auth` blocks on `.password` (or on both `.user` and `.password`) so missing credentials do not enable Basic authentication.
</issue_to_address>

### Comment 2
<location path="templates/definition/vehicle/iobroker.yaml" line_range="23" />
<code_context>
+  - name: uri
+    required: true
+    description:
+      en: The full uri of the host to query
+      de: Der vollständige URI der ioBroker Instanz
+    example: https://iobroker.homelab.lan:8082
</code_context>
<issue_to_address>
**issue (review_instructions):** Use consistent capitalization for the technical term `URI`.

Please change `uri` to `URI` here, matching the capitalization used for this acronym elsewhere in the template documentation and parameter terminology.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `templates/**/*.yaml`

**Instructions:**
Verify that the changes comply to the rules defined in templates/README.md. Also check consistence (wording) with other files inside templates directory.

</details>
</issue_to_address>

### Comment 3
<location path="templates/definition/vehicle/iobroker.yaml" line_range="24" />
<code_context>
+    required: true
+    description:
+      en: The full uri of the host to query
+      de: Der vollständige URI der ioBroker Instanz
+    example: https://iobroker.homelab.lan:8082
+  - name: cache
</code_context>
<issue_to_address>
**issue (review_instructions):** Correct the German article for `URI`.

`URI` is conventionally feminine in German; use `Die vollständige URI der ioBroker-Instanz` (including the hyphenated compound) for consistent, idiomatic wording.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `templates/**/*.yaml`

**Instructions:**
Verify that the changes comply to the rules defined in templates/README.md. Also check consistence (wording) with other files inside templates directory.

</details>
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and the template adds HTTP write operations that can start or stop charging, change the charging current, or wake a vehicle through configured ioBroker datapoints. If the mapping or value handling is wrong, a command can take effect before the change is reverted, leaving an external vehicle action and associated energy or access impact that reverting cannot undo.

Blocking findings: templates/definition/vehicle/iobroker.tpl:17


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +12 to +17
{{- if .user }}
auth:
type: basic
user: {{ .user }}
password: {{ .password }}
{{- end }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): The template enables Basic authentication when .user is set, even if .password is absent. This contradicts the template's documented behavior that no password means no authentication and sends requests with an empty password instead of unauthenticated requests.

Triggers: When a configuration supplies user without password.

Suggested fix: Gate the auth blocks on .password (or on both .user and .password) so missing credentials do not enable Basic authentication.

Comment thread templates/definition/vehicle/iobroker.yaml
Comment thread templates/definition/vehicle/iobroker.yaml
@Chris685

Chris685 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Actually this is not possible to request. We have to change following topic:

See also discription of this Adapter: https://github.com/ioBroker/ioBroker.rest-api#usage

At the same time, we should also change the port from 8082 to the generic 8093. This will work for more people plug & play.

Request from EVCC:
http://192.168.1.21:8093/rest-api/v1/state/bmw.0.WBA8E9G50GM091234.stream.vehicle.drivetrain.batteryManagement.header.value/plain?extraPlain=true

Working one:
http://192.168.1.21:8093/v1/state/bmw.0.WBA8E9G50GM091234.stream.vehicle.drivetrain.batteryManagement.header.value/plain?extraPlain=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request vehicles Specific vehicle support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants