From 670fb8bc81b1d2a5f00edd1fbabdc5078dbf7832 Mon Sep 17 00:00:00 2001 From: Piotr Trzcinski Date: Sun, 11 Oct 2026 09:14:55 +0200 Subject: [PATCH] feat: trim config to Toyota Proace City with Vgate iCar Pro BLE Single OBD device with standard SAE J1979 PIDs, matching template, Polish README pointing to the Gitea-hosted app, GitHub-only files removed. Co-Authored-By: Claude Opus 5.5 --- .github/FUNDING.yml | 1 - .../ISSUE_TEMPLATE/car_pid_contribution_en.md | 39 - .../ISSUE_TEMPLATE/car_pid_contribution_ko.md | 39 - .github/PULL_REQUEST_TEMPLATE.md | 25 - .../pull_request_template_en.md | 25 - .../pull_request_template_ko.md | 25 - CONTRIBUTING.ko.md | 89 -- CONTRIBUTING.md | 91 -- README.ko.md | 829 ------------------ README.md | 791 +---------------- config.yaml | 314 ++----- templates.yaml | 563 ++---------- 12 files changed, 196 insertions(+), 2635 deletions(-) delete mode 100644 .github/FUNDING.yml delete mode 100644 .github/ISSUE_TEMPLATE/car_pid_contribution_en.md delete mode 100644 .github/ISSUE_TEMPLATE/car_pid_contribution_ko.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template_en.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template_ko.md delete mode 100644 CONTRIBUTING.ko.md delete mode 100644 CONTRIBUTING.md delete mode 100644 README.ko.md diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 2204d66..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: eigger diff --git a/.github/ISSUE_TEMPLATE/car_pid_contribution_en.md b/.github/ISSUE_TEMPLATE/car_pid_contribution_en.md deleted file mode 100644 index ff28247..0000000 --- a/.github/ISSUE_TEMPLATE/car_pid_contribution_en.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -name: "๐Ÿš— Vehicle PID Contribution (English)" -about: Share your vehicle's working OBD-II PID configuration. -title: "[Vehicle] Manufacturer Model (Year)" -labels: vehicle-config -assignees: '' ---- - -### 1. Vehicle Information -* **Manufacturer**: -* **Model**: -* **Year**: -* **Engine/Fuel Type**: (e.g., Gasoline, Diesel, Hybrid, EV) - -### 2. Connection Settings -* **OBD-II Adapter Model**: (e.g., vLinker MC+, ELM327 v1.5) -* **OBD Protocol / Init Commands (If any)**: (e.g., `ATSP6`, `ATSP0` or leave blank if standard) - -### 3. Sensor List -Please list the OBD PIDs you successfully configured. - -| Sensor Name | Mode | PID | Formula (Decoding) | Unit | Description | Update Interval | -| :--- | :--- | :--- | :--- | :--- | :--- | :--- | -| *e.g., Engine Oil Temp* | *22* | *1008* | *a - 40* | *ยฐC* | *Engine oil temperature* | *10s* | -| | | | | | | | -| | | | | | | | - -*Note: In the formula, use `a`, `b`, `c`, `d`, etc., for response bytes.* - -### 4. Raw YAML Draft (Optional) -If you have already generated a YAML config draft in the app or wrote one yourself, paste it here: - -```yaml -# Paste your YAML snippet here if available -``` - -### 5. Verification -* [ ] I have successfully tested these PIDs in my car using the HassBle app. -* Additional comments or screenshots: diff --git a/.github/ISSUE_TEMPLATE/car_pid_contribution_ko.md b/.github/ISSUE_TEMPLATE/car_pid_contribution_ko.md deleted file mode 100644 index c015b64..0000000 --- a/.github/ISSUE_TEMPLATE/car_pid_contribution_ko.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -name: "๐Ÿš— ์ฐจ๋Ÿ‰ PID ์ œ๋ณด (Korean)" -about: ์ž‘๋™ ํ™•์ธ๋œ ์ฐจ๋Ÿ‰์˜ OBD-II PID ์„ค์ •์„ ๊ณต์œ ํ•ด ์ฃผ์„ธ์š”. -title: "[Vehicle] ์ œ์กฐ์‚ฌ ๋ชจ๋ธ๋ช… (์—ฐ์‹)" -labels: vehicle-config -assignees: '' ---- - -### 1. ์ฐจ๋Ÿ‰ ์ •๋ณด -* **์ œ์กฐ์‚ฌ (Manufacturer)**: -* **๋ชจ๋ธ๋ช… (Model)**: -* **์—ฐ์‹ (Year)**: -* **์œ ์ข…/์—”์ง„ ํ˜•์‹**: (์˜ˆ: ๊ฐ€์†”๋ฆฐ, ๋””์ ค, ํ•˜์ด๋ธŒ๋ฆฌ๋“œ, EV) - -### 2. ์—ฐ๊ฒฐ ์„ค์ • -* **OBD-II ์–ด๋Œ‘ํ„ฐ ๋ชจ๋ธ**: (์˜ˆ: vLinker MC+, ELM327 v1.5) -* **OBD ํ”„๋กœํ† ์ฝœ / ์ดˆ๊ธฐํ™” ๋ช…๋ น์–ด**: (์˜ˆ: `ATSP6`, `ATSP0` ๋˜๋Š” ํ‘œ์ค€ ๊ทœ๊ฒฉ์ผ ๊ฒฝ์šฐ ์ƒ๋žต ๊ฐ€๋Šฅ) - -### 3. ์„ผ์„œ ๋ชฉ๋ก -์ •์ƒ ์ž‘๋™ ํ™•์ธ๋œ PID ๋ชฉ๋ก์„ ์ž‘์„ฑํ•ด ์ฃผ์„ธ์š”. - -| ์„ผ์„œ ์ด๋ฆ„ (์˜๋ฌธ ๊ถŒ์žฅ) | Mode | PID | ๋ณ€ํ™˜ ์ˆ˜์‹ (Formula) | ๋‹จ์œ„ (Unit) | ์„ค๋ช… | ํด๋ง ์ฃผ๊ธฐ | -| :--- | :--- | :--- | :--- | :--- | :--- | :--- | -| *์˜ˆ) engine_oil_temp* | *22* | *1008* | *a - 40* | *ยฐC* | *์—”์ง„ ์˜ค์ผ ์˜จ๋„* | *10s* | -| | | | | | | | -| | | | | | | | - -*์ฐธ๊ณ : ์ˆ˜์‹์—๋Š” ์ˆ˜์‹  ๋ฐ”์ดํŠธ ์ˆœ์„œ๋Œ€๋กœ `a`, `b`, `c`, `d` ๋“ฑ์„ ๋ณ€์ˆ˜๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.* - -### 4. YAML ์ดˆ์•ˆ (์„ ํƒ ์‚ฌํ•ญ) -์•ฑ์—์„œ ๋‚ด๋ณด๋‚ธ YAML์ด๋‚˜ ์ง์ ‘ ์ž‘์„ฑํ•œ ์ดˆ์•ˆ์ด ์žˆ๋‹ค๋ฉด ์•„๋ž˜์— ๋ถ™์—ฌ๋„ฃ์–ด ์ฃผ์„ธ์š”. - -```yaml -# ์—ฌ๊ธฐ์— YAML ์ฝ”๋“œ๋ฅผ ๋ถ™์—ฌ๋„ฃ์–ด ์ฃผ์„ธ์š”. -``` - -### 5. ์ž‘๋™ ํ™•์ธ ์—ฌ๋ถ€ -* [ ] HassBle ์•ฑ์„ ํ†ตํ•ด ์‹ค์ œ ์ฐจ๋Ÿ‰์—์„œ ๊ฐ’์ด ์ •์ƒ์ ์œผ๋กœ ์ฝํžˆ๋Š” ๊ฒƒ์„ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค. -* ์ถ”๊ฐ€ ์„ค๋ช… ๋ฐ ์ž‘๋™ ์Šคํฌ๋ฆฐ์ƒท: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 10a48e2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,25 +0,0 @@ -## Description -Please describe the vehicle template or configuration changes you are proposing. - -- Added/Updated Vehicle: E.g., *Hyundai Avante CN7* -- Source Type: OBD / BLE Advertisement / GATT -- Main Features: E.g., *Added custom Mode 22 PIDs for Oil Temperature and Gear Status* - ---- - -## Checklist -Before submitting this PR, please check the following: - -- [ ] **Valid YAML Syntax**: The YAML formatting is correct and contains no parser errors. -- [ ] **No Hex Literals for IDs**: Used decimal integers for numeric parameters like `manufacturer_id` (e.g., Apple is `76`, not `0x004C`). -- [ ] **Unique Template IDs**: The new template ID is unique and doesn't conflict with existing ones in `templates.yaml`. -- [ ] **Tested & Verified**: I have tested this configuration in the HassBle app and verified that the sensor data is decoded properly. - ---- - -## YAML Code Snippet (Optional) -If you've added a new template, you can highlight it below for a quick review: - -```yaml -# Put your added template block here -``` diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template_en.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template_en.md deleted file mode 100644 index 10a48e2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template_en.md +++ /dev/null @@ -1,25 +0,0 @@ -## Description -Please describe the vehicle template or configuration changes you are proposing. - -- Added/Updated Vehicle: E.g., *Hyundai Avante CN7* -- Source Type: OBD / BLE Advertisement / GATT -- Main Features: E.g., *Added custom Mode 22 PIDs for Oil Temperature and Gear Status* - ---- - -## Checklist -Before submitting this PR, please check the following: - -- [ ] **Valid YAML Syntax**: The YAML formatting is correct and contains no parser errors. -- [ ] **No Hex Literals for IDs**: Used decimal integers for numeric parameters like `manufacturer_id` (e.g., Apple is `76`, not `0x004C`). -- [ ] **Unique Template IDs**: The new template ID is unique and doesn't conflict with existing ones in `templates.yaml`. -- [ ] **Tested & Verified**: I have tested this configuration in the HassBle app and verified that the sensor data is decoded properly. - ---- - -## YAML Code Snippet (Optional) -If you've added a new template, you can highlight it below for a quick review: - -```yaml -# Put your added template block here -``` diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template_ko.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template_ko.md deleted file mode 100644 index b480c26..0000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template_ko.md +++ /dev/null @@ -1,25 +0,0 @@ -## ๋ณ€๊ฒฝ ์‚ฌํ•ญ ์„ค๋ช… (Description) -์ œ์•ˆํ•˜์‹œ๋Š” ์ฐจ๋Ÿ‰ ํ…œํ”Œ๋ฆฟ ๋˜๋Š” ์„ค์ • ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์„ค๋ช…ํ•ด ์ฃผ์„ธ์š”. - -- ์ถ”๊ฐ€/์—…๋ฐ์ดํŠธ๋œ ์ฐจ๋Ÿ‰: ์˜ˆ) *ํ˜„๋Œ€ ์•„๋ฐ˜๋–ผ CN7* -- ์†Œ์Šค ํƒ€์ž…: OBD / BLE Advertisement / GATT -- ์ฃผ์š” ๊ธฐ๋Šฅ: ์˜ˆ) *์—”์ง„ ์˜ค์ผ ์˜จ๋„ ๋ฐ ๊ธฐ์–ด ๋‹จ์ˆ˜ ์ปค์Šคํ…€ Mode 22 PID ์ถ”๊ฐ€* - ---- - -## ์ฒดํฌ๋ฆฌ์ŠคํŠธ (Checklist) -PR์„ ์ œ์ถœํ•˜๊ธฐ ์ „์— ์•„๋ž˜ ์‚ฌํ•ญ๋“ค์„ ํ™•์ธํ•ด ์ฃผ์„ธ์š”. - -- [ ] **์˜ฌ๋ฐ”๋ฅธ YAML ๋ฌธ๋ฒ•**: YAML ํฌ๋งท์— ๊ตฌ๋ฌธ ์˜ค๋ฅ˜๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. -- [ ] **ID ํ•„๋“œ์— 16์ง„์ˆ˜(Hex) ๊ธˆ์ง€**: `manufacturer_id` ๋“ฑ์˜ ์ˆซ์ž ํŒŒ๋ผ๋ฏธํ„ฐ์—๋Š” `0x...` hex ๋Œ€์‹  10์ง„์ˆ˜ ์ •์ˆ˜๋ฅผ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. (์˜ˆ: Apple์€ `0x004C` ๋Œ€์‹  `76`) -- [ ] **ํ…œํ”Œ๋ฆฟ ID ์ค‘๋ณต ํ™•์ธ**: ์ถ”๊ฐ€ํ•œ ํ…œํ”Œ๋ฆฟ์˜ ID๊ฐ€ `templates.yaml` ๋‚ด์˜ ๊ธฐ์กด ID์™€ ์ค‘๋ณต๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. -- [ ] **์ž‘๋™ ๊ฒ€์ฆ ์™„๋ฃŒ**: HassBle ์•ฑ์—์„œ ์‹ค์ œ๋กœ ์ด ์„ค์ •์„ ๊ตฌ๋™ํ•˜์—ฌ ์„ผ์„œ ๋ฐ์ดํ„ฐ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๋””์ฝ”๋”ฉ๋˜๋Š”์ง€ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค. - ---- - -## ์ถ”๊ฐ€๋œ YAML ์ฝ”๋“œ (์„ ํƒ ์‚ฌํ•ญ) -์ƒˆ ํ…œํ”Œ๋ฆฟ์ด ์ถ”๊ฐ€๋œ ๊ฒฝ์šฐ ์•„๋ž˜์— ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•ด ์ฃผ์‹œ๋ฉด ๋น ๋ฅธ ๋ฆฌ๋ทฐ์— ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค. - -```yaml -# ์—ฌ๊ธฐ์— ์ถ”๊ฐ€๋œ ํ…œํ”Œ๋ฆฟ ๋ธ”๋ก์„ ๋ถ™์—ฌ๋„ฃ์–ด ์ฃผ์„ธ์š”. -``` diff --git a/CONTRIBUTING.ko.md b/CONTRIBUTING.ko.md deleted file mode 100644 index 3cdc243..0000000 --- a/CONTRIBUTING.ko.md +++ /dev/null @@ -1,89 +0,0 @@ -# HassBle ์ฐจ๋Ÿ‰ ์„ค์ • ๋ฐ PID ๊ธฐ์—ฌ ๊ฐ€์ด๋“œ - -**[English Version โ†’ CONTRIBUTING.md](CONTRIBUTING.md)** - -HassBle๋Š” ์ปค๋ฎค๋‹ˆํ‹ฐ ๊ธฐ๋ฐ˜์˜ ์˜คํ”ˆ์†Œ์Šค ํ”„๋กœ์ ํŠธ๋กœ, ์‚ฌ์šฉ์ž๋“ค์ด ์ง์ ‘ ์„ฑ๊ณต์ ์œผ๋กœ ์—ฐ๋™ํ•œ OBD-II PID ์„ค์ •๊ณผ BLE ๊ธฐ๊ธฐ ์„ค์ •์„ ๊ณต์œ ํ•˜๋ฉฐ ํ•จ๊ป˜ ๋ฐœ์ „ํ•ด ๋‚˜๊ฐ‘๋‹ˆ๋‹ค. - -๋ณธ์ธ์˜ ์ฐจ๋Ÿ‰์— ๋งž๋Š” PID ์„ค์ •์„ ๊ตฌ์ถ•ํ•˜์…จ๋‹ค๋ฉด, ์•„๋ž˜ ๋ฐฉ๋ฒ• ์ค‘ ํŽธํ•œ ๋ฐฉ์‹์„ ์„ ํƒํ•ด ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž๋“ค์„ ์œ„ํ•ด ๊ณต์œ ํ•ด ์ฃผ์„ธ์š”! ์ฐจ๋Ÿ‰์˜ ์„ค์ •์„ ๊ณต์œ ํ•˜๋ฉด ๋™์ผํ•œ ์ฐจ์ข…์„ ์†Œ์œ ํ•œ ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž๋“ค์ด ๋‹จ ๋ช‡ ์ดˆ ๋งŒ์— ์„ค์ •์„ ์™„๋ฃŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. - ---- - -## ๐Ÿš€ ๊ธฐ์—ฌ ๋ฐฉ๋ฒ• - -GitHub ์‚ฌ์šฉ ๋ฐฉ์‹์ด๋‚˜ YAML ํŒŒ์ผ ํŽธ์ง‘์— ์ต์ˆ™ํ•œ ์ •๋„์— ๋”ฐ๋ผ ์•„๋ž˜ ๋‘ ๊ฐ€์ง€ ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: - -### ๋ฐฉ๋ฒ• A: GitHub Issue๋กœ ์ œ๋ณดํ•˜๊ธฐ (๊ฐ€์žฅ ์‰ฌ์šด ๋ฐฉ๋ฒ•) -Git์ด๋‚˜ YAML ํ˜•์‹ ์ž‘์„ฑ์ด ์ต์ˆ™ํ•˜์ง€ ์•Š์œผ์‹œ๋‹ค๋ฉด, ์•„๋ž˜ ์ •๋ณด๋ฅผ ํฌํ•จํ•˜์—ฌ ์ด์Šˆ(Issue)๋กœ ์ œ๋ณดํ•ด ์ฃผ์„ธ์š”. ๊ด€๋ฆฌ์ž๊ฐ€ ํ™•์ธ ํ›„ ๊ฒ€์ฆํ•˜์—ฌ ๋Œ€์‹  `templates.yaml`์— ๋ฐ˜์˜ํ•ด ๋“œ๋ฆฝ๋‹ˆ๋‹ค. -1. **์ฐจ๋Ÿ‰ ์ •๋ณด**: ์ œ์กฐ์‚ฌ, ๋ชจ๋ธ๋ช…, ์—ฐ์‹, ์œ ์ข…/์—”์ง„ ํ˜•์‹ (์˜ˆ: *2022๋…„์‹ ํ˜„๋Œ€ ์•„์ด์˜ค๋‹‰ 5 EV*, *2020๋…„์‹ ์‰๋ณด๋ ˆ ์ฝœ๋กœ๋ผ๋„ 2.8L ๋””์ ค*). -2. **OBD-II ์–ด๋Œ‘ํ„ฐ**: ์‚ฌ์šฉ ์ค‘์ธ ์–ด๋Œ‘ํ„ฐ ๋ชจ๋ธ (์˜ˆ: *vLinker MC+*, *ELM327 v1.5*). -3. **OBD ํ”„๋กœํ† ์ฝœ / ์ดˆ๊ธฐํ™” ๋ช…๋ น์–ด (์„ ํƒ)**: ์˜ˆ) CAN 11bit 500kbps์˜ ๊ฒฝ์šฐ `ATSP6` ๋“ฑ. -4. **์„ผ์„œ ๋ชฉ๋ก**: ๊ฐ ์„ผ์„œ๋งˆ๋‹ค ๋‹ค์Œ ์ •๋ณด๋ฅผ ์ ์–ด์ฃผ์„ธ์š”: - * **์„ผ์„œ ์ด๋ฆ„ ๋ฐ ์„ค๋ช…** (์˜ˆ: ์—”์ง„์˜ค์ผ ์˜จ๋„) - * **Mode & PID** (์˜ˆ: Mode `22`, PID `1008`) - * **๋ณ€ํ™˜ ์ˆ˜์‹ (Formula)** (์˜ˆ: ์ˆ˜์‹  ๋ฐ”์ดํŠธ ๊ณ„์‚ฐ์‹ `a - 40`) - * **์ธก์ • ๋‹จ์œ„** (์˜ˆ: `ยฐC`) - * **ํด๋ง ์ฃผ๊ธฐ** (์˜ˆ: `10s` ๋งˆ๋‹ค) - -### ๋ฐฉ๋ฒ• B: Pull Request (PR)๋กœ ์ง์ ‘ ๋“ฑ๋กํ•˜๊ธฐ (๊ฐœ๋ฐœ์ž ๊ถŒ์žฅ) -GitHub ์‚ฌ์šฉ์ด ์ต์ˆ™ํ•˜์‹œ๋‹ค๋ฉด ์ด ์ €์žฅ์†Œ์˜ [templates.yaml](templates.yaml) ํŒŒ์ผ์— ๋ณธ์ธ์˜ ์ฐจ๋Ÿ‰ ํ…œํ”Œ๋ฆฟ ์„ค์ •์„ ์ง์ ‘ ์ถ”๊ฐ€ํ•˜๊ณ  Pull Request๋ฅผ ๋ณด๋‚ด์ฃผ์„ธ์š”. (PR ์ƒ์„ฑ ์‹œ ํ•œ๊ตญ์–ด ํ…œํ”Œ๋ฆฟ์„ ์„ ํƒํ•˜๊ฑฐ๋‚˜, URL ๋’ค์— `?template=pull_request_template_ko.md`๋ฅผ ๋ถ™์—ฌ ์ž‘์„ฑํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.) - ---- - -## ๐Ÿ“ `templates.yaml` ์ž‘์„ฑ๋ฒ• ๋ฐ ์˜ˆ์‹œ - -`templates.yaml`์— ์ฐจ์ข…๋ณ„ ์„ค์ •์„ ์ถ”๊ฐ€ํ•  ๋•Œ๋Š” ์•„๋ž˜ ์˜ˆ์‹œ์™€ ๊ฐ™์€ ํ˜•์‹์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. - -๊ฐ ์„ค์ • ํ•„๋“œ์— ๋Œ€ํ•œ ์ƒ์„ธํ•œ ์„ค๋ช…๊ณผ ์ŠคํŽ™์€ ์ด ์ €์žฅ์†Œ์˜ **[README.ko.md](README.ko.md)** ํŒŒ์ผ์— ๋งค์šฐ ์ƒ์„ธํ•˜๊ฒŒ ์„ค๋ช…๋˜์–ด ์žˆ์œผ๋‹ˆ ์ฐธ๊ณ ํ•ด ์ฃผ์„ธ์š”. - -### ์ฐจ๋Ÿ‰ ํ…œํ”Œ๋ฆฟ ์ž‘์„ฑ ์˜ˆ์‹œ - -```yaml - - id: obd_hyundai_avante_cn7 - name: "Hyundai Elantra/Avante CN7 (Gasoline)" - description: "์•„๋ฐ˜๋–ผ CN7 ๊ฐ€์†”๋ฆฐ ๋ชจ๋ธ์„ ์œ„ํ•œ ๊ธฐ๋ณธ ์ฃผํ–‰ ๋ฐ์ดํ„ฐ ๋ฐ ์—”์ง„/๋ฏธ์…˜์˜ค์ผ ์˜จ๋„ ์„ผ์„œ ์„ธํŠธ" - device: - id: avante_cn7_obd - name: "Avante CN7 OBD" - source: obd - obd: - service_uuid: "18F0" # OBD-II ์–ด๋Œ‘ํ„ฐ์˜ BLE ์„œ๋น„์Šค UUID (๋Œ€๊ฐœ FFF0 ๋˜๋Š” 18F0) - tx_char_uuid: "2AF1" # ์“ฐ๊ธฐ(Write) ์บ๋ฆญํ„ฐ๋ฆฌ์Šคํ‹ฑ UUID - rx_char_uuid: "2AF0" # ์•Œ๋ฆผ(Notify) ์บ๋ฆญํ„ฐ๋ฆฌ์Šคํ‹ฑ UUID - tx_delay: 50ms # ๋ช…๋ น ๊ฐ„ ์ „์†ก ๋”œ๋ ˆ์ด - init_commands: ["ATSP6"] # OBD ์ดˆ๊ธฐํ™” ๋ช…๋ น (ATSP6 ๋˜๋Š” ATSP0 ๋“ฑ) - sensors: - # 1. ๋‚ด์žฅ ํ”„๋ฆฌ์…‹ ์‚ฌ์šฉ (์•ฑ์— ๋‚ด์žฅ๋œ ๊ณตํ†ต PID ์ •์˜ ํ™œ์šฉ) - - { key: rpm, preset: rpm, update_interval: 2s } - - { key: speed, preset: speed, update_interval: 2s } - - { key: coolant_temp, preset: coolant_temp, update_interval: 10s } - - # 2. ์ œ์กฐ์‚ฌ ์ „์šฉ ํ™•์žฅ PID ์ˆ˜๋™ ์ •์˜ (ํ”„๋ฆฌ์…‹์ด ์—†๋Š” ๊ฒฝ์šฐ) - - key: engine_oil_temp - mode: "22" # UDS Mode 22 (ํ™•์žฅ PID ์ฝ๊ธฐ) - pid: "1008" # 4์ž๋ฆฌ PID Hex ์ฝ”๋“œ - formula: "a - 40" # 'a'๋Š” ์ˆ˜์‹ ๋œ ์ฒซ ๋ฒˆ์งธ ๋ฐ”์ดํŠธ. ์„ญ์”จ ์˜จ๋„๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ์ˆ˜์‹ - unit: "ยฐC" - device_class: temperature - state_class: measurement - update_interval: 10s - - - key: trans_oil_temp - mode: "22" - pid: "2201" - formula: "a - 40" - unit: "ยฐC" - device_class: temperature - state_class: measurement - update_interval: 10s -``` - -### ๐Ÿ’ก ๋””์ฝ”๋”ฉ ์ˆ˜์‹(Formula) ์ž‘์„ฑ ํŒ: -* **๋ฐ”์ดํŠธ ๋ณ€์ˆ˜**: ์‘๋‹ต ๋ฐ”์ดํŠธ ์ˆœ์„œ๋Œ€๋กœ `a`, `b`, `c`, `d` ๋“ฑ์„ ๋ณ€์ˆ˜๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. -* **์ˆ˜ํ•™ ์—ฐ์‚ฐ**: `+`, `-`, `*`, `/` ๋ฐ ๊ด„ํ˜ธ `()`๋ฅผ ์‚ฌ์šฉํ•ด ์ˆ˜์‹์„ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (์˜ˆ: 2๋ฐ”์ดํŠธ ์กฐํ•ฉ ๊ณ ํ•ด์ƒ๋„ ๊ฐ’์€ `(a*256+b)*0.1` ํ˜•์‹์œผ๋กœ ๋งŽ์ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.) - ---- - -## ๐Ÿค ๋„์›€์ด ํ•„์š”ํ•˜์‹ ๊ฐ€์š”? -๋‹ค๋ฅธ ์•ฑ(Torque Pro, Car Scanner ๋“ฑ)์„ ํ†ตํ•ด ๋ณธ์ธ ์ฐจ๋Ÿ‰์˜ PID์™€ ์ˆ˜์‹์€ ์•Œ์•„๋ƒˆ์œผ๋‚˜, ์ด๋ฅผ HassBle์˜ YAML ์Šคํ‚ค๋งˆ ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜ํ•˜๊ธฐ ์–ด๋ ค์šฐ์‹œ๋‹ค๋ฉด ์ฃผ์ €ํ•˜์ง€ ๋ง๊ณ  Q&A Discussion์ด๋‚˜ Issue์— ์งˆ๋ฌธ์„ ์˜ฌ๋ ค์ฃผ์„ธ์š”. ์ปค๋ฎค๋‹ˆํ‹ฐ๊ฐ€ ๊ธฐ๊บผ์ด ๋ณ€ํ™˜ ์ž‘์„ฑ์„ ๋„์™€๋“œ๋ฆฝ๋‹ˆ๋‹ค! - -์†Œ์ค‘ํ•œ ๊ธฐ์—ฌ๋ฅผ ํ†ตํ•ด ๋ชจ๋‘๊ฐ€ ๋” ํŽธํ•˜๊ฒŒ ์ฐจ๋Ÿ‰ ์ƒํƒœ๋ฅผ ํ†ตํ•ฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค! ๐Ÿš—๐Ÿ’จ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index a7b641a..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,91 +0,0 @@ -# Contributing to HassBle Configurations - -**[ํ•œ๊ตญ์–ด ๊ธฐ์—ฌ ๊ฐ€์ด๋“œ โ†’ CONTRIBUTING.ko.md](CONTRIBUTING.ko.md)** - -Welcome! HassBle is a community-driven project, and we love it when users share their working OBD-II PID configurations and BLE device configurations. - -By contributing your vehicle's specific PIDs and configurations, you can help other owners of the same car set up their Home Assistant integration in seconds. - ---- - -## ๐Ÿš€ How to Contribute - -Depending on your comfort level with GitHub and YAML, you can choose one of the following methods: - -### Option A: Open a GitHub Issue (Easiest) -If you are not familiar with Git or YAML editing, simply open an issue with the following details: -1. **Vehicle Info**: Manufacturer, Model, Year, and Engine/Fuel Type (e.g., *2022 Hyundai Ioniq 5 EV*, *2020 Chevrolet Colorado 2.8L Diesel*). -2. **OBD-II Adapter**: The adapter you are using (e.g., *vLinker MC+*, *ELM327 v1.5*). -3. **OBD Protocol / Init Commands (If any)**: E.g., `ATSP6` for ISO 15765-4 CAN (11bit/500kbps). -4. **Sensor List**: For each sensor, please provide: - * **Name/Description** (e.g., Engine Oil Temperature) - * **Mode & PID** (e.g., Mode `22`, PID `1008`) - * **Formula** (e.g., `a - 40` to decode bytes) - * **Unit of Measurement** (e.g., `ยฐC`) - * **Polling Interval** (e.g., every `10s`) - -We will verify your submission and manually add it to the global `templates.yaml` list! - -### Option B: Submit a Pull Request (PR) (For Developers) -If you are comfortable with Git, you can directly add your vehicle configuration to [templates.yaml](templates.yaml) and submit a Pull Request. (You can select the English template when creating the PR, or append `?template=pull_request_template_en.md` to the PR creation URL.) - ---- - -## ๐Ÿ“ How to Format Your Template in `templates.yaml` - -When adding a new vehicle template to `templates.yaml`, please follow the structure below. - -For detailed information about the parameters, please refer to the [README.md](README.md) file in this repository. - -### Template Schema Example - -```yaml - - id: obd_hyundai_avante_cn7 - name: "Hyundai Elantra/Avante CN7 (Gasoline)" - description: "Standard driving metrics plus engine/transmission oil temperature sensors." - device: - id: avante_cn7_obd - name: "Avante CN7 OBD" - source: obd - obd: - service_uuid: "18F0" # Ble service UUID of your OBD-II adapter (typically FFF0 or 18F0) - tx_char_uuid: "2AF1" # Write characteristic UUID - rx_char_uuid: "2AF0" # Notify characteristic UUID - tx_delay: 50ms # Delay between sending commands - init_commands: ["ATSP6"] # OBD initialization commands (often ATSP6 or ATSP0) - sensors: - # 1. Standard Presets (Using pre-defined presets in the app) - - { key: rpm, preset: rpm, update_interval: 2s } - - { key: speed, preset: speed, update_interval: 2s } - - { key: coolant_temp, preset: coolant_temp, update_interval: 10s } - - # 2. Custom Manufacturer-Specific UDS PIDs (Without presets) - - key: engine_oil_temp - mode: "22" # UDS mode 22 (Extended PIDs) - pid: "1008" # 4-digit PID for Mode 22 - formula: "a - 40" # 'a' is the first response byte. Decodes the OBD reply to Celsius. - unit: "ยฐC" - device_class: temperature - state_class: measurement - update_interval: 10s - - - key: trans_oil_temp - mode: "22" - pid: "2201" - formula: "a - 40" - unit: "ยฐC" - device_class: temperature - state_class: measurement - update_interval: 10s -``` - -### ๐Ÿ’ก Tips for Writing Formulas: -* **Byte Variables**: Use `a`, `b`, `c`, `d`, etc., to represent sequential bytes returned from the OBD-II response. -* **Math Operations**: Standard operations like `+`, `-`, `*`, `/`, and parentheses `()` are fully supported. (e.g., `(a*256+b)*0.1` is a common formula for reading high-resolution values). - ---- - -## ๐Ÿค Need Help? -If you've managed to read some PIDs using other OBD apps (like Torque Pro or Car Scanner) but aren't sure how to translate the formulas and PIDs into HassBle's YAML schema, feel free to open a Q&A Discussion or an Issue. The community is happy to help you format the YAML configurations! - -Thank you for contributing and helping make HassBle better for everyone! ๐Ÿš—๐Ÿ’จ diff --git a/README.ko.md b/README.ko.md deleted file mode 100644 index 05200e0..0000000 --- a/README.ko.md +++ /dev/null @@ -1,829 +0,0 @@ -# HassBle Config - -> ์ด ์ €์žฅ์†Œ๋Š” [HassBle](https://github.com/eigger/hassble-android) Android ์•ฑ์˜ ๊ธฐ๊ธฐ ์„ค์ • ํŒŒ์ผ(`config.yaml`)์„ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค. - -**[English Documentation โ†’ README.md](README.md) | [๊ธฐ์—ฌ ๊ฐ€์ด๋“œ โ†’ CONTRIBUTING.ko.md](CONTRIBUTING.ko.md)** - ---- - -## ๋ชฉ์ฐจ - -1. [๋™์ž‘ ์›๋ฆฌ](#๋™์ž‘-์›๋ฆฌ) -2. [๋น ๋ฅธ ์‹œ์ž‘](#๋น ๋ฅธ-์‹œ์ž‘) -3. [๋ฃจํŠธ ๊ตฌ์กฐ](#๋ฃจํŠธ-๊ตฌ์กฐ) -4. [defaults โ€” ๋ฐœํ–‰ ๊ทœ์น™](#defaults--๋ฐœํ–‰-๊ทœ์น™) -5. [๊ธฐ๊ธฐ ํƒ€์ž…](#๊ธฐ๊ธฐ-ํƒ€์ž…) -6. [source: advertisement โ€” BLE ์ˆ˜๋™ ์Šค์บ”](#source-advertisement--ble-์ˆ˜๋™-์Šค์บ”) - - [match โ€” ๋งค์นญ ์กฐ๊ฑด](#match--๋งค์นญ-์กฐ๊ฑด) - - [instance_mode โ€” ์—”ํ‹ฐํ‹ฐ ์ „๋žต](#instance_mode--์—”ํ‹ฐํ‹ฐ-์ „๋žต) -7. [source: gatt_notify โ€” GATT ์—ฐ๊ฒฐ](#source-gatt_notify--gatt-์—ฐ๊ฒฐ) -8. [source: obd โ€” ELM327 OBD ํด๋ง](#source-obd--elm327-obd-ํด๋ง) -9. [sensors โ€” ์„ผ์„œ ์„ค์ •](#sensors--์„ผ์„œ-์„ค์ •) - - [decode โ€” ๋ฐ”์ด๋„ˆ๋ฆฌ ๋””์ฝ”๋”ฉ](#decode--๋ฐ”์ด๋„ˆ๋ฆฌ-๋””์ฝ”๋”ฉ) - - [๋ฐ์ดํ„ฐ ํƒ€์ž…](#๋ฐ์ดํ„ฐ-ํƒ€์ž…) -10. [controls โ€” HA ์ œ์–ด](#controls--ha-์ œ์–ด) -11. [publish โ€” ์„ผ์„œ๋ณ„ ๋ฐœํ–‰ ํ•„ํ„ฐ](#publish--์„ผ์„œ๋ณ„-๋ฐœํ–‰-ํ•„ํ„ฐ) -12. [OBD ํ”„๋ฆฌ์…‹ ๋ชฉ๋ก](#obd-ํ”„๋ฆฌ์…‹-๋ชฉ๋ก) -13. [์ „์ฒด ์˜ˆ์ œ](#์ „์ฒด-์˜ˆ์ œ) -14. [์ฃผ์˜์‚ฌํ•ญ](#์ฃผ์˜์‚ฌํ•ญ) -15. [๊ธฐ์—ฌํ•˜๊ธฐ](#๊ธฐ์—ฌํ•˜๊ธฐ) - ---- - -## ์ €์žฅ์†Œ ํŒŒ์ผ - -| ํŒŒ์ผ | ์šฉ๋„ | -|------|------| -| `config.yaml` | ๊ฒŒ์ดํŠธ์›จ์ด ์šด์˜ ์„ค์ • (์‹ค์ œ๋กœ ๋™์ž‘ํ•˜๋Š” ๊ธฐ๊ธฐ ๋ชฉ๋ก) | -| `templates.yaml` | ์„ผ์„œ ํƒญ **ํ…œํ”Œ๋ฆฟ ๊ฐ€์ ธ์˜ค๊ธฐ**์šฉ ๊ธฐ๊ธฐ ํ…œํ”Œ๋ฆฟ | - -์•ฑ์€ ์„ ํƒํ•œ ๋ธŒ๋žœ์น˜์˜ ๋ฆฌํฌ ๋ฃจํŠธ์—์„œ ๋‘ ํŒŒ์ผ์„ ๊ณ ์ • ์ด๋ฆ„์œผ๋กœ ๋ถˆ๋Ÿฌ์˜ต๋‹ˆ๋‹ค (`owner/repo` + ๋ธŒ๋žœ์น˜). - -## ๋™์ž‘ ์›๋ฆฌ - -HassBle ์•ฑ์€ ์ด ์ €์žฅ์†Œ์—์„œ `config.yaml`๊ณผ `templates.yaml`์„ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ , ์ •์˜ํ•œ ๊ทœ์น™์— ๋”ฐ๋ผ BLE ๋ฐ์ดํ„ฐ๋ฅผ ๋””์ฝ”๋”ฉํ•œ ๋’ค, [ws_bridge](https://github.com/eigger/hass-ws-bridge) ํ†ตํ•ฉ์„ ํ†ตํ•ด Home Assistant์— ์ž๋™์œผ๋กœ ์„ผ์„œ๋ฅผ ๋“ฑ๋กํ•ฉ๋‹ˆ๋‹ค. ์ฝ”๋“œ ์ˆ˜์ • ์—†์ด YAML๋งŒ ํŽธ์ง‘ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. - -Raw URL (๋ธŒ๋žœ์น˜ `main`): - -- ์„ค์ •: `https://raw.githubusercontent.com/eigger/hassble-config/main/config.yaml` -- ํ…œํ”Œ๋ฆฟ: `https://raw.githubusercontent.com/eigger/hassble-config/main/templates.yaml` - -``` -Android Phone (BLE ์Šค์บ”) - โ”‚ raw bytes - โ–ผ - HassBle ์•ฑ โ”€โ”€โ”€โ”€ config.yaml (์ด ์ €์žฅ์†Œ) โ”€โ”€โ”€โ”€โ–ถ ๋””์ฝ”๋”ฉ ๊ทœ์น™ - โ”‚ ๋””์ฝ”๋”ฉ๋œ ๊ฐ’ - โ–ผ - HA WebSocket API โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ ws_bridge - โ”‚ - โ–ผ - Home Assistant ์—”ํ‹ฐํ‹ฐ (sensor / switch / number / โ€ฆ) -``` - ---- - -## ๋น ๋ฅธ ์‹œ์ž‘ - -1. ์ด ์ €์žฅ์†Œ๋ฅผ ์ž์‹ ์˜ GitHub ๊ณ„์ •์œผ๋กœ Fork ๋˜๋Š” ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค. -2. `config.yaml`์„ ํŽธ์ง‘ํ•˜์—ฌ BLE ๊ธฐ๊ธฐ๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ์•ฑ์—์„œ ๋น ๋ฅด๊ฒŒ ์ถ”๊ฐ€ํ•  ๋ธ”๋ก์€ `templates.yaml`์— ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. -3. HassBle ์•ฑ โ†’ **Sensors ํƒญ** โ†’ `your-username/hassble-config`์™€ ๋ธŒ๋žœ์น˜ `main` ์ž…๋ ฅ (`config.yaml` + `templates.yaml` ์ž๋™ ๋กœ๋“œ). -4. **Gateway ํƒญ**์—์„œ HA URL๊ณผ ํ† ํฐ(๋˜๋Š” OAuth ๋กœ๊ทธ์ธ)์„ ์ž…๋ ฅํ•˜๊ณ  ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค. -5. **Sensors ํƒญ**์—์„œ ์›ํ•˜๋Š” ์„ผ์„œ๋ฅผ ํ™œ์„ฑํ™”ํ•˜๋ฉด Home Assistant์— ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค. - -> โš ๏ธ **HA ์ž๊ฒฉ์ฆ๋ช…(URL / ํ† ํฐ)์„ ์ด ํŒŒ์ผ์— ์ ˆ๋Œ€ ์ €์žฅํ•˜์ง€ ๋งˆ์„ธ์š”.** -> ์•ฑ ์„ค์ •์—์„œ๋งŒ ์ž…๋ ฅํ•˜์„ธ์š”. - ---- - -## ๋ฃจํŠธ ๊ตฌ์กฐ - -```yaml -version: 1 - -defaults: - publish: - on_change_only: true - min_interval: 10s - -devices: - - id: ... -``` - -| ํ•„๋“œ | ํƒ€์ž… | ๊ธฐ๋ณธ๊ฐ’ | ์„ค๋ช… | -|------|------|--------|------| -| `version` | int | `1` | ์Šคํ‚ค๋งˆ ๋ฒ„์ „. ํ•ญ์ƒ `1`. | -| `defaults.publish` | object | ์•„๋ž˜ ์ฐธ์กฐ | ๋ชจ๋“  ์„ผ์„œ์— ์ ์šฉ๋˜๋Š” ๊ธฐ๋ณธ ๋ฐœํ–‰ ํ•„ํ„ฐ. | -| `devices` | list | `[]` | ๊ธฐ๊ธฐ ์„ค์ • ๋ชฉ๋ก. | - ---- - -## defaults โ€” ๋ฐœํ–‰ ๊ทœ์น™ - -์„ผ์„œ ๊ฐ’์„ HA์— ์–ผ๋งˆ๋‚˜ ์ž์ฃผ, ์–ด๋–ค ์กฐ๊ฑด์—์„œ ์ „์†กํ• ์ง€๋ฅผ ์ œ์–ดํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ๊ธฐ๋ณ„ ๋˜๋Š” ์„ผ์„œ๋ณ„๋กœ ๋ฎ์–ด์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. - -```yaml -defaults: - publish: - on_change_only: true # ๊ฐ’์ด ๋ณ€ํ•  ๋•Œ๋งŒ ์ „์†ก (๊ธฐ๋ณธ: true) - min_interval: 10s # ์ „์†ก ์ตœ์†Œ ๊ฐ„๊ฒฉ (๊ธฐ๋ณธ: 10s) - heartbeat: 5m # ๋ณ€ํ™” ์—†์–ด๋„ ์ด ๊ฐ„๊ฒฉ์œผ๋กœ ๊ฐ•์ œ ์ „์†ก (์„ ํƒ) - deadband: 0.5 # ์ด ๊ฐ’ ๋ฏธ๋งŒ์˜ ๋ณ€ํ™”๋Š” ๋ฌด์‹œ (์„ ํƒ, ์ˆซ์ž ์„ผ์„œ๋งŒ) -``` - -| ํ•„๋“œ | ํƒ€์ž… | ๊ธฐ๋ณธ๊ฐ’ | ์„ค๋ช… | -|------|------|--------|------| -| `on_change_only` | bool | `true` | ๊ฐ’์ด ๋ณ€ํ•  ๋•Œ๋งŒ ์ „์†ก. | -| `min_interval` | duration | `10s` | ๋‘ ๋ฒˆ์˜ ์ „์†ก ์‚ฌ์ด ์ตœ์†Œ ๊ฐ„๊ฒฉ. ํ˜•์‹: `500ms`, `30s`, `5m`. | -| `heartbeat` | duration | `null` | ๋ณ€ํ™” ์—†์–ด๋„ ์ด ๊ฐ„๊ฒฉ์œผ๋กœ ๊ฐ•์ œ ์ „์†ก. | -| `deadband` | float | `null` | ์ด ๊ฐ’ ๋ฏธ๋งŒ์˜ ๋ณ€ํ™”๋Š” ๋ฌด์‹œ (์ˆซ์ž ์„ผ์„œ). | - ---- - -## ๊ธฐ๊ธฐ ํƒ€์ž… - -`devices`์˜ ๊ฐ ํ•ญ๋ชฉ์—๋Š” ๋ฐ์ดํ„ฐ ๊ฒฝ๋กœ๋ฅผ ์„ ํƒํ•˜๋Š” `source` ํ•„๋“œ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. - -| `source` | ์„ค๋ช… | -|----------|------| -| `advertisement` | BLE ์ˆ˜๋™ ์Šค์บ” โ€” ์—ฐ๊ฒฐ ์—†์ด ๋ธŒ๋กœ๋“œ์บ์ŠคํŠธ ํŒจํ‚ท์„ ์ฝ์Šต๋‹ˆ๋‹ค. | -| `gatt_notify` | GATT ๋Šฅ๋™ ์—ฐ๊ฒฐ โ€” ๊ธฐ๊ธฐ์— ์—ฐ๊ฒฐํ•˜์—ฌ ์•Œ๋ฆผ์„ ๊ตฌ๋…ํ•ฉ๋‹ˆ๋‹ค. ์“ฐ๊ธฐ ๋ช…๋ น์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. | -| `obd` | BLE๋ฅผ ํ†ตํ•œ ELM327 OBD ์–ด๋Œ‘ํ„ฐ โ€” PID ๋ช…๋ น์„ ํด๋งํ•˜๊ณ  ISO-TP ์‘๋‹ต์„ ํŒŒ์‹ฑํ•ฉ๋‹ˆ๋‹ค. | - -**๋ชจ๋“  ๊ธฐ๊ธฐ ํƒ€์ž…์— ๊ณตํ†ต์ธ ํ•„๋“œ:** - -```yaml -- id: my_device # ๊ณ ์œ  ์‹๋ณ„์ž (์†Œ๋ฌธ์ž, ์ˆซ์ž, _) - name: "My Device" # ํ‘œ์‹œ ์ด๋ฆ„ (HA ๊ธฐ๊ธฐ๋ช…) - source: advertisement # advertisement | gatt_notify | obd - publish: # (์„ ํƒ) ์ด ๊ธฐ๊ธฐ์˜ ๋ชจ๋“  ์„ผ์„œ์— ๋Œ€ํ•œ ๋ฐœํ–‰ ๊ทœ์น™ ๋ฎ์–ด์“ฐ๊ธฐ - on_change_only: true - min_interval: 5s - sensors: [...] - controls: [...] # gatt_notify / obd / advertisement(action ์ „์šฉ) -``` - -| ํ•„๋“œ | ํƒ€์ž… | ํ•„์ˆ˜ | ์„ค๋ช… | -|------|------|------|------| -| `id` | string | โœ… | ๊ณ ์œ  ์‹๋ณ„์ž. HA ์—”ํ‹ฐํ‹ฐ unique_id์— ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์†Œ๋ฌธ์ž, ์ˆซ์ž, `_` ์‚ฌ์šฉ. | -| `name` | string | โœ… | HA ๊ธฐ๊ธฐ์— ํ‘œ์‹œ๋˜๋Š” ์ด๋ฆ„. | -| `source` | enum | โœ… | ๋ฐ์ดํ„ฐ ์†Œ์Šค ํƒ€์ž… (์œ„ ์ฐธ์กฐ). | -| `publish` | object | โŒ | ๊ธฐ๊ธฐ ์ˆ˜์ค€์˜ ๋ฐœํ–‰ ๊ทœ์น™ ๋ฎ์–ด์“ฐ๊ธฐ. | -| `sensors` | list | โŒ | ์„ผ์„œ ์ •์˜ ๋ชฉ๋ก. | -| `controls` | list | โŒ | ์ œ์–ด ์ •์˜ ๋ชฉ๋ก. | - ---- - -## source: advertisement โ€” BLE ์ˆ˜๋™ ์Šค์บ” - -์—ฐ๊ฒฐ ์—†์ด BLE ๊ด‘๊ณ  ํŒจํ‚ท์„ ์ˆ˜์‹ ํ•ฉ๋‹ˆ๋‹ค. `match`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŒจํ‚ท์„ ํ•„ํ„ฐ๋งํ•ฉ๋‹ˆ๋‹ค. - -```yaml -- id: my_sensor - name: "My BLE Sensor" - source: advertisement - instance_mode: mac # mac | shared (์•„๋ž˜ ์ฐธ์กฐ) - match: - manufacturer_id: 76 # Apple = 76 (0x004C) โ€” ๋ฐ˜๋“œ์‹œ 10์ง„์ˆ˜ ์‚ฌ์šฉ - manufacturer_min_length: 24 - manufacturer_hex_prefix: "0215" - sensors: - - key: temperature - source_field: manufacturer_data # manufacturer_data | service_data | raw - decode: - offset: 18 - length: 2 - type: uint16 - endian: big - scale: 0.002670288 - offset_value: -45 -``` - -### match โ€” ๋งค์นญ ์กฐ๊ฑด - -์ง€์ •๋œ ๋ชจ๋“  ์กฐ๊ฑด์ด ๋™์‹œ์— ๋งŒ์กฑ๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค (AND ๋…ผ๋ฆฌ). ์ง€์ •ํ•˜์ง€ ์•Š์€ ํ•„๋“œ๋Š” ๋ฌด์‹œ๋ฉ๋‹ˆ๋‹ค. - -| ํ•„๋“œ | ํƒ€์ž… | ์„ค๋ช… | -|------|------|------| -| `mac` | string | ๊ณ ์ • MAC ์ฃผ์†Œ ํ•„ํ„ฐ. ํ˜•์‹: `"AA:BB:CC:DD:EE:FF"`. | -| `service_data_uuid` | string | 16๋น„ํŠธ ๋˜๋Š” 128๋น„ํŠธ ์„œ๋น„์Šค UUID ์ ‘๋ฏธ์‚ฌ. ์˜ˆ: `"F51C"`, `"181A"`. | -| `manufacturer_id` | int | ์ œ์กฐ์‚ฌ company ID. **๋ฐ˜๋“œ์‹œ 10์ง„์ˆ˜ ์‚ฌ์šฉ** (`0x...` ๋ถˆ๊ฐ€). ์˜ˆ: Apple=`76`. | -| `manufacturer_hex_prefix` | string | ์ œ์กฐ์‚ฌ ํŽ˜์ด๋กœ๋“œ(hex ๋ฌธ์ž์—ด)๊ฐ€ ์ด ์ ‘๋‘์‚ฌ๋กœ ์‹œ์ž‘ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ: iBeacon=`"0215"`. | -| `manufacturer_min_length` | int | ์ œ์กฐ์‚ฌ ํŽ˜์ด๋กœ๋“œ์˜ ์ตœ์†Œ ๋ฐ”์ดํŠธ ๊ธธ์ด. | -| `name_prefix` | string | BLE ๊ธฐ๊ธฐ ์ด๋ฆ„์ด ์ด ๋ฌธ์ž์—ด๋กœ ์‹œ์ž‘ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. | - -> **โš ๏ธ Hex ๋ฆฌํ„ฐ๋Ÿด ์ฃผ์˜** -> YAML ํŒŒ์„œ(`kaml`)๋Š” `0x...` hex ๊ฐ’์„ ์ž˜๋ชป ํŒŒ์‹ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•ญ์ƒ **10์ง„์ˆ˜ ์ •์ˆ˜**๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”. -> `0x004C` โ†’ `76`, `0x035D` โ†’ `861` - -### instance_mode โ€” ์—”ํ‹ฐํ‹ฐ ์ „๋žต - -๊ฐ™์€ ํƒ€์ž…์˜ ๊ธฐ๊ธฐ๊ฐ€ ์—ฌ๋Ÿฌ ๊ฐœ ๊ฐ์ง€๋  ๋•Œ HA ์—”ํ‹ฐํ‹ฐ๋ฅผ ์–ด๋–ป๊ฒŒ ์ƒ์„ฑํ• ์ง€๋ฅผ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค. - -| ๊ฐ’ | ์„ค๋ช… | -|----|------| -| `mac` (๊ธฐ๋ณธ) | ๊ณ ์œ  MAC ์ฃผ์†Œ๋งˆ๋‹ค ๋ณ„๋„์˜ HA ์—”ํ‹ฐํ‹ฐ ์„ธํŠธ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ์—”ํ‹ฐํ‹ฐ unique_id: `{device_id}_{MAC}_temperature` ๋“ฑ. ์•ฑ์˜ Sensors ํƒญ์—์„œ MAC์„ ๋ฐ”์ธ๋”ฉํ•˜๋ฉด ๊ธฐ๊ธฐ๊ฐ€ ์Šค์บ”๋˜๊ธฐ ์ „์— ์—”ํ‹ฐํ‹ฐ๋ฅผ ๋ฏธ๋ฆฌ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. | -| `shared` | ๋ชจ๋“  ๋งค์นญ ๊ด‘๊ณ  ๊ธฐ๊ธฐ๊ฐ€ ํ•˜๋‚˜์˜ HA ์—”ํ‹ฐํ‹ฐ๋ฅผ ๊ณต์œ ํ•ฉ๋‹ˆ๋‹ค. ๋งˆ์ง€๋ง‰์œผ๋กœ ์ˆ˜์‹ ๋œ ํŒจํ‚ท์ด ์ƒํƒœ๋ฅผ ๋ฎ์–ด์”๋‹ˆ๋‹ค. ์ฃผ์ฐจ ๋น„์ฝ˜, ํด๋ฆฌ์ปค ๋“ฑ์— ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค. | - -### advertise โ€” BLE ๊ด‘๊ณ  ์†ก์‹  (TX) - -์ง€ํ•˜์ฃผ์ฐจ์žฅ ์œ„์น˜ ์š”์ฒญ ๋น„์ฝ˜์ฒ˜๋Ÿผ ์•ฑ์—์„œ ์Šค๋งˆํŠธํฐ์˜ BLE ๊ด‘๊ณ ๋ฅผ ์†ก์‹ ํ•˜์—ฌ ์ฃผ๋ณ€ ๋น„์ฝ˜์„ ๊นจ์šฐ๊ณ  ์‘๋‹ต์„ ์œ ๋„ํ•˜๋Š” ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค. - -```yaml -- id: mytown_parking - name: "๋งˆ์ดํƒ€์šด ์ฃผ์ฐจ์œ„์น˜" - source: advertisement - instance_mode: shared - match: - manufacturer_id: 861 # 0x035D โ€” kaml ํŒŒ์‹ฑ์„ ์œ„ํ•ด 10์ง„์ˆ˜(decimal) ์‚ฌ์šฉ ๊ถŒ์žฅ - manufacturer_hex_prefix: "06" # 06 ์‘๋‹ต ํฌ๋งท ๋งค์นญ - manufacturer_min_length: 18 - advertise: - manufacturer_id: 861 - payload: "05CB34447B91F8C69BBE41157C70BB631C40{counter:02X}" - counter_mode: reset # reset(๊ธฐ๋ณธ) | persist - counter_start: 0 # reset ๋ชจ๋“œ ์‹œ์ž‘๊ฐ’, persist ๋ชจ๋“œ ์ดˆ๊ธฐ ์‹œ๋“œ๊ฐ’ (0~255) - mode: balanced # low_power (~1s) | balanced (~250ms) | low_latency (~100ms) - tx_power: high # ultra_low | low | medium | high - timeout: 15s # ์ด ์‹œ๊ฐ„ ์ง€๋‚˜๋ฉด ์ž๋™ ์†ก์‹  ์ค‘๋‹จ - repeat_interval: 1s # (์„ ํƒ) ์ด ์ฃผ๊ธฐ๋กœ payload ๊ฐฑ์‹  = counter ์ฆ๊ฐ€ - stop_on_response: true # match ์กฐ๊ฑด์— ๋ถ€ํ•ฉํ•˜๋Š” ๊ด‘๊ณ  ์ˆ˜์‹  ์‹œ ์ฆ‰์‹œ ์†ก์‹  ์ค‘๋‹จ - connectable: false - scannable: true - controls: - - key: request_location - type: button - name: "์ฃผ์ฐจ์œ„์น˜ ์š”์ฒญ" - action: advertise # command ๋Œ€์‹  ์•ฑ ๋‚ด๋ถ€ ๊ด‘๊ณ  ์†ก์‹  ๋™์ž‘ ์‹คํ–‰ - icon: mdi:car-search -``` - -| ํ•„๋“œ | ํ•„์ˆ˜ | ๊ธฐ๋ณธ๊ฐ’ | ์„ค๋ช… | -|------|------|--------|------| -| `manufacturer_id` | โœ… | | BLE Company Identifier (10์ง„์ˆ˜). ์˜ˆ: 861 (=0x035D). | -| `payload` | โœ… | | Manufacturer Data payload hex (Company ID ์ œ์™ธ). `{counter}`(10์ง„์ˆ˜) ๋˜๋Š” `{counter:02X}`(2์ž๋ฆฌ hex) ํ† ํฐ ์‚ฌ์šฉ ๊ฐ€๋Šฅ. ๋ ˆ๊ฑฐ์‹œ ๊ด‘๊ณ  24๋ฐ”์ดํŠธ ์ œํ•œ. | -| `counter_mode` | | `reset` | ์นด์šดํ„ฐ ๋ชจ๋“œ: `reset` (๋ˆ„๋ฅผ ๋•Œ๋งˆ๋‹ค `counter_start`๋ถ€ํ„ฐ ์‹œ์ž‘, ๋ฒ„์ŠคํŠธ ๋‚ด์—์„œ๋งŒ ์ฆ๊ฐ€) \| `persist` (์•ฑ ์žฌ์‹œ์ž‘ ํ›„์—๋„ ์ด์ „ ๊ฐ’์—์„œ ์ด์–ด์ง). | -| `counter_start` | | `0` | ์นด์šดํ„ฐ ์‹œ์ž‘๊ฐ’ (0~255). `reset` ๋ชจ๋“œ ์‹œ ๋งค ์š”์ฒญ ์‹œ์ž‘๊ฐ’, `persist` ๋ชจ๋“œ ์‹œ ์ตœ์ดˆ ์˜์† ์ „ ์ดˆ๊ธฐ ์‹œ๋“œ๊ฐ’. | -| `mode` | | `balanced` | ๊ด‘๊ณ  ์ฃผ๊ธฐ: `low_power` (~1s) \| `balanced` (~250ms) \| `low_latency` (~100ms). | -| `tx_power` | | `high` | ์†ก์‹  ์ถœ๋ ฅ: `ultra_low` \| `low` \| `medium` \| `high`. | -| `timeout` | | `15s` | ๊ด‘๊ณ  ์†ก์‹  ์ตœ๋Œ€ ์ง€์† ์‹œ๊ฐ„ (์ง€๋‚˜๋ฉด ์ž๋™ ์ค‘๋‹จ). | -| `repeat_interval` | | `null` | ์ง€์ • ์‹œ ํ•ด๋‹น ์ฃผ๊ธฐ๋งˆ๋‹ค counter๋ฅผ ์ฆ๊ฐ€์‹œํ‚ค๋ฉฐ payload ๊ฐฑ์‹  (์ƒ๋žต ์‹œ 1ํšŒ ์„ธํŒ… ํ›„ ๋Œ€๊ธฐ). | -| `stop_on_response` | | `true` | ์ด ๊ธฐ๊ธฐ์˜ `match` ์กฐ๊ฑด์„ ๋งŒ์กฑํ•˜๋Š” ์‘๋‹ต ํŒจํ‚ท ์ˆ˜์‹  ์‹œ ์ฆ‰์‹œ ๊ด‘๊ณ  ์†ก์‹  ์ค‘๋‹จ. | -| `connectable` | | `false` | BLE ์—ฐ๊ฒฐ ๊ฐ€๋Šฅ ์—ฌ๋ถ€. | -| `scannable` | | `true` | Scannable ๊ด‘๊ณ  ์—ฌ๋ถ€. | -| `include_device_name` | | `false` | ๊ธฐ๊ธฐ ์ด๋ฆ„ ํฌํ•จ ์—ฌ๋ถ€ (31๋ฐ”์ดํŠธ ์˜ˆ์‚ฐ ์ ˆ์•ฝ์„ ์œ„ํ•ด ๊ธฐ๋ณธ false ๊ถŒ์žฅ). | - -> **์•Œ๋ฆผ:** `advertise` ๋ธ”๋ก์ด ์„ค์ •๋œ ๊ธฐ๊ธฐ๋Š” HA์— `{id}_advertising` ์ง„๋‹จ ๋ฐ”์ด๋„ˆ๋ฆฌ ์„ผ์„œ(`binary_sensor`)๊ฐ€ ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋˜์–ด ํ˜„์žฌ ๊ด‘๊ณ  ์†ก์‹  ์ง„ํ–‰ ์—ฌ๋ถ€(`on`/`off`)๋ฅผ ๋ณด๊ณ ํ•ฉ๋‹ˆ๋‹ค. - ---- - -## source: gatt_notify โ€” GATT ์—ฐ๊ฒฐ - -ํŠน์ • BLE ๊ธฐ๊ธฐ์— ์—ฐ๊ฒฐํ•˜์—ฌ GATT ์บ๋ฆญํ„ฐ๋ฆฌ์Šคํ‹ฑ์„ ๊ตฌ๋…ํ•˜๊ณ  ์•Œ๋ฆผ์„ ์ˆ˜์‹ ํ•ฉ๋‹ˆ๋‹ค. ์„ ํƒ์ ์œผ๋กœ hex ๋ช…๋ น์„ ์—ญ๋ฐฉํ–ฅ์œผ๋กœ ์ „์†กํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. - -```yaml -- id: custom_meter - name: "Custom BLE Meter" - source: gatt_notify - gatt: - mac: "AA:BB:CC:DD:EE:FF" # ๋˜๋Š” ์•ฑ Sensors ํƒญ์—์„œ ๋ฐ”์ธ๋”ฉ - service_uuid: "ffe0" - notify_char_uuid: "ffe1" - write_char_uuid: "ffe2" # ์„ ํƒ โ€” controls ์‚ฌ์šฉ ์‹œ ํ•„์š” - auto_connect: true - sensors: - - key: power - unit: "W" - device_class: power - state_class: measurement - decode: { offset: 0, length: 2, type: uint16, endian: little } - controls: - - key: relay - type: switch - command: { on: "A10100", off: "A10000" } -``` - -| ํ•„๋“œ | ํƒ€์ž… | ํ•„์ˆ˜ | ์„ค๋ช… | -|------|------|------|------| -| `mac` | string | โŒ | ๊ธฐ๊ธฐ MAC ์ฃผ์†Œ. ์•ฑ ๋ฐ”์ธ๋”ฉ์œผ๋กœ๋„ ์„ค์ • ๊ฐ€๋Šฅ. | -| `service_uuid` | string | โœ… | GATT ์„œ๋น„์Šค UUID (16๋น„ํŠธ ๋˜๋Š” 128๋น„ํŠธ). | -| `notify_char_uuid` | string | โœ… | ์•Œ๋ฆผ์„ ๊ตฌ๋…ํ•  ์บ๋ฆญํ„ฐ๋ฆฌ์Šคํ‹ฑ. | -| `write_char_uuid` | string | โŒ | ๋ช…๋ น์„ ์ „์†กํ•  ์บ๋ฆญํ„ฐ๋ฆฌ์Šคํ‹ฑ (controls์— ํ•„์š”). | -| `auto_connect` | bool | โŒ | ์—ฐ๊ฒฐ ๋Š๊น€ ์‹œ ์ž๋™ ์žฌ์—ฐ๊ฒฐ. ๊ธฐ๋ณธ `true`. | - -> YAML์— `mac`์„ ์„ค์ •ํ•˜์ง€ ์•Š์œผ๋ฉด ์•ฑ์˜ **Sensors ํƒญ**์—์„œ ๊ธฐ๊ธฐ ์˜† "Connect / Bind"๋ฅผ ๋ˆŒ๋Ÿฌ ๋ฐ”์ธ๋”ฉํ•˜์„ธ์š”. - ---- - -## source: obd โ€” ELM327 OBD ํด๋ง - -BLE ELM327 ์–ด๋Œ‘ํ„ฐ์— ์—ฐ๊ฒฐํ•˜์—ฌ OBD-II(๋ฐ GM mode 22) PID ๋ช…๋ น์„ ์ „์†กํ•˜๊ณ  ISO-TP ์‘๋‹ต์„ ํŒŒ์‹ฑํ•ฉ๋‹ˆ๋‹ค. ๋‚ด์žฅ `preset`์„ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ `mode`/`pid`/`formula`๋ฅผ ์ง์ ‘ ์ •์˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. - -```yaml -- id: car_obd - name: "Vehicle OBD" - source: obd - obd: - # mac: "AA:BB:CC:DD:EE:FF" # ๋˜๋Š” ์•ฑ์—์„œ ๋ฐ”์ธ๋”ฉ - service_uuid: "18F0" - tx_char_uuid: "2AF1" - rx_char_uuid: "2AF0" - tx_delay: 50ms - init_commands: - - "ATZ" - - "ATE0" - - "ATL0" - - "ATS0" - - "ATH0" - - "ATSP6" # ํ”„๋กœํ† ์ฝœ: ATSP0=์ž๋™, ATSP6=ISO 15765-4 CAN 500kbps - sensors: - # ํ”„๋ฆฌ์…‹ ์‚ฌ์šฉ (๊ถŒ์žฅ) - - { key: rpm, preset: rpm, update_interval: 1s } - - { key: speed, preset: speed, update_interval: 1s } - # ์ง์ ‘ ์ •์˜ - - key: custom_pid - mode: "01" - pid: "0C" - formula: "(a*256+b)/4" - unit: "rpm" - state_class: measurement - update_interval: 1s -``` - -| ํ•„๋“œ | ํƒ€์ž… | ๊ธฐ๋ณธ๊ฐ’ | ์„ค๋ช… | -|------|------|--------|------| -| `mac` | string | โ€” | ์–ด๋Œ‘ํ„ฐ MAC. ์—ฌ๊ธฐ ๋˜๋Š” ์•ฑ ๋ฐ”์ธ๋”ฉ์œผ๋กœ ์„ค์ •. | -| `service_uuid` | string | `"FFF0"` | BLE GATT ์„œ๋น„์Šค UUID. | -| `tx_char_uuid` | string | `"FFF2"` | ์“ฐ๊ธฐ ์บ๋ฆญํ„ฐ๋ฆฌ์Šคํ‹ฑ (๋ช…๋ น ์ „์†ก). | -| `rx_char_uuid` | string | `"FFF1"` | ์•Œ๋ฆผ ์บ๋ฆญํ„ฐ๋ฆฌ์Šคํ‹ฑ (์‘๋‹ต ์ˆ˜์‹ ). | -| `tx_delay` | duration | `50ms` | ์—ฐ์† ๋ช…๋ น ์‚ฌ์ด ๋”œ๋ ˆ์ด. | -| `init_commands` | list | `[]` | ํด๋ง ์‹œ์ž‘ ์ „ ์—ฐ๊ฒฐ๋งˆ๋‹ค ํ•œ ๋ฒˆ ์ „์†กํ•˜๋Š” ์ดˆ๊ธฐ ๋ช…๋ น. | -| `default_commands` | list | ์ž๋™ | `pre_commands`๊ฐ€ ์—†๋Š” ์„ผ์„œ๋ฅผ ํด๋งํ•˜๊ธฐ ์ง์ „์— ๋ณด๋‚ผ ๋ช…๋ น. ๋ณดํ†ต ์ƒ๋žตํ•˜๋ฉด ๋จ โ€” ์•„๋ž˜ "ํ—ค๋” ๋ณต์›" ์ฐธ๊ณ . | -| `auto_connect` | bool | `true` | ์—ฐ๊ฒฐ ๋Š๊น€ ์‹œ ์ž๋™ ์žฌ์—ฐ๊ฒฐ. | - -**OBD ์„ผ์„œ ์ „์šฉ ํ•„๋“œ:** - -| ํ•„๋“œ | ํƒ€์ž… | ์„ค๋ช… | -|------|------|------| -| `preset` | string | ๋‚ด์žฅ ํ”„๋ฆฌ์…‹ ์‚ฌ์šฉ (์•„๋ž˜ ํ‘œ ์ฐธ์กฐ). | -| `mode` | string | OBD ๋ชจ๋“œ. `"01"`=ํ‘œ์ค€, `"22"`=์ œ์กฐ์‚ฌ ํ™•์žฅ. ๊ธฐ๋ณธ `"01"`. | -| `pid` | string | PID hex ์ฝ”๋“œ. ์˜ˆ: `"0C"`, `"199A"`. | -| `formula` | string | ์ˆ˜์‹. `a`~`t`๊ฐ€ ์‘๋‹ต์˜ 0~19๋ฒˆ์งธ ๋ฐ”์ดํŠธ. ์˜ˆ: `"(a*256+b)/4"`. ์‘๋‹ต์ด ์งง์•„ ์‹์— ์“ด ๋ฐ”์ดํŠธ๊ฐ€ ์—†์œผ๋ฉด ๊ทธ ์ฃผ๊ธฐ๋Š” ๋ฐœํ–‰ํ•˜์ง€ ์•Š์Œ. | -| `decode` | map | `formula` ๋Œ€์‹  offset์œผ๋กœ ๊ฐ’ ์ถ”์ถœ. 20๋ฒˆ์งธ ์ดํ›„ ๋ฐ”์ดํŠธ๋ฅผ ์ฝ์–ด์•ผ ํ•  ๋•Œ ์‚ฌ์šฉ (์•„๋ž˜ ์ฐธ์กฐ). | -| `update_interval` | duration | ์ด PID๋ฅผ ํด๋งํ•˜๋Š” ๊ฐ„๊ฒฉ. ๊ธฐ๋ณธ `60s`. | -| `pre_commands` | list | ์ด PID ์ „์— ์ „์†กํ•  ์ถ”๊ฐ€ ๋ช…๋ น (์˜ˆ: GM ํ—ค๋” ์ „ํ™˜). | - -### ๊ธด ์‘๋‹ต์—์„œ ๊ฐ’ ๊บผ๋‚ด๊ธฐ (decode) - -`formula`์˜ ๋ณ€์ˆ˜๋Š” ์‘๋‹ต์˜ **์•ž 20๋ฐ”์ดํŠธ**(`a`~`t`)๊นŒ์ง€๋งŒ ๊ฐ€๋ฆฌํ‚ต๋‹ˆ๋‹ค. ๊ทธ๋ณด๋‹ค ๋’ค์— ์žˆ๋Š” ๊ฐ’์€ -`decode`๋กœ ์ฝ์Šต๋‹ˆ๋‹ค. ํ•„๋“œ ๊ตฌ์„ฑ์€ [decode ์ ˆ](#decode--๋ฐ”์ดํŠธ-๋””์ฝ”๋”ฉ)๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. - -```yaml -# ํ˜„๋Œ€ 21 03 ๋ธ”๋ก์˜ ์ด์ฃผํ–‰๊ฑฐ๋ฆฌ โ€” byte 57~60, 32bit, /1000 = km -- key: odometer - mode: "21" - pid: "03" - pre_commands: ["ATSH7E0"] - decode: { offset: 57, length: 4, type: uint32, endian: big, scale: 0.001 } - unit: "km" - device_class: distance - state_class: total_increasing -``` - -`offset`์€ mode/PID ์—์ฝ”๋ฅผ ์ œ์™ธํ•œ ๋ฐ์ดํ„ฐ์˜ 0-based ์œ„์น˜๋กœ, `formula`์˜ `a`๊ฐ€ `offset: 0`๊ณผ -๊ฐ™์Šต๋‹ˆ๋‹ค. ์‘๋‹ต์ด ์งง์•„ `offset + length`๊ฐ€ ๋ฒ”์œ„๋ฅผ ๋ฒ—์–ด๋‚˜๋ฉด ๊ทธ ์ฃผ๊ธฐ์—๋Š” ์•„๋ฌด๊ฒƒ๋„ ๋ฐœํ–‰ํ•˜์ง€ -์•Š์Šต๋‹ˆ๋‹ค โ€” ์ง€์›ํ•˜์ง€ ์•Š๋Š” ์ฐจ์—์„œ ์—‰๋šฑํ•œ ๊ฐ’์ด ์˜ฌ๋ผ์˜ค์ง€ ์•Š์Šต๋‹ˆ๋‹ค. - -ํ•œ ์„ผ์„œ์— `decode`์™€ `formula`๋ฅผ ๋ชจ๋‘ ์“ฐ๋ฉด `decode`๊ฐ€ ์šฐ์„ ํ•ฉ๋‹ˆ๋‹ค. - -### ํ—ค๋” ๋ณต์› (ATSH) - -ELM327์˜ ์ „์†ก ํ—ค๋”๋Š” **ํ•œ ๋ฒˆ ๋ฐ”๊พธ๋ฉด ๊ณ„์† ์œ ์ง€**๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ `pre_commands: ["ATSH7C6"]` ๊ฐ™์€ -์„ผ์„œ ๋’ค์— `pre_commands`๊ฐ€ ์—†๋Š” ํ‘œ์ค€ ์„ผ์„œ(rpm, speed ๋“ฑ)๊ฐ€ ํด๋ง๋˜๋ฉด, ๊ทธ ์š”์ฒญ๊นŒ์ง€ 7C6์œผ๋กœ ๋‚˜๊ฐ€ -`NO DATA`๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. - -์•ฑ์ด ์ด๋ฅผ ์ž๋™์œผ๋กœ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. **ํ•œ ์„ผ์„œ๋ผ๋„ `pre_commands`์— `ATSH`๋ฅผ ์“ฐ๋ฉด**, `pre_commands`๊ฐ€ -์—†๋Š” ์„ผ์„œ ์•ž์— ํ—ค๋” ๋ณต์› ๋ช…๋ น์„ ์ž๋™์œผ๋กœ ๋„ฃ์Šต๋‹ˆ๋‹ค. ๋ณต์›ํ•  ํ—ค๋”๋Š” ์ด ์ˆœ์„œ๋กœ ์ •ํ•ด์ง‘๋‹ˆ๋‹ค: - -1. `default_commands` โ€” ๋ช…์‹œํ–ˆ๋‹ค๋ฉด ์ด ๊ฐ’ -2. `init_commands`์˜ ๋งˆ์ง€๋ง‰ `ATSHโ€ฆ` -3. `ATSH7DF` โ€” ELM327์˜ 11bit CAN ๊ธฐ๋ณธ ํ—ค๋” - -`ATSH`๋ฅผ ์“ฐ๋Š” ์„ผ์„œ๊ฐ€ ํ•˜๋‚˜๋„ ์—†์œผ๋ฉด ์•„๋ฌด๊ฒƒ๋„ ๋ณด๋‚ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. K-line(ISO 9141 / KWP)์ฒ˜๋Ÿผ ํ—ค๋” -ํ˜•์‹์ด ๋‹ค๋ฅธ ํ”„๋กœํ† ์ฝœ์— `ATSH7DF`๋ฅผ ๋ฐ€์–ด๋„ฃ์ง€ ์•Š๊ธฐ ์œ„ํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค. - -์ฆ‰ **๋ณดํ†ต์€ `default_commands`๋ฅผ ์ƒ๋žต**ํ•˜๋ฉด ๋˜๊ณ , ๋ณต์› ํ—ค๋”๋ฅผ ์ง์ ‘ ์ง€์ •ํ•ด์•ผ ํ•  ๋•Œ๋งŒ ์”๋‹ˆ๋‹ค: - -```yaml -obd: - init_commands: ["ATSP6"] - default_commands: ["ATSH7E0"] # ๋ธŒ๋กœ๋“œ์บ์ŠคํŠธ(7DF) ๋Œ€์‹  ์—”์ง„ ECU ์ง์ ‘ ์ง€์ • -``` - ---- - -## sensors โ€” ์„ผ์„œ ์„ค์ • - -`sensors` ๋ชฉ๋ก์˜ ๊ฐ ํ•ญ๋ชฉ์€ ํ•˜๋‚˜์˜ HA ์—”ํ‹ฐํ‹ฐ๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. - -```yaml -sensors: - - key: temperature # ํ•„์ˆ˜ โ€” ๊ธฐ๊ธฐ ๋‚ด ๊ณ ์œ  ํ‚ค - platform: sensor # sensor | binary_sensor | text_sensor | event - device_class: temperature # HA device_class (์„ ํƒ) - unit: "ยฐC" - state_class: measurement # measurement | total | total_increasing - icon: "mdi:thermometer" - entity_category: diagnostic # diagnostic | config (์ผ๋ฐ˜ ์„ผ์„œ๋Š” ์ƒ๋žต) - accuracy_decimals: 2 - source_field: manufacturer_data # advertisement๋งŒ - min_length: 24 - decode: - offset: 18 - length: 2 - type: uint16 - endian: big - scale: 0.002670288 - offset_value: -45 - publish: # ์ด ์„ผ์„œ๋งŒ์˜ ๋ฐœํ–‰ ๊ทœ์น™ ๋ฎ์–ด์“ฐ๊ธฐ - deadband: 0.1 - min_interval: 30s -``` - -| ํ•„๋“œ | ํƒ€์ž… | ํ•„์ˆ˜ | ์„ค๋ช… | -|------|------|------|------| -| `key` | string | โœ… | ๊ธฐ๊ธฐ ๋‚ด ๊ณ ์œ  ํ‚ค. HA ์—”ํ‹ฐํ‹ฐ unique_id์˜ ์ผ๋ถ€. | -| `platform` | string | โŒ | HA ์—”ํ‹ฐํ‹ฐ ํ”Œ๋žซํผ. ๊ธฐ๋ณธ `sensor`. | -| `device_class` | string | โŒ | HA device class (temperature, humidity, battery, voltage, โ€ฆ). | -| `unit` | string | โŒ | HA์— ํ‘œ์‹œ๋˜๋Š” ๋‹จ์œ„. | -| `state_class` | string | โŒ | HA ํ†ต๊ณ„์šฉ state class. | -| `icon` | string | โŒ | MDI ์•„์ด์ฝ˜. ์˜ˆ: `"mdi:thermometer"`. | -| `entity_category` | string | โŒ | `diagnostic` ๋˜๋Š” `config`. ์ผ๋ฐ˜ ์„ผ์„œ๋Š” ์ƒ๋žต. | -| `accuracy_decimals` | int | โŒ | ๋””์ฝ”๋”ฉ๋œ ๊ฐ’์„ ์†Œ์ˆ˜ N์ž๋ฆฌ๋กœ ๋ฐ˜์˜ฌ๋ฆผ. | -| `source_field` | enum | โŒ | `manufacturer_data` / `service_data` / `raw`. ๊ธฐ๋ณธ `raw`. | -| `min_length` | int | โŒ | ํŽ˜์ด๋กœ๋“œ๊ฐ€ N๋ฐ”์ดํŠธ ๋ฏธ๋งŒ์ด๋ฉด ์ด ์„ผ์„œ๋ฅผ ๊ฑด๋„ˆ๋œ€. | -| `decode` | object | โŒ | ๋ฐ”์ด๋„ˆ๋ฆฌ ๋””์ฝ”๋”ฉ ๊ทœ์น™. ์•„๋ž˜ ์ฐธ์กฐ. | -| `publish` | object | โŒ | ์ด ์„ผ์„œ๋งŒ์˜ ๋ฐœํ–‰ ๊ทœ์น™ ๋ฎ์–ด์“ฐ๊ธฐ. | - -### decode โ€” ๋ฐ”์ด๋„ˆ๋ฆฌ ๋””์ฝ”๋”ฉ - -raw ๋ฐ”์ดํŠธ ๋ฐฐ์—ด์—์„œ ์ˆซ์ž ๋˜๋Š” ๋ฌธ์ž์—ด ๊ฐ’์„ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค. - -**๊ณต์‹:** `์ตœ์ข…๊ฐ’ = (raw_์ •์ˆ˜ * scale) + offset_value` - -```yaml -decode: - offset: 18 # ๋ฐ”์ดํŠธ ์˜คํ”„์…‹ (0-based) - length: 2 # ์ฝ์„ ๋ฐ”์ดํŠธ ์ˆ˜ - type: uint16 # ๋ฐ์ดํ„ฐ ํƒ€์ž… (์•„๋ž˜ ํ‘œ ์ฐธ์กฐ) - endian: big # big | little - bitmask: 0x0F # (์„ ํƒ) AND ๋น„ํŠธ๋งˆ์Šคํฌ ์ ์šฉ ํ›„ ๋””์ฝ”๋”ฉ - scale: 0.1 # (์„ ํƒ) ๊ณฑํ•  ๊ณ„์ˆ˜. ๊ธฐ๋ณธ 1.0 - offset_value: -40 # (์„ ํƒ) ๋”ํ•  ์˜คํ”„์…‹. ๊ธฐ๋ณธ 0.0 - map: # (์„ ํƒ) ์ •์ˆ˜๊ฐ’ โ†’ ๋ฌธ์ž์—ด ๋งคํ•‘ - "0": "off" - "1": "on" - "2": "standby" -``` - -| ํ•„๋“œ | ํƒ€์ž… | ๊ธฐ๋ณธ๊ฐ’ | ์„ค๋ช… | -|------|------|--------|------| -| `offset` | int | `0` | ์‹œ์ž‘ ๋ฐ”์ดํŠธ ์ธ๋ฑ์Šค (0๋ถ€ํ„ฐ). | -| `length` | int | `1` | ์ฝ์„ ๋ฐ”์ดํŠธ ์ˆ˜. | -| `type` | enum | `uint8` | ๋ฐ”์ดํŠธ๋ฅผ ํ•ด์„ํ•  ๋ฐ์ดํ„ฐ ํƒ€์ž…. | -| `endian` | enum | `big` | ๋ฐ”์ดํŠธ ์ˆœ์„œ. `big`=MSB ๋จผ์ €, `little`=LSB ๋จผ์ €. | -| `bitmask` | int | `null` | ์Šค์ผ€์ผ๋ง ์ „ AND ๋น„ํŠธ๋งˆ์Šคํฌ ์ ์šฉ. | -| `scale` | float | `1.0` | raw ์ •์ˆ˜์— ๊ณฑํ•  ๊ณ„์ˆ˜. | -| `offset_value` | float | `0.0` | ์Šค์ผ€์ผ๋ง ํ›„ ๋”ํ•˜๋Š” ๊ฐ’: `(raw * scale) + offset_value`. | -| `map` | object | `{}` | ์ •์ˆ˜ ๊ฒฐ๊ณผ๋ฅผ ๋ฌธ์ž์—ด๋กœ ๋งคํ•‘. ํ‚ค๋Š” ๋”ฐ์˜ดํ‘œ๋กœ ๊ฐ์‹ผ ๋ฌธ์ž์—ด. | - -### ๋ฐ์ดํ„ฐ ํƒ€์ž… - -| ํƒ€์ž… | ๋ฐ”์ดํŠธ | ์„ค๋ช… | -|------|--------|------| -| `uint8` | 1 | ๋ถ€ํ˜ธ ์—†๋Š” 8๋น„ํŠธ ์ •์ˆ˜ (0โ€“255). | -| `int8` | 1 | ๋ถ€ํ˜ธ ์žˆ๋Š” 8๋น„ํŠธ ์ •์ˆ˜ (-128โ€“127). | -| `uint16` | 2 | ๋ถ€ํ˜ธ ์—†๋Š” 16๋น„ํŠธ ์ •์ˆ˜ (0โ€“65535). | -| `int16` | 2 | ๋ถ€ํ˜ธ ์žˆ๋Š” 16๋น„ํŠธ ์ •์ˆ˜ (-32768โ€“32767). | -| `uint32` | 4 | ๋ถ€ํ˜ธ ์—†๋Š” 32๋น„ํŠธ ์ •์ˆ˜. | -| `int32` | 4 | ๋ถ€ํ˜ธ ์žˆ๋Š” 32๋น„ํŠธ ์ •์ˆ˜. | -| `float32` | 4 | IEEE 754 ๋‹จ์ •๋ฐ€๋„ ๋ถ€๋™์†Œ์ˆ˜์ . | -| `timestamp` | 4 | ๊ฐ ๋ฐ”์ดํŠธ๋ฅผ ์›”/์ผ/์‹œ/๋ถ„์œผ๋กœ ํ•ด์„. ISO 8601 ๋ฌธ์ž์—ด ๋ฐ˜ํ™˜. | -| `string` | N | ๋ฐ”์ดํŠธ๋ฅผ ASCII๋กœ ๋””์ฝ”๋”ฉ. `length: 0` ์ง€์ • ์‹œ ์ž”์—ฌ ๋ฐ”์ดํŠธ ์ „์ฒด๋ฅผ ๊ฐ€๋ณ€ ๊ธธ์ด๋กœ ์ฝ๊ณ  ๊ณต๋ฐฑ/null์„ ์ž๋™ ํŠธ๋ฆผํ•ฉ๋‹ˆ๋‹ค. `platform: text_sensor`์™€ ํ•จ๊ป˜ ์‚ฌ์šฉ. | - ---- - -## controls โ€” HA ์ œ์–ด - -HA์—์„œ ์ œ์–ด ์‹œ BLE ์“ฐ๊ธฐ ๋ช…๋ น์„ ์ „์†กํ•˜๋Š” HA ์—”ํ‹ฐํ‹ฐ๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. `gatt_notify`์™€ `obd` ์†Œ์Šค์—์„œ๋งŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. - -```yaml -controls: - # Switch โ€” on/off hex ๋ช…๋ น - - key: relay - type: switch - name: "Main Relay" - icon: "mdi:electric-switch" - entity_category: config - command: - on: "A10100" - off: "A10000" - - # Number โ€” ๊ฐ’์„ hex์— ์‚ฝ์ž… - - key: brightness - type: number - min: 0 - max: 100 - step: 1 - command: - template: "B2{value:02X}FF" - - # Select โ€” ์˜ต์…˜๋ณ„ hex ๋ช…๋ น - - key: mode - type: select - options: ["auto", "cool", "heat", "fan"] - command: - auto: "C000" - cool: "C001" - heat: "C002" - fan: "C003" - - # Button โ€” ๋ˆ„๋ฅด๋ฉด hex ์ „์†ก - - key: restart - type: button - command: - press: "FFFE" -``` - -| ํ•„๋“œ | ํƒ€์ž… | ํ•„์ˆ˜ | ์„ค๋ช… | -|------|------|------|------| -| `key` | string | โœ… | ๊ธฐ๊ธฐ ๋‚ด ๊ณ ์œ  ํ‚ค. | -| `type` | enum | โœ… | `switch` / `number` / `select` / `button`. | -| `name` | string | โŒ | HA ํ‘œ์‹œ ์ด๋ฆ„. ์ƒ๋žต ์‹œ key์—์„œ ์ž๋™ ์ƒ์„ฑ. | -| `icon` | string | โŒ | MDI ์•„์ด์ฝ˜. | -| `entity_category` | string | โŒ | `config` ๋˜๋Š” `diagnostic`. | -| `command` | object | โŒ* | ๋ช…๋ น ๋งต. type์— ๋”ฐ๋ผ ํ‚ค๊ฐ€ ๋‹ค๋ฆ…๋‹ˆ๋‹ค (์œ„ ์˜ˆ์ œ ์ฐธ์กฐ). `action`์ด ์—†์„ ๋•Œ ํ•„์ˆ˜. | -| `action` | enum | โŒ* | ์•ฑ ๋‚ด๋ถ€ ๋™์ž‘ ํŠธ๋ฆฌ๊ฑฐ (`advertise` \| `stop_advertise`). `action` ์‚ฌ์šฉ ์‹œ `command` ์ƒ๋žต ๊ฐ€๋Šฅ. | -| `options` | list | select๋งŒ | `select` ํƒ€์ž… ์˜ต์…˜ ๋ชฉ๋ก. | -| `min` | float | number๋งŒ | `number` ํƒ€์ž… ์ตœ์†Ÿ๊ฐ’. | -| `max` | float | number๋งŒ | `number` ํƒ€์ž… ์ตœ๋Œ“๊ฐ’. | -| `step` | float | โŒ | `number` ํƒ€์ž… ๋‹จ๊ณ„. | - -**command ํ…œํ”Œ๋ฆฟ ํ”Œ๋ ˆ์ด์Šคํ™€๋”:** - -| ํ”Œ๋ ˆ์ด์Šคํ™€๋” | ์„ค๋ช… | -|-------------|------| -| `{value}` | ์ •์ˆ˜ ๊ฐ’ (10์ง„์ˆ˜). | -| `{value:02X}` | ๊ฐ’์„ 2์ž๋ฆฌ ๋Œ€๋ฌธ์ž hex๋กœ (0 ํŒจ๋”ฉ). | -| `{value:04X}` | 4์ž๋ฆฌ ๋Œ€๋ฌธ์ž hex. | - ---- - -## publish โ€” ์„ผ์„œ๋ณ„ ๋ฐœํ–‰ ํ•„ํ„ฐ - -ํŠน์ • ์„ผ์„œ์— ๋Œ€ํ•ด ์ „์—ญ `defaults.publish`๋ฅผ ๋ฎ์–ด์”๋‹ˆ๋‹ค. ๋А๋ฆฌ๊ฒŒ ๋ณ€ํ•˜๋Š” ์„ผ์„œ(์—ฐ๋ฃŒ๋Ÿ‰)๋‚˜ ๋น ๋ฅธ ์—…๋ฐ์ดํŠธ๊ฐ€ ํ•„์š”ํ•œ ์„ผ์„œ(RPM)์— ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค. - -```yaml -sensors: - - key: fuel_level - preset: fuel_level - update_interval: 30s - publish: - on_change_only: true - deadband: 0.5 - min_interval: 60s - heartbeat: 30m -``` - -**์šฐ์„ ์ˆœ์œ„:** sensor `publish` > device `publish` > `defaults.publish` - ---- - -## OBD ํ”„๋ฆฌ์…‹ ๋ชฉ๋ก - -OBD ์„ผ์„œ์—์„œ `preset: <์ด๋ฆ„>`์œผ๋กœ ๋‚ด์žฅ ์ •์˜๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ํ”„๋ฆฌ์…‹ ์ง€์ • ํ›„ ๊ฐœ๋ณ„ ํ•„๋“œ(`unit`, `accuracy_decimals` ๋“ฑ)๋ฅผ ๋ฎ์–ด์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. - -### ํ‘œ์ค€ OBD-II (mode 01) - -| ํ”„๋ฆฌ์…‹ | PID | ๊ณต์‹ | ๋‹จ์œ„ | ์„ค๋ช… | -|--------|-----|------|------|------| -| `rpm` | `0C` | `(a*256+b)/4` | rpm | ์—”์ง„ RPM | -| `speed` | `0D` | `a` | km/h | ์ฐจ์† | -| `engine_load` | `04` | `a/2.55` | % | ์—”์ง„ ๋ถ€ํ•˜ | -| `throttle` | `11` | `a/2.55` | % | ์Šค๋กœํ‹€ ๊ฐœ๋„ | -| `coolant_temp` | `05` | `a-40` | ยฐC | ๋ƒ‰๊ฐ์ˆ˜ ์˜จ๋„ | -| `intake_air_temp` | `0F` | `a-40` | ยฐC | ํก๊ธฐ ์˜จ๋„ | -| `ambient_temp` | `46` | `a-40` | ยฐC | ์™ธ๊ธฐ ์˜จ๋„ | -| `battery_voltage` | `42` | `(a*256+b)/1000` | V | ๋ฐฐํ„ฐ๋ฆฌ ์ „์•• | -| `run_time` | `1F` | `a*256+b` | s | ์‹œ๋™ ํ›„ ๊ฒฝ๊ณผ ์‹œ๊ฐ„ | -| `fuel_level` | `2F` | `a/2.55` | % | ์—ฐ๋ฃŒ๋Ÿ‰ | -| `actual_torque` | `62` | `a-125` | % | ์‹ค์ œ ํ† ํฌ | -| `odometer` | `A6` | `(a*16777216+b*65536+c*256+d)/10` | km | ์ฃผํ–‰ ๊ฑฐ๋ฆฌ | - -### GM ํ™•์žฅ (mode 22) - -| ํ”„๋ฆฌ์…‹ | PID | ๊ณต์‹ | ๋‹จ์œ„ | ์„ค๋ช… | -|--------|-----|------|------|------| -| `gm_current_gear` | `199A` | `a` | โ€” | ํ˜„์žฌ ๊ธฐ์–ด | -| `gm_prnd_status_alt` | `2889` | `a` | โ€” | PRND ์ƒํƒœ | -| `gm_oil_pressure` | `115C` | `(a*0.65)-17.5` | psi | ์˜ค์ผ ์••๋ ฅ | -| `gm_trans_temp` | `1940` | `a-40` | ยฐC | ๋ณ€์†๊ธฐ ์˜จ๋„ | -| `gm_fuel_level_liters` | `132A` | `(a*256+b)/64` | L | ์—ฐ๋ฃŒ๋Ÿ‰ (๋ฆฌํ„ฐ) | - ---- - -## ์ „์ฒด ์˜ˆ์ œ - -### ์˜ˆ์ œ 1 โ€” Jaalee JHT (iBeacon ์˜จ๋„ยท์Šต๋„) - -```yaml -# instance_mode: mac โ†’ ๊ฐ ๊ธฐ๊ธฐ MAC๋งˆ๋‹ค ๋ณ„๋„ ์—”ํ‹ฐํ‹ฐ ์ƒ์„ฑ -- id: jaalee_jht - name: "Jaalee JHT" - source: advertisement - instance_mode: mac - match: - manufacturer_id: 76 # Apple Inc. (๋ฐ˜๋“œ์‹œ 10์ง„์ˆ˜) - manufacturer_min_length: 24 - manufacturer_hex_prefix: "0215" # iBeacon ํƒ€์ž… ๋งˆ์ปค - sensors: - - key: temperature - device_class: temperature - unit: "ยฐC" - state_class: measurement - accuracy_decimals: 2 - source_field: manufacturer_data - decode: { offset: 18, length: 2, type: uint16, endian: big, scale: 0.002670288, offset_value: -45 } - - key: humidity - device_class: humidity - unit: "%" - state_class: measurement - accuracy_decimals: 2 - source_field: manufacturer_data - decode: { offset: 20, length: 2, type: uint16, endian: big, scale: 0.001524504 } - - key: battery - device_class: battery - unit: "%" - state_class: measurement - source_field: manufacturer_data - decode: { offset: 23, length: 1, type: uint8 } -``` - -### ์˜ˆ์ œ 2 โ€” ์ปค์Šคํ…€ ์„œ๋น„์Šค ๋ฐ์ดํ„ฐ ์„ผ์„œ - -```yaml -# ์„œ๋น„์Šค ๋ฐ์ดํ„ฐ์— ์„ผ์„œ ๊ฐ’์ด ํฌํ•จ๋œ ์ปค์Šคํ…€ ๊ธฐ๊ธฐ -- id: my_env_sensor - name: "Environment Sensor" - source: advertisement - instance_mode: shared - match: - service_data_uuid: "181A" # Environmental Sensing UUID - sensors: - - key: temperature - device_class: temperature - unit: "ยฐC" - state_class: measurement - accuracy_decimals: 1 - source_field: service_data - decode: { offset: 0, length: 2, type: int16, endian: little, scale: 0.01 } - - key: humidity - device_class: humidity - unit: "%" - state_class: measurement - accuracy_decimals: 1 - source_field: service_data - decode: { offset: 2, length: 2, type: uint16, endian: little, scale: 0.01 } - - key: battery - device_class: battery - unit: "%" - source_field: service_data - decode: { offset: 9, length: 1, type: uint8 } -``` - -### ์˜ˆ์ œ 3 โ€” GATT ์„ผ์„œ + ์Šค์œ„์น˜ ์ œ์–ด - -```yaml -# GATT ๊ธฐ๋ฐ˜ ์ „๋ ฅ ๋ชจ๋‹ˆํ„ฐ + ๋ฆด๋ ˆ์ด ์ œ์–ด -- id: power_monitor - name: "Power Monitor" - source: gatt_notify - gatt: - service_uuid: "ffe0" - notify_char_uuid: "ffe1" - write_char_uuid: "ffe2" - sensors: - - key: power - device_class: power - unit: "W" - state_class: measurement - decode: { offset: 0, length: 2, type: uint16, endian: little } - - key: voltage - device_class: voltage - unit: "V" - state_class: measurement - accuracy_decimals: 1 - decode: { offset: 2, length: 2, type: uint16, endian: little, scale: 0.1 } - - key: current - device_class: current - unit: "A" - state_class: measurement - accuracy_decimals: 2 - decode: { offset: 4, length: 2, type: uint16, endian: little, scale: 0.01 } - controls: - - key: relay - type: switch - name: "Relay" - icon: "mdi:electric-switch" - command: { on: "A10100", off: "A10000" } -``` - -### ์˜ˆ์ œ 4 โ€” OBD ํ”„๋ฆฌ์…‹ + ์ปค์Šคํ…€ ๋ฐœํ–‰ ๊ทœ์น™ - -```yaml -# OBD ์ฐจ๋Ÿ‰ ์„ผ์„œ (ํ”„๋ฆฌ์…‹ + ์ปค์Šคํ…€ ๋ฐœํ–‰ ๊ทœ์น™) -- id: car_obd - name: "Vehicle" - source: obd - obd: - service_uuid: "18F0" - tx_char_uuid: "2AF1" - rx_char_uuid: "2AF0" - tx_delay: 50ms - init_commands: ["ATZ", "ATE0", "ATL0", "ATS0", "ATH0", "ATSP6"] - sensors: - - { key: rpm, preset: rpm, update_interval: 1s } - - { key: speed, preset: speed, update_interval: 1s } - - { key: coolant_temp, preset: coolant_temp, update_interval: 10s } - - key: fuel_level - preset: fuel_level - update_interval: 30s - publish: - deadband: 1.0 # 1% ๋ฏธ๋งŒ ๋ณ€ํ™” ๋ฌด์‹œ - min_interval: 60s - heartbeat: 10m -``` - -### ์˜ˆ์ œ 5 โ€” ๊ฐ’ ๋งคํ•‘ (์ƒํƒœ ์ฝ”๋“œ) - -```yaml -# ์ƒํƒœ ์ฝ”๋“œ๋ฅผ ๋ฌธ์ž์—ด๋กœ ๋งคํ•‘ํ•˜๋Š” ์˜ˆ์ œ -- id: status_device - name: "Status Device" - source: advertisement - instance_mode: shared - match: - manufacturer_id: 1234 - sensors: - - key: mode - platform: text_sensor - source_field: manufacturer_data - decode: - offset: 5 - length: 1 - type: uint8 - map: - "0": "idle" - "1": "running" - "2": "error" - "3": "standby" -``` - ---- - -## ์ฃผ์˜์‚ฌํ•ญ - -### โš ๏ธ manufacturer_id๋Š” ๋ฐ˜๋“œ์‹œ 10์ง„์ˆ˜๋กœ - -YAML ํŒŒ์„œ(`kaml`)๋Š” `0x004C`๋ฅผ `0`์œผ๋กœ ํŒŒ์‹ฑํ•˜๊ฑฐ๋‚˜ ์˜ค๋ฅ˜๋ฅผ ๋‚ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•ญ์ƒ hex๋ฅผ 10์ง„์ˆ˜๋กœ ๋ณ€ํ™˜ํ•˜์„ธ์š”: - -```yaml -# โŒ ์ž˜๋ชป๋œ ๋ฐฉ๋ฒ• โ€” ํŒŒ์‹ฑ ์˜ค๋ฅ˜ ๊ฐ€๋Šฅ -manufacturer_id: 0x004C - -# โœ… ์˜ฌ๋ฐ”๋ฅธ ๋ฐฉ๋ฒ• -manufacturer_id: 76 # 0x004C = 76 -manufacturer_id: 861 # 0x035D = 861 -``` - -### match์˜ AND ๋…ผ๋ฆฌ - -๋ชจ๋“  `match` ์กฐ๊ฑด์€ AND๋กœ ๊ฒฐํ•ฉ๋ฉ๋‹ˆ๋‹ค. `service_data_uuid`์™€ `manufacturer_id`๋ฅผ ํ•จ๊ป˜ ์ง€์ •ํ•˜๋ฉด ํŒจํ‚ท์ด **๋‘˜ ๋‹ค** ๋งŒ์กฑํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ๊ธฐ๊ฐ€ ํ•ญ์ƒ ํŠน์ • ํ•„๋“œ๋ฅผ ๊ด‘๊ณ ํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ํ•ด๋‹น ์กฐ๊ฑด์„ ์ œ๊ฑฐํ•˜์„ธ์š”. - -### instance_mode: mac โ€” ์กฐ๊ธฐ ์—”ํ‹ฐํ‹ฐ ์ƒ์„ฑ์„ ์œ„ํ•œ ๋ฐ”์ธ๋”ฉ - -`instance_mode: mac`์ด๊ณ  `match.mac`์ด ์—†์œผ๋ฉด ๊ธฐ๊ธฐ๊ฐ€ BLE ์Šค์บ”์—์„œ ๊ฐ์ง€๋œ ํ›„์—์•ผ HA ์—”ํ‹ฐํ‹ฐ๊ฐ€ ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค. ๊ฒŒ์ดํŠธ์›จ์ด ์—ฐ๊ฒฐ ์ฆ‰์‹œ ์—”ํ‹ฐํ‹ฐ๊ฐ€ ๋‚˜ํƒ€๋‚˜๋„๋ก ํ•˜๋ ค๋ฉด ์•ฑ **Sensors ํƒญ** โ†’ "Connect / Bind"์—์„œ MAC์„ ๋ฐ”์ธ๋”ฉํ•˜์„ธ์š”. - -### source_field ์„ ํƒ - -๊ด‘๊ณ  ์„ผ์„œ์˜ ํŽ˜์ด๋กœ๋“œ ์†Œ์Šค ์„ ํƒ: -- `manufacturer_data` โ€” ์ œ์กฐ์‚ฌ ID ์ดํ›„ ๋ฐ์ดํ„ฐ (์ปค์Šคํ…€ ์„ผ์„œ์—์„œ ๊ฐ€์žฅ ์ผ๋ฐ˜์ ) -- `service_data` โ€” ์„œ๋น„์Šค ๋ฐ์ดํ„ฐ AD ํƒ€์ž… ๋ฐ์ดํ„ฐ (0x181A ๋“ฑ ํ‘œ์ค€ ํ”„๋กœํ•„์— ์ผ๋ฐ˜์ ) -- `raw` โ€” ์ „์ฒด ์Šค์บ” ๋ ˆ์ฝ”๋“œ ๋ฐ”์ดํŠธ (๊ฑฐ์˜ ์‚ฌ์šฉ ์•ˆ ํ•จ) - -### ์‹œ๊ฐ„ ํ˜•์‹ - -์‹œ๊ฐ„์€ ๋ฐ€๋ฆฌ์ดˆ(`ms`), ์ดˆ(`s`), ๋ถ„(`m`)์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. - -```yaml -tx_delay: 50ms -min_interval: 10s -heartbeat: 5m -update_interval: 1s -``` - -### ์„ค์ •์€ ์บ์‹œ๋จ - -์•ฑ์€ ๋งˆ์ง€๋ง‰์œผ๋กœ ์„ฑ๊ณต์ ์œผ๋กœ ๋ถˆ๋Ÿฌ์˜จ ์„ค์ •์„ ์บ์‹œํ•ฉ๋‹ˆ๋‹ค. ์‹œ์ž‘ ์‹œ ๋„คํŠธ์›Œํฌ๊ฐ€ ์—†์œผ๋ฉด ์บ์‹œ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ด ๊ฒฝ์šฐ ์•ฑ ์ƒ๋‹จ์— "์บ์‹œ๋œ ์„ค์ • ์‚ฌ์šฉ ์ค‘"์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. - ---- - -## ๊ธฐ์—ฌํ•˜๊ธฐ - -๋ณธ์ธ ์ฐจ๋Ÿ‰์˜ OBD-II PID ์„ค์ •์„ ๊ณต์œ ํ•ด ์ฃผ์‹œ๋ฉด ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž๋“ค์—๊ฒŒ ํฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค! ์ž์„ธํ•œ ๊ณต์œ  ๋ฐ ๊ธฐ์—ฌ ๋ฐฉ๋ฒ•์€ [๊ธฐ์—ฌ ๊ฐ€์ด๋“œ(CONTRIBUTING.ko.md)](CONTRIBUTING.ko.md)๋ฅผ ์ฐธ๊ณ ํ•ด ์ฃผ์„ธ์š”. - ---- - -## ๋ผ์ด์„ ์Šค - -MIT diff --git a/README.md b/README.md index 4ab7ac9..f325b3f 100644 --- a/README.md +++ b/README.md @@ -1,775 +1,40 @@ -# HassBle Config +# HassBle Config โ€” Toyota Proace City -> This repository stores the device configuration (`config.yaml`) for the [HassBle](https://github.com/eigger/hassble-android) Android app. +Konfiguracja aplikacji [HassBle](https://gitea.trzcinski.pro/czcionka/hassble-android) okrojona do jednego +pojazdu: Toyota Proace City (platforma PSA K9, 2019+) z adapterem Vgate iCar Pro ELM327 V2.3 (Bluetooth 4.0 / BLE). -**[ํ•œ๊ตญ์–ด ๋ฌธ์„œ โ†’ README.ko.md](README.ko.md) | [Contributing Guide โ†’ CONTRIBUTING.md](CONTRIBUTING.md)** +Fork [eigger/hassble-config](https://github.com/eigger/hassble-config). Peล‚na dokumentacja schematu YAML +(`source: obd`, `sensors`, `publish`, presety OBD) jest w repozytorium upstream. ---- +## Pliki -## Table of Contents +| Plik | Przeznaczenie | +|------|---------------| +| `config.yaml` | Konfiguracja bramki โ€” jedno urzฤ…dzenie `proace_city_obd` | +| `templates.yaml` | Ten sam pojazd jako szablon do **Import template** w aplikacji | +| `scripts/validate.py` | Walidator schematu (`pip install pyyaml && python scripts/validate.py`) | -1. [How It Works](#how-it-works) -2. [Quick Start](#quick-start) -3. [Root Structure](#root-structure) -4. [defaults โ€” Publish Rules](#defaults--publish-rules) -5. [Device Types](#device-types) -6. [source: advertisement โ€” BLE Passive Scan](#source-advertisement--ble-passive-scan) - - [match โ€” Matching Conditions](#match--matching-conditions) - - [instance_mode โ€” Entity Strategy](#instance_mode--entity-strategy) -7. [source: gatt_notify โ€” Active GATT Connection](#source-gatt_notify--active-gatt-connection) -8. [source: obd โ€” ELM327 OBD Polling](#source-obd--elm327-obd-polling) -9. [sensors โ€” Sensor Config](#sensors--sensor-config) - - [decode โ€” Binary Decoding](#decode--binary-decoding) - - [Data Types](#data-types) -10. [controls โ€” HA Controls](#controls--ha-controls) -11. [publish โ€” Per-Sensor Filter](#publish--per-sensor-filter) -12. [OBD Preset List](#obd-preset-list) -13. [Full Examples](#full-examples) -14. [Tips & Gotchas](#tips--gotchas) -15. [Contributing](#contributing) +Aplikacja pobiera pliki z: ---- +- `https://gitea.trzcinski.pro/czcionka/hassble-config/raw/branch/main/config.yaml` +- `https://gitea.trzcinski.pro/czcionka/hassble-config/raw/branch/main/templates.yaml` -## Repository files +Zmodyfikowana aplikacja akceptuje konfiguracjฤ™ wyล‚ฤ…cznie z `https://gitea.trzcinski.pro`. -| File | Purpose | -|------|---------| -| `config.yaml` | Active gateway configuration (devices the app runs) | -| `templates.yaml` | Device templates for **Import template** in the Sensors tab | +## Uruchomienie -The app loads both from the repo root on the selected branch (`owner/repo` + branch โ€” file names are fixed). +1. W Home Assistant zainstaluj integracjฤ™ [ws_bridge](https://github.com/eigger/hass-ws-bridge). +2. W aplikacji, zakล‚adka **Sensors**: repozytorium `czcionka/hassble-config`, gaล‚ฤ…ลบ `main`. +3. Zakล‚adka **Gateway**: adres HA i token (lub logowanie OAuth), start bramki. +4. Powiฤ…ลผ adapter OBD (MAC) w aplikacji i wล‚ฤ…cz czujniki, ktรณre ECU obsล‚uguje. -## How It Works +PID-y nieobsล‚ugiwane przez ECU odpowiadajฤ… `NO DATA` โ€” wyล‚ฤ…cz takie czujniki w aplikacji. +Jeล›li aplikacja zgล‚asza `OBD RX characteristic not found`, sprawdลบ ukล‚ad GATT adaptera w nRF Connect +i podmieล„ UUID w `config.yaml` (alternatywy sฤ… w komentarzu). -The HassBle app downloads `config.yaml` and `templates.yaml` from this repository (fixed file names at repo root), decodes BLE data according to the rules you define, and automatically declares sensors in Home Assistant via the [ws_bridge](https://github.com/eigger/hass-ws-bridge) integration. No code changes are needed โ€” just edit YAML and push. +## Bezpieczeล„stwo -Raw URLs (branch `main`): - -- Config: `https://raw.githubusercontent.com/eigger/hassble-config/main/config.yaml` -- Templates: `https://raw.githubusercontent.com/eigger/hassble-config/main/templates.yaml` - -``` -Android Phone (BLE Scan) - โ”‚ raw bytes - โ–ผ - HassBle App โ”€โ”€โ”€โ”€ config.yaml (this repo) โ”€โ”€โ”€โ”€โ–ถ decode rules - โ”‚ decoded value - โ–ผ - HA WebSocket API โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ ws_bridge - โ”‚ - โ–ผ - Home Assistant Entity (sensor / switch / number / โ€ฆ) -``` - ---- - -## Quick Start - -1. Fork or copy this repository to your GitHub account. -2. Edit `config.yaml` to describe your BLE devices. Optionally add device blocks to `templates.yaml` for **Import template** in the app. -3. In the HassBle app โ†’ **Sensors tab** โ†’ enter `your-username/hassble-config` and branch `main` (loads `config.yaml` + `templates.yaml` automatically). -4. In the **Gateway tab**, enter your HA URL and token (or use OAuth login), then start the gateway. -5. In the **Sensors tab**, enable the sensors you want and they will appear in Home Assistant. - -> โš ๏ธ **Never put HA credentials (URL / Token) in this file.** -> Enter them only in the app settings. - ---- - -## Root Structure - -```yaml -version: 1 - -defaults: - publish: - on_change_only: true - min_interval: 10s - -devices: - - id: ... -``` - -| Field | Type | Default | Description | -|-------|------|---------|-------------| -| `version` | int | `1` | Schema version. Always `1`. | -| `defaults.publish` | object | see below | Default publish filter applied to all sensors. | -| `devices` | list | `[]` | List of device configurations. | - ---- - -## defaults โ€” Publish Rules - -Controls how often and under what conditions sensor values are sent to HA. Can be overridden per-device or per-sensor. - -```yaml -defaults: - publish: - on_change_only: true # Only send when value changes (default: true) - min_interval: 10s # Minimum time between sends (default: 10s) - heartbeat: 5m # Force a send at this interval even if unchanged (optional) - deadband: 0.5 # Ignore changes smaller than this (optional, numeric sensors only) -``` - -| Field | Type | Default | Description | -|-------|------|---------|-------------| -| `on_change_only` | bool | `true` | Only send when the value changes. | -| `min_interval` | duration | `10s` | Minimum time between two sends. Formats: `500ms`, `30s`, `5m`. | -| `heartbeat` | duration | `null` | Even if unchanged, force a send at this interval. | -| `deadband` | float | `null` | Ignore changes smaller than this value (numeric sensors). | - ---- - -## Device Types - -Every entry in `devices` must have a `source` field that selects the data path. - -| `source` | Description | -|----------|-------------| -| `advertisement` | Passive BLE scan โ€” no connection, reads broadcast packets. | -| `gatt_notify` | Active GATT connection โ€” connects to the device and subscribes to notifications. Supports write commands. | -| `obd` | ELM327 OBD adapter over BLE โ€” polls PID commands and parses ISO-TP responses. | - -**Common fields shared by all device types:** - -```yaml -- id: my_device # Unique identifier (lowercase letters, digits, _) - name: "My Device" # Display name (HA device name) - source: advertisement # advertisement | gatt_notify | obd - publish: # (optional) Override publish rules for all sensors of this device - on_change_only: true - min_interval: 5s - sensors: [...] - controls: [...] # gatt_notify / obd / advertisement(action only) -``` - -| Field | Type | Required | Description | -|-------|------|----------|-------------| -| `id` | string | โœ… | Unique identifier. Used in HA entity unique_id. Use lowercase letters, digits, `_`. | -| `name` | string | โœ… | Display name shown in HA device. | -| `source` | enum | โœ… | Data source type (see above). | -| `publish` | object | โŒ | Device-level publish rule override. | -| `sensors` | list | โŒ | List of sensor definitions. | -| `controls` | list | โŒ | List of control definitions. | - ---- - -## source: advertisement โ€” BLE Passive Scan - -Listens for BLE advertisement packets without connecting. Use `match` to filter packets. - -```yaml -- id: my_sensor - name: "My BLE Sensor" - source: advertisement - instance_mode: mac # mac | shared (see below) - match: - manufacturer_id: 76 # Apple = 76 (0x004C) โ€” must use decimal - manufacturer_min_length: 24 - manufacturer_hex_prefix: "0215" - sensors: - - key: temperature - source_field: manufacturer_data # manufacturer_data | service_data | raw - decode: - offset: 18 - length: 2 - type: uint16 - endian: big - scale: 0.002670288 - offset_value: -45 -``` - -### match โ€” Matching Conditions - -All specified conditions must be satisfied simultaneously (AND logic). Unspecified fields are ignored. - -| Field | Type | Description | -|-------|------|-------------| -| `mac` | string | Fixed MAC address filter. Format: `"AA:BB:CC:DD:EE:FF"`. | -| `service_data_uuid` | string | 16-bit or 128-bit service UUID suffix. E.g. `"F51C"`, `"181A"`. | -| `manufacturer_id` | int | Manufacturer company ID. **Must use decimal** (not `0x...`). E.g. Apple=`76`. | -| `manufacturer_hex_prefix` | string | Manufacturer payload (hex string) must start with this prefix. E.g. iBeacon=`"0215"`. | -| `manufacturer_min_length` | int | Minimum byte length of the manufacturer payload. | -| `name_prefix` | string | BLE device name must start with this string. | - -> **โš ๏ธ Hex literals warning** -> The YAML parser (`kaml`) may silently fail with `0x...` hex values. Always use **decimal integers**. -> `0x004C` โ†’ `76`, `0x035D` โ†’ `861` - -### instance_mode โ€” Entity Strategy - -Determines how HA entities are created when multiple devices of the same type are detected. - -| Value | Description | -|-------|-------------| -| `mac` (default) | Each unique MAC address creates its own set of HA entities. Entity unique_id: `{device_id}_{MAC}_temperature` etc. Bind a specific MAC in the app's Sensors tab to pre-declare entities before the device is seen. | -| `shared` | All matching advertisers share a single HA entity. The last received packet overwrites the state. Useful for parking beacons, clickers, etc. | - ---- - -## source: gatt_notify โ€” Active GATT Connection - -Connects to a specific BLE device, subscribes to a GATT characteristic, and receives notifications. Optionally sends hex commands back. - -```yaml -- id: custom_meter - name: "Custom BLE Meter" - source: gatt_notify - gatt: - mac: "AA:BB:CC:DD:EE:FF" # Or bind in the app's Sensors tab - service_uuid: "ffe0" - notify_char_uuid: "ffe1" - write_char_uuid: "ffe2" # Optional โ€” required for controls - auto_connect: true - sensors: - - key: power - unit: "W" - device_class: power - state_class: measurement - decode: { offset: 0, length: 2, type: uint16, endian: little } - controls: - - key: relay - type: switch - command: { on: "A10100", off: "A10000" } -``` - -| Field | Type | Required | Description | -|-------|------|----------|-------------| -| `mac` | string | โŒ | Device MAC address. Can also be set via app bind. | -| `service_uuid` | string | โœ… | GATT service UUID (16-bit or full 128-bit). | -| `notify_char_uuid` | string | โœ… | Characteristic to subscribe for notifications. | -| `write_char_uuid` | string | โŒ | Characteristic to write commands to (needed for controls). | -| `auto_connect` | bool | โŒ | Automatically reconnect on disconnect. Default `true`. | - -> If `mac` is not set in the YAML, bind the device in the app's **Sensors tab** (tap "Connect / Bind" next to the device). - ---- - -## source: obd โ€” ELM327 OBD Polling - -Connects to an ELM327 BLE adapter, sends OBD-II (and GM mode 22) PID commands, and parses ISO-TP responses. Use built-in `preset`s or define custom `mode`/`pid`/`formula`. - -```yaml -- id: car_obd - name: "Vehicle OBD" - source: obd - obd: - # mac: "AA:BB:CC:DD:EE:FF" # Or bind in the app - service_uuid: "18F0" - tx_char_uuid: "2AF1" - rx_char_uuid: "2AF0" - tx_delay: 50ms - init_commands: - - "ATZ" - - "ATE0" - - "ATL0" - - "ATS0" - - "ATH0" - - "ATSP6" # Protocol: ATSP0=auto, ATSP6=ISO 15765-4 CAN 500kbps - sensors: - # Using preset (recommended) - - { key: rpm, preset: rpm, update_interval: 1s } - - { key: speed, preset: speed, update_interval: 1s } - # Custom definition - - key: custom_pid - mode: "01" - pid: "0C" - formula: "(a*256+b)/4" - unit: "rpm" - state_class: measurement - update_interval: 1s -``` - -| Field | Type | Default | Description | -|-------|------|---------|-| -| `mac` | string | โ€” | Adapter MAC. Set here or via app bind. | -| `service_uuid` | string | `"FFF0"` | BLE GATT service UUID. | -| `tx_char_uuid` | string | `"FFF2"` | Write characteristic (send commands). | -| `rx_char_uuid` | string | `"FFF1"` | Notify characteristic (receive responses). | -| `tx_delay` | duration | `50ms` | Delay between consecutive commands. | -| `init_commands` | list | `[]` | Commands sent once on each connection before polling starts. | -| `default_commands` | list | auto | Commands sent before polling any sensor that has no `pre_commands`. Usually omit it โ€” see "Header restore" below. | -| `auto_connect` | bool | `true` | Automatically reconnect on disconnect. | - -**OBD sensor-specific fields:** - -| Field | Type | Description | -|-------|------|-------------| -| `preset` | string | Use a built-in preset (see table below). | -| `mode` | string | OBD mode. `"01"` = standard, `"22"` = manufacturer specific. Default `"01"`. | -| `pid` | string | PID hex code (without mode prefix). E.g. `"0C"`, `"199A"`. | -| `formula` | string | Math expression. Variables `a`โ€“`t` are response bytes 0โ€“19. E.g. `"(a*256+b)/4"`. If the response is too short to bind a byte used in the expression, nothing is published for that poll. | -| `decode` | map | Extract the value by byte offset instead of `formula`. Use it to reach bytes past the 20th (see below). | -| `update_interval` | duration | How often to poll this PID. Default `60s`. | -| `pre_commands` | list | Extra AT/OBD commands to send before this PID (e.g., header switch for GM). | - -### Reaching values in long responses (decode) - -`formula` variables only address the **first 20 bytes** of a response (`a`โ€“`t`). Anything -further in is read with `decode`, which takes the same fields as the [decode section](#decode--byte-decoding). - -```yaml -# Odometer in the Hyundai 21 03 block โ€” bytes 57-60, 32-bit, /1000 = km -- key: odometer - mode: "21" - pid: "03" - pre_commands: ["ATSH7E0"] - decode: { offset: 57, length: 4, type: uint32, endian: big, scale: 0.001 } - unit: "km" - device_class: distance - state_class: total_increasing -``` - -`offset` is 0-based into the data with the mode/PID echo removed, so `offset: 0` is the same -byte as `a` in a formula. If the response is too short for `offset + length`, nothing is -published for that poll, so an unsupported car never reports a bogus value. - -`decode` wins if a sensor sets both `decode` and `formula`. - -### Header restore (ATSH) - -An ELM327 transmit header **stays in effect once set**. So a sensor with -`pre_commands: ["ATSH7C6"]` leaves the header pointing at the cluster, and the next standard -sensor (rpm, speed, โ€ฆ) that has no `pre_commands` gets sent there too โ€” returning `NO DATA`. - -The app handles this automatically. **If any sensor uses `ATSH` in `pre_commands`**, a restore -command is inserted before every sensor that has no `pre_commands`. The header to restore is -chosen in this order: - -1. `default_commands`, if you set it -2. the last `ATSHโ€ฆ` in `init_commands` -3. `ATSH7DF` โ€” the ELM327 default header for 11-bit CAN - -If no sensor uses `ATSH`, nothing is sent. This avoids pushing `ATSH7DF` onto protocols with a -different header format, such as K-line (ISO 9141 / KWP). - -So you can normally **omit `default_commands`**; set it only to pin a specific restore header: - -```yaml -obd: - init_commands: ["ATSP6"] - default_commands: ["ATSH7E0"] # address the engine ECU instead of broadcasting to 7DF -``` - ---- - -## sensors โ€” Sensor Config - -Each item in the `sensors` list defines one HA entity. - -```yaml -sensors: - - key: temperature # Required โ€” unique key within the device - platform: sensor # sensor | binary_sensor | text_sensor | event - device_class: temperature # HA device_class (optional) - unit: "ยฐC" - state_class: measurement # measurement | total | total_increasing - icon: "mdi:thermometer" - entity_category: diagnostic # diagnostic | config (omit for normal sensor) - accuracy_decimals: 2 - source_field: manufacturer_data # advertisement only - min_length: 24 - decode: - offset: 18 - length: 2 - type: uint16 - endian: big - scale: 0.002670288 - offset_value: -45 - publish: # Override publish rule for this sensor only - deadband: 0.1 - min_interval: 30s -``` - -| Field | Type | Required | Description | -|-------|------|----------|-------------| -| `key` | string | โœ… | Unique key within the device. Becomes part of HA entity unique_id. | -| `platform` | string | โŒ | HA entity platform. Default `sensor`. | -| `device_class` | string | โŒ | HA device class (temperature, humidity, battery, voltage, โ€ฆ). | -| `unit` | string | โŒ | Unit of measurement shown in HA. | -| `state_class` | string | โŒ | HA state class for statistics. | -| `icon` | string | โŒ | MDI icon string, e.g. `"mdi:thermometer"`. | -| `entity_category` | string | โŒ | `diagnostic` or `config`. Omit for normal sensor. | -| `accuracy_decimals` | int | โŒ | Round the decoded value to N decimal places. | -| `source_field` | enum | โŒ | `manufacturer_data` / `service_data` / `raw`. Default `raw`. | -| `min_length` | int | โŒ | Skip this sensor if the payload is shorter than N bytes. | -| `decode` | object | โŒ | Binary decoding rules. See below. | -| `publish` | object | โŒ | Override publish rule for this sensor only. | - -### decode โ€” Binary Decoding - -Extracts a numeric or string value from a raw byte array. - -**Formula:** `final_value = (raw_integer * scale) + offset_value` - -```yaml -decode: - offset: 18 # Byte offset (0-based) - length: 2 # Number of bytes to read - type: uint16 # Data type (see table below) - endian: big # big | little - bitmask: 0x0F # (optional) Apply AND bitmask before decoding - scale: 0.1 # (optional) Multiply factor. Default 1.0 - offset_value: -40 # (optional) Add after scaling. Default 0.0 - map: # (optional) Map integer result to string - "0": "off" - "1": "on" - "2": "standby" -``` - -| Field | Type | Default | Description | -|-------|------|---------|-| -| `offset` | int | `0` | Start byte index (0-based). | -| `length` | int | `1` | Number of bytes to read. | -| `type` | enum | `uint8` | Data type to interpret the bytes as. | -| `endian` | enum | `big` | Byte order. `big` = MSB first, `little` = LSB first. | -| `bitmask` | int | `null` | Apply AND bitmask to the raw integer before scaling. | -| `scale` | float | `1.0` | Multiply the raw integer by this value. | -| `offset_value` | float | `0.0` | Add this after scaling: `(raw * scale) + offset_value`. | -| `map` | object | `{}` | Map integer result to a string. Keys must be quoted strings. | - -### Data Types - -| Type | Bytes | Description | -|------|-------|-------------| -| `uint8` | 1 | Unsigned 8-bit integer (0โ€“255). | -| `int8` | 1 | Signed 8-bit integer (-128โ€“127). | -| `uint16` | 2 | Unsigned 16-bit integer (0โ€“65535). | -| `int16` | 2 | Signed 16-bit integer (-32768โ€“32767). | -| `uint32` | 4 | Unsigned 32-bit integer. | -| `int32` | 4 | Signed 32-bit integer. | -| `float32` | 4 | IEEE 754 single-precision float. | -| `timestamp` | 4 | Bytes interpreted as month/day/hour/minute (1 byte each). Returned as ISO 8601 string. | -| `string` | N | Bytes decoded as ASCII. Use with `platform: text_sensor`. | - ---- - -## controls โ€” HA Controls - -Define Home Assistant entities that send BLE write commands when triggered from HA. Only available for `gatt_notify` and `obd` sources. - -```yaml -controls: - # Switch โ€” on/off hex command - - key: relay - type: switch - name: "Main Relay" - icon: "mdi:electric-switch" - entity_category: config - command: - on: "A10100" - off: "A10000" - - # Number โ€” insert value into hex template - - key: brightness - type: number - min: 0 - max: 100 - step: 1 - command: - template: "B2{value:02X}FF" - - # Select โ€” per-option hex command - - key: mode - type: select - options: ["auto", "cool", "heat", "fan"] - command: - auto: "C000" - cool: "C001" - heat: "C002" - fan: "C003" - - # Button โ€” sends hex on press - - key: restart - type: button - command: - press: "FFFE" -``` - -| Field | Type | Required | Description | -|-------|------|----------|-------------| -| `key` | string | โœ… | Unique key within the device. | -| `type` | enum | โœ… | `switch` / `number` / `select` / `button`. | -| `name` | string | โŒ | Display name in HA. Auto-generated from key if omitted. | -| `icon` | string | โŒ | MDI icon string. | -| `entity_category` | string | โŒ | `config` or `diagnostic`. | -| `command` | object | โŒ* | Command map. Keys depend on type (see examples above). Required when `action` is omitted. | -| `action` | enum | โŒ* | Internal app action trigger (`advertise` \| `stop_advertise`). Omit `command` when `action` is specified. | -| `options` | list | select only | Options list for `select` type. | -| `min` | float | number only | Minimum value for `number` type. | -| `max` | float | number only | Maximum value for `number` type. | -| `step` | float | โŒ | Step size for `number` type. | - -**command template placeholders:** - -| Placeholder | Description | -|-------------|-------------| -| `{value}` | Integer value (decimal). | -| `{value:02X}` | Value as 2-digit uppercase hex (zero-padded). | -| `{value:04X}` | Value as 4-digit uppercase hex. | - ---- - -## publish โ€” Per-Sensor Filter - -Override the global `defaults.publish` for a specific sensor. Useful for sensors that change slowly (fuel level) or need frequent updates (RPM). - -```yaml -sensors: - - key: fuel_level - preset: fuel_level - update_interval: 30s - publish: - on_change_only: true - deadband: 0.5 - min_interval: 60s - heartbeat: 30m -``` - -**Priority:** sensor `publish` > device `publish` > `defaults.publish` - ---- - -## OBD Preset List - -Use `preset: ` in OBD sensors to use these built-in definitions. You can override individual fields (`unit`, `accuracy_decimals`, etc.) after specifying the preset. - -### Standard OBD-II (mode 01) - -| Preset | PID | Formula | Unit | Description | -|--------|-----|---------|------|-------------| -| `rpm` | `0C` | `(a*256+b)/4` | rpm | Engine RPM | -| `speed` | `0D` | `a` | km/h | Vehicle speed | -| `engine_load` | `04` | `a/2.55` | % | Engine load | -| `throttle` | `11` | `a/2.55` | % | Throttle position | -| `coolant_temp` | `05` | `a-40` | ยฐC | Coolant temperature | -| `intake_air_temp` | `0F` | `a-40` | ยฐC | Intake air temperature | -| `ambient_temp` | `46` | `a-40` | ยฐC | Ambient temperature | -| `battery_voltage` | `42` | `(a*256+b)/1000` | V | Battery voltage | -| `run_time` | `1F` | `a*256+b` | s | Engine run time | -| `fuel_level` | `2F` | `a/2.55` | % | Fuel level | -| `actual_torque` | `62` | `a-125` | % | Actual torque | -| `odometer` | `A6` | `(a*16777216+b*65536+c*256+d)/10` | km | Odometer | - -### GM Extensions (mode 22) - -| Preset | PID | Formula | Unit | Description | -|--------|-----|---------|------|-------------| -| `gm_current_gear` | `199A` | `a` | โ€” | Current gear | -| `gm_prnd_status_alt` | `2889` | `a` | โ€” | PRND status | -| `gm_oil_pressure` | `115C` | `(a*0.65)-17.5` | psi | Oil pressure | -| `gm_trans_temp` | `1940` | `a-40` | ยฐC | Transmission temperature | -| `gm_fuel_level_liters` | `132A` | `(a*256+b)/64` | L | Fuel level (liters) | - ---- - -## Full Examples - -### Example 1 โ€” Jaalee JHT (iBeacon Temperature/Humidity) - -```yaml -- id: jaalee_jht - name: "Jaalee JHT" - source: advertisement - instance_mode: mac - match: - manufacturer_id: 76 # Apple Inc. (must be decimal) - manufacturer_min_length: 24 - manufacturer_hex_prefix: "0215" # iBeacon type marker - sensors: - - key: temperature - device_class: temperature - unit: "ยฐC" - state_class: measurement - accuracy_decimals: 2 - source_field: manufacturer_data - decode: { offset: 18, length: 2, type: uint16, endian: big, scale: 0.002670288, offset_value: -45 } - - key: humidity - device_class: humidity - unit: "%" - state_class: measurement - accuracy_decimals: 2 - source_field: manufacturer_data - decode: { offset: 20, length: 2, type: uint16, endian: big, scale: 0.001524504 } - - key: battery - device_class: battery - unit: "%" - state_class: measurement - source_field: manufacturer_data - decode: { offset: 23, length: 1, type: uint8 } -``` - -### Example 2 โ€” Custom Service Data Sensor - -```yaml -- id: my_env_sensor - name: "Environment Sensor" - source: advertisement - instance_mode: shared - match: - service_data_uuid: "181A" # Environmental Sensing UUID - sensors: - - key: temperature - device_class: temperature - unit: "ยฐC" - state_class: measurement - accuracy_decimals: 1 - source_field: service_data - decode: { offset: 0, length: 2, type: int16, endian: little, scale: 0.01 } - - key: humidity - device_class: humidity - unit: "%" - state_class: measurement - accuracy_decimals: 1 - source_field: service_data - decode: { offset: 2, length: 2, type: uint16, endian: little, scale: 0.01 } - - key: battery - device_class: battery - unit: "%" - source_field: service_data - decode: { offset: 9, length: 1, type: uint8 } -``` - -### Example 3 โ€” GATT Sensor with Switch Control - -```yaml -- id: power_monitor - name: "Power Monitor" - source: gatt_notify - gatt: - service_uuid: "ffe0" - notify_char_uuid: "ffe1" - write_char_uuid: "ffe2" - sensors: - - key: power - device_class: power - unit: "W" - state_class: measurement - decode: { offset: 0, length: 2, type: uint16, endian: little } - - key: voltage - device_class: voltage - unit: "V" - state_class: measurement - accuracy_decimals: 1 - decode: { offset: 2, length: 2, type: uint16, endian: little, scale: 0.1 } - - key: current - device_class: current - unit: "A" - state_class: measurement - accuracy_decimals: 2 - decode: { offset: 4, length: 2, type: uint16, endian: little, scale: 0.01 } - controls: - - key: relay - type: switch - name: "Relay" - icon: "mdi:electric-switch" - command: { on: "A10100", off: "A10000" } -``` - -### Example 4 โ€” OBD with Presets and Custom Publish - -```yaml -- id: car_obd - name: "Vehicle" - source: obd - obd: - service_uuid: "18F0" - tx_char_uuid: "2AF1" - rx_char_uuid: "2AF0" - tx_delay: 50ms - init_commands: ["ATZ", "ATE0", "ATL0", "ATS0", "ATH0", "ATSP6"] - sensors: - - { key: rpm, preset: rpm, update_interval: 1s } - - { key: speed, preset: speed, update_interval: 1s } - - { key: coolant_temp, preset: coolant_temp, update_interval: 10s } - - key: fuel_level - preset: fuel_level - update_interval: 30s - publish: - deadband: 1.0 - min_interval: 60s - heartbeat: 10m -``` - -### Example 5 โ€” Value Map (Status Codes) - -```yaml -- id: status_device - name: "Status Device" - source: advertisement - instance_mode: shared - match: - manufacturer_id: 1234 - sensors: - - key: mode - platform: text_sensor - source_field: manufacturer_data - decode: - offset: 5 - length: 1 - type: uint8 - map: - "0": "idle" - "1": "running" - "2": "error" - "3": "standby" -``` - ---- - -## Tips & Gotchas - -### โš ๏ธ Always use decimal for manufacturer_id - -The YAML parser (`kaml`) may silently parse `0x004C` as `0` or cause a crash. Always convert hex to decimal: - -```yaml -# โŒ Wrong โ€” may cause parse errors -manufacturer_id: 0x004C - -# โœ… Correct -manufacturer_id: 76 # 0x004C = 76 -manufacturer_id: 861 # 0x035D = 861 -``` - -### AND logic in match - -All `match` conditions are ANDed together. If you specify both `service_data_uuid` and `manufacturer_id`, the packet must satisfy **both**. Remove a condition if your device doesn't always advertise it. - -### instance_mode: mac โ€” Bind for early entity creation - -With `instance_mode: mac` and no fixed `match.mac`, HA entities only appear after the device is detected by BLE scan. To make entities appear immediately on gateway connect, bind the MAC in the app's **Sensors tab** โ†’ "Connect / Bind". - -### source_field selection - -For advertisement sensors, choose the right payload source: -- `manufacturer_data` โ€” data after the manufacturer company ID (most common for custom sensors) -- `service_data` โ€” data in the service data AD type (common for standard profiles like 0x181A) -- `raw` โ€” full scan record bytes (rarely needed) - -### Duration format - -Durations support milliseconds (`ms`), seconds (`s`), and minutes (`m`). - -```yaml -tx_delay: 50ms -min_interval: 10s -heartbeat: 5m -update_interval: 1s -``` - -### Config is cached - -The app caches the last successfully loaded config. If the network is unavailable on startup, it uses the cache. The app always shows "Using cached config" in the header when this happens. - ---- - -## Contributing - -We welcome your vehicle OBD-II PID configurations! Please refer to [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines on how to contribute. - ---- - -## License - -MIT +- Nie umieszczaj w tym repozytorium adresu ani tokenu Home Assistant. +- Nie commituj adresu MAC adaptera โ€” powiฤ…ลผ go w aplikacji. +- Kaลผda zmiana tego repozytorium trafia do telefonu przy nastฤ™pnym przeล‚adowaniu konfiguracji. + Chroล„ gaล‚ฤ…ลบ `main` (protected branch) i ogranicz prawa zapisu. diff --git a/config.yaml b/config.yaml index ea1041e..fd4697f 100644 --- a/config.yaml +++ b/config.yaml @@ -1,8 +1,8 @@ -# HassBle Configuration File +# HassBle configuration โ€” Toyota Proace City (PSA K9 platform, 2019+) +# Adapter: Vgate iCar Pro ELM327 V2.3, Bluetooth 4.0 (BLE) variant # -# Host config.yaml and templates.yaml in a Git repository (e.g., GitHub). -# In the HassBle app: enter owner/repo and branch (e.g. eigger/hassble-config, main). -# The app loads config.yaml for the gateway and templates.yaml for Import template. +# Served from https://gitea.trzcinski.pro/czcionka/hassble-config (branch main). +# The app accepts config only from gitea.trzcinski.pro over HTTPS. # # Do NOT put any Home Assistant credentials (URL/Token) in this file. Enter them in the app. @@ -14,250 +14,84 @@ defaults: min_interval: 10s devices: - # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - # Path A: BLE Passive Scanning (Advertisements) - # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - # Jaalee JHT โ€” instance_mode: mac โ†’ ์Šค์บ”๋œ MAC๋งˆ๋‹ค jaalee_jht_{MAC} ์—”ํ‹ฐํ‹ฐ ์ž๋™ ์ƒ์„ฑ - # Ref: https://github.com/eigger/espcomponents/tree/master/components/jaalee_jht - # Temp/Humidity formula: https://sensor.jaalee.com/scan_api.html - #- id: jaalee_jht - # name: "Jaalee JHT" - # source: advertisement - # instance_mode: mac - # match: - # manufacturer_id: 76 # Apple Inc. (0x004C) โ€” decimal ์‚ฌ์šฉ ํ•„์ˆ˜ (hex 0x... ํŒŒ์‹ฑ ๋ถˆ์•ˆ์ •) - # manufacturer_min_length: 24 - # manufacturer_hex_prefix: "0215" # iBeacon ํƒ€์ž… ๋งˆ์ปค (0x02=subtype, 0x15=length 21) - # sensors: - # - key: temperature - # device_class: temperature - # unit: "ยฐC" - # state_class: measurement - # accuracy_decimals: 2 - # source_field: manufacturer_data - # decode: { offset: 18, length: 2, type: uint16, endian: big, scale: 0.002670288, offset_value: -45 } - # - key: humidity - # device_class: humidity - # unit: "%" - # state_class: measurement - # accuracy_decimals: 2 - # source_field: manufacturer_data - # decode: { offset: 20, length: 2, type: uint16, endian: big, scale: 0.001524504 } - # - key: battery - # device_class: battery - # unit: "%" - # state_class: measurement - # source_field: manufacturer_data - # decode: { offset: 23, length: 1, type: uint8 } - - # ์ง€ํ•˜์ฃผ์ฐจ์žฅ ์œ„์น˜ ์š”์ฒญ ๋น„์ฝ˜ (BLE ๊ด‘๊ณ  ์†ก์‹  ๋ฐ ์ˆ˜์‹  ์˜ˆ์ œ) - # UUID๋Š” ๋ณธ์ธ์˜ ํŒจํ‚ท ์บก์ฒ˜์—์„œ ์ถ”์ถœํ•œ ๊ณ ์œ ๊ฐ’์œผ๋กœ ๊ต์ฒดํ•˜์„ธ์š”. - #- id: mytown_parking - # name: "๋งˆ์ดํƒ€์šด ์ฃผ์ฐจ์œ„์น˜" - # source: advertisement - # instance_mode: shared # ๊ธฐ๋‘ฅ MAC์ด ๋งค๋ฒˆ ๋‹ฌ๋ผ๋„ ์—”ํ‹ฐํ‹ฐ 1๋ฒŒ ์œ ์ง€ - # match: - # manufacturer_id: 861 # 0x035D โ€” kaml ํŒŒ์‹ฑ์„ ์œ„ํ•ด 10์ง„์ˆ˜(decimal) ์‚ฌ์šฉ ๊ถŒ์žฅ - # manufacturer_hex_prefix: "06" # 06 ์‘๋‹ต ํฌ๋งท (๋ณธ์ธ 16B UUID ์ ‘๋‘์‚ฌ) - # manufacturer_min_length: 18 - # advertise: - # manufacturer_id: 861 - # payload: "05<๋ณธ์ธ_16BYTE_UUID_HEX>40{counter:02X}" - # counter_mode: reset # reset(๊ธฐ๋ณธ) | persist - # counter_start: 0 # reset ๋ชจ๋“œ ์‹œ์ž‘๊ฐ’ (๊ธฐ๋ณธ 0) - # mode: balanced # low_power | balanced | low_latency - # tx_power: high # ultra_low | low | medium | high - # timeout: 15s # ์ด ์‹œ๊ฐ„ ์ง€๋‚˜๋ฉด ์ž๋™ ์†ก์‹  ์ค‘๋‹จ - # repeat_interval: 1s # (์„ ํƒ) ์ด ์ฃผ๊ธฐ๋กœ payload ๊ฐฑ์‹  = counter ์ฆ๊ฐ€ - # stop_on_response: true # 06 ์‘๋‹ต ์ˆ˜์‹  ์‹œ ์ฆ‰์‹œ ์†ก์‹  ์ค‘๋‹จ - # controls: - # - key: request_location - # type: button - # name: "์ฃผ์ฐจ์œ„์น˜ ์š”์ฒญ" - # action: advertise # command ๋Œ€์‹  ์•ฑ ๋‚ด๋ถ€ ๊ด‘๊ณ  ์†ก์‹  ๋™์ž‘ ์‹คํ–‰ - # icon: mdi:car-search - # sensors: - # - key: parking_floor - # platform: text_sensor - # icon: mdi:layers-outline - # source_field: manufacturer_data - # decode: - # offset: 17 - # length: 1 - # type: uint8 - # map: - # "251": "B5" - # "252": "B4" - # "253": "B3" - # "254": "B2" - # "255": "B1" - # "0": "LB" - # "1": "1F" - # "2": "2F" - # "3": "3F" - # - key: parking_location - # platform: text_sensor - # icon: mdi:map-marker-outline - # source_field: manufacturer_data - # decode: { offset: 18, length: 0, type: string } - - # Parking beacon โ€” instance_mode: shared โ†’ MAC ๋ฌด๊ด€, manufacturer 0x035D ๊ด‘๊ณ ๊ฐ€ ํ•˜๋‚˜์˜ ์—”ํ‹ฐํ‹ฐ ๊ณต์œ  - # ์š”์ฒญ 6๋ฐ”์ดํŠธ: [0]=02 [1]=05 [2]=00 [3]=battery [4]=state [5]=counter - # ์‘๋‹ต 14๋ฐ”์ดํŠธ: [0]=04(์‘๋‹ตํƒ€์ž…), [1..6]=KeyMAC, [7..10]=์›”ยท์ผยท์‹œยท๋ถ„, [11]=์ธต(256-raw), [12..13]=๊ตฌ์—ญ์ฝ”๋“œ - # 04xx: ์ฃผ์ฐจ์œ„์น˜ ์‘๋‹ต ๋น„์ฝ˜, 07xx: SmartKey ์ธ์ฆ(22B ์•”ํ˜ธํ™”), 02xx: ์ถœ์ž… ์ด๋ฒคํŠธ(6B) โ€” prefix "04" ๋กœ ์‘๋‹ต๋งŒ ๋งค์นญ - - id: parking_beacon - name: "Parking Beacon" - source: advertisement - instance_mode: shared - match: - manufacturer_id: 861 # 0x035D - manufacturer_hex_prefix: "04" # ์‘๋‹ต ๋น„์ฝ˜๋งŒ ๋งค์นญ (07=SmartKey ์ธ์ฆ, 02=์ถœ์ž… ์ด๋ฒคํŠธ ์ œ์™ธ) - manufacturer_min_length: 14 # ์ตœ์†Œ 14๋ฐ”์ดํŠธ - #advertise: - # manufacturer_id: 861 # 0x035D - # # 02 05 00 | battery 100% | {state} | {counter} โ€” ์นด์šดํ„ฐ๋Š” ๋ฒ„ํŠผ๋งˆ๋‹ค +1, ๋ฒ„์ŠคํŠธ ์ค‘ ๊ณ ์ • - # payload: "02050064{state:02X}{counter:02X}" - # counter_mode: persist # ์š”์ฒญ๋งˆ๋‹ค ๋ˆ„์ . 0xFF ๋‹ค์Œ์€ 0 - # counter_start: 0 - # mode: low_latency # ~100ms โ†’ press 200ms ๋™์•ˆ ์•ฝ 1~2ํŒจํ‚ท - # tx_power: high - # timeout: 4s # ํŽ˜์ด์ฆˆ ํ•ฉ(3.2s)๋ณด๋‹ค ์•ฝ๊ฐ„ ํฐ ์ƒํ•œ - # local_name: "APT SmartKey" # Complete Local Name. ์†ก์‹  ์ค‘ ์ด ์ด๋ฆ„์œผ๋กœ ๋ฐ”๊พธ๊ณ , ์ข…๋ฃŒยท์žฌ์‹œ์ž‘ ๋•Œ ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ๋˜๋Œ๋ฆผ - # payload_phases: - # - state: 65 # 0x41 ๋ฒ„ํŠผ ๋ˆ„๋ฆ„ + ACK ๋Œ€๊ธฐ - # duration: 200ms - # - state: 64 # 0x40 ํ™€๋“œ + ACK ๋Œ€๊ธฐ - # duration: 3s - # stop_on_response: true - #controls: - # - key: request_location - # type: button - # name: "์ฃผ์ฐจ์œ„์น˜ ์š”์ฒญ" - # action: advertise - # icon: mdi:car-search - sensors: - - key: parking_time - device_class: timestamp - icon: mdi:clock-time-four-outline - source_field: manufacturer_data - length: 14 - decode: { offset: 7, length: 4, type: timestamp } - - key: parking_floor - icon: mdi:layers-outline - source_field: manufacturer_data - length: 14 - accuracy_decimals: 0 - decode: { offset: 11, length: 1, type: uint8, scale: -1, offset_value: 256 } - - key: parking_location - platform: text_sensor - icon: mdi:map-marker-outline - source_field: manufacturer_data - length: 14 - decode: { offset: 12, length: 2, type: string } - - # APT SmartKey ์ถœ์ž…๋ฌธ ์ด๋ฒคํŠธ โ€” ๊ณ ์ • MAC์œผ๋กœ ํ•˜๋“œ์›จ์–ด ํ•„ํ„ฐ, 02xx 6๋ฐ”์ดํŠธ ํŒจํ‚ท๋งŒ ํŒŒ์‹ฑ - # payload 6๋ฐ”์ดํŠธ: [0]=02(์ด๋ฒคํŠธํƒ€์ž…), [1..3]=05 00 55, [4]=์ƒํƒœ, [5]=์นด์šดํ„ฐ - # byte[4] ์ƒํƒœ๊ฐ’: 0x41(65)=entering_start, 0x01(1)=entering, 0x40(64)=exiting, 0x00(0)=idle - # 0x41โ†’0x01 ๋‘ ๊ฐ’ ๋ชจ๋‘ "entering"์œผ๋กœ ๋งคํ•‘ โ†’ on_change_only๊ฐ€ ์ค‘๊ฐ„ ์ „ํ™˜ ๋…ธ์ด์ฆˆ ์ œ๊ฑฐ - - id: apt_key_door - name: "APT Door Event" - source: advertisement - instance_mode: shared - match: - manufacturer_id: 861 # 0x035D - manufacturer_hex_prefix: "02" # ์ถœ์ž… ์ด๋ฒคํŠธ ํƒ€์ž…๋งŒ (07xx=์ธ์ฆ 22B, 04xx=์ฃผ์ฐจ์‘๋‹ต 14B ์ œ์™ธ) - sensors: - - key: door_status - platform: text_sensor - icon: mdi:door - source_field: manufacturer_data - length: 6 - publish: - min_interval: 1s # ๊ธฐ๋ณธ 10s ์˜ค๋ฒ„๋ผ์ด๋“œ โ€” ์ด๋ฒคํŠธ๊ฐ€ ์ˆ˜ ์ดˆ ๋‚ด ์ „ํ™˜๋จ - decode: - offset: 4 - length: 1 - type: uint8 - map: - "65": "entering" # 0x41 ์ธ์ฆ ์‹œ์ž‘ - "1": "entered" # 0x01 ์ธ์ฆ ์™„๋ฃŒ (entering๊ณผ ๋™์ผ โ†’ ์ „ํ™˜ ๋…ธ์ด์ฆˆ ์ œ๊ฑฐ) - "64": "exiting" # 0x40 - "0": "idle" # 0x00 - # ํ†ต๊ณผ "์‹œ๊ฐ"์„ ๋‚จ๊ธฐ๋Š” ์ด๋ฒคํŠธ ์—”ํ‹ฐํ‹ฐ โ€” ์ƒํƒœ๊ฐ’์ด ๋งˆ์ง€๋ง‰ ๋ฐœ์ƒ ์‹œ๊ฐ์ด๋ผ ๊ฐ™์€ event_type์ด - # ๋ฐ˜๋ณต๋ผ๋„ ๋งค๋ฒˆ ๊ฐฑ์‹ ๋˜๊ณ , HA ์žฌ์‹œ์ž‘ ๋•Œ ๋ณต์›๋˜์ง€ ์•Š์•„ ๋ฌต์€ ๊ฐ’์ด ๋˜์‚ด์•„๋‚˜์ง€ ์•Š๋Š”๋‹ค. - # door_status(ํ˜„์žฌ ์ƒํƒœ)์™€ ๋ณ‘ํ–‰: ๊ฐ™์€ ๊ด‘๊ณ ์—์„œ ๋‘ ์—”ํ‹ฐํ‹ฐ๋ฅผ ๋ฝ‘๋Š”๋‹ค. - - key: door_event - platform: event - event_types: [entering, entered, exiting, idle] - icon: mdi:door-open - source_field: manufacturer_data - length: 6 - publish: - heartbeat: 60s # ๊ฐ™์€ event_type์ด์–ด๋„ 60์ดˆ ์ง€๋‚ฌ์œผ๋ฉด ์žฌ๋ฐœํ™” = ํ†ต๊ณผ๋งˆ๋‹ค 1ํšŒ - decode: - offset: 4 - length: 1 - type: uint8 - map: - "65": "entering" - "1": "entered" - "64": "exiting" - "0": "idle" - - # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - # Path C: OBD (ELM327) over BLE - # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - - id: car_obd - name: "Vehicle OBD" + - id: proace_city_obd + name: "Toyota Proace City" source: obd obd: - service_uuid: "18F0" - tx_char_uuid: "2AF1" - rx_char_uuid: "2AF0" + # Bind the adapter MAC in the app (Sensors tab) instead of committing it here. + # Vgate iCar Pro BLE GATT layout. If the app logs "OBD RX/TX characteristic not found", + # check the adapter with nRF Connect and try one of the common ELM327 BLE layouts: + # service FFF0, tx FFF2, rx FFF1 + # service 18F0, tx 2AF1, rx 2AF0 + service_uuid: "E7810A71-73AE-499D-8C15-FAA9AEF0C3F2" + tx_char_uuid: "BEF8D6C9-9C21-4C9E-B632-BD58C1009F9F" + rx_char_uuid: "BEF8D6C9-9C21-4C9E-B632-BD58C1009F9F" tx_delay: 50ms init_commands: - - "ATSP6" + - "ATSP6" # ISO 15765-4 CAN 11-bit 500 kbps; use ATSP0 (auto) if the ECU does not answer sensors: - #- { key: rpm, preset: rpm, update_interval: 1s } - #- { key: speed, preset: speed, update_interval: 1s } - #- { key: engine_load, preset: engine_load, update_interval: 1s } - #- { key: throttle, preset: throttle, update_interval: 1s } - #- { key: coolant_temp, preset: coolant_temp, update_interval: 10s } - #- { key: intake_temp, preset: intake_air_temp, update_interval: 10s } - #- { key: ambient_temp, preset: ambient_temp, update_interval: 30s } - - { key: battery, preset: battery_voltage, update_interval: 10s } - - { key: run_time, preset: run_time, update_interval: 5s } - - { key: odometer, preset: odometer, update_interval: 30s } + # Standard SAE J1979 mode 01 PIDs. A PID the ECU does not support answers NO DATA โ€” + # disable such sensors in the app. + - { key: rpm, preset: rpm, update_interval: 2s } + - { key: speed, preset: speed, update_interval: 2s } + - { key: engine_load, preset: engine_load, update_interval: 5s } + - { key: coolant_temp, preset: coolant_temp, update_interval: 30s } + - { key: intake_temp, preset: intake_air_temp, update_interval: 30s } + - { key: ambient_temp, preset: ambient_temp, update_interval: 60s } + - { key: battery, preset: battery_voltage, update_interval: 10s } + - { key: run_time, preset: run_time, update_interval: 10s } - key: fuel_level preset: fuel_level update_interval: 30s publish: deadband: 0.5 min_interval: 60s - # GM Extensions (mode 22) - #- { key: gear, preset: gm_current_gear, update_interval: 1s } - #- { key: prnd, preset: gm_prnd_status_alt, update_interval: 1s } - #- { key: torque, preset: actual_torque, update_interval: 1s } - #- { key: oil_pressure, preset: gm_oil_pressure, update_interval: 2s } - #- { key: trans_temp, preset: gm_trans_temp, update_interval: 10s } - - # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - # Path B: GATT Notify & Write (Bi-directional Control) - # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - #- id: custom_meter - # name: "Custom BLE Meter" - # source: gatt_notify - # gatt: - # service_uuid: "ffe0" - # notify_char_uuid: "ffe1" - # write_char_uuid: "ffe2" - # sensors: - # - key: power - # unit: "W" - # device_class: power - # state_class: measurement - # decode: { offset: 0, length: 2, type: uint16, endian: little } - # controls: - # - key: relay - # type: switch - # command: { on: "A10100", off: "A10000" } + # PID A6 is mandatory only on newer (Euro 6d) ECUs. + - { key: odometer, preset: odometer, update_interval: 60s } + - key: intake_map + mode: "01" + pid: "0B" + formula: "a" + unit: "kPa" + device_class: pressure + state_class: measurement + accuracy_decimals: 0 + update_interval: 5s + - key: barometric_pressure + mode: "01" + pid: "33" + formula: "a" + unit: "kPa" + device_class: pressure + state_class: measurement + accuracy_decimals: 0 + update_interval: 120s + # Diesel (1.5 BlueHDi) common-rail pressure; petrol engines answer NO DATA. + - key: fuel_rail_pressure + mode: "01" + pid: "23" + formula: "(a*256+b)*10" + unit: "kPa" + device_class: pressure + state_class: measurement + accuracy_decimals: 0 + update_interval: 5s + - key: distance_since_dtc_clear + mode: "01" + pid: "31" + formula: "a*256+b" + unit: "km" + device_class: distance + state_class: total_increasing + accuracy_decimals: 0 + update_interval: 300s + - key: distance_with_mil_on + mode: "01" + pid: "21" + formula: "a*256+b" + unit: "km" + device_class: distance + state_class: measurement + accuracy_decimals: 0 + icon: mdi:engine-off + update_interval: 300s diff --git a/templates.yaml b/templates.yaml index c881337..45008e1 100644 --- a/templates.yaml +++ b/templates.yaml @@ -2,472 +2,97 @@ # Loaded from repo root as templates.yaml (same branch as config.yaml) templates: - - id: jaalee_jht - name: "Jaalee JHT" - description: "Temperature / humidity / battery (iBeacon, Apple manufacturer 76)" - device: - id: jaalee_jht - name: "Jaalee JHT" - source: advertisement - instance_mode: mac - match: - manufacturer_id: 76 - manufacturer_min_length: 24 - manufacturer_hex_prefix: "0215" - sensors: - - key: temperature - device_class: temperature - unit: "ยฐC" - state_class: measurement - accuracy_decimals: 2 - source_field: manufacturer_data - decode: { offset: 18, length: 2, type: uint16, endian: big, scale: 0.002670288, offset_value: -45 } - - key: humidity - device_class: humidity - unit: "%" - state_class: measurement - accuracy_decimals: 2 - source_field: manufacturer_data - decode: { offset: 20, length: 2, type: uint16, endian: big, scale: 0.001524504 } - - key: battery - device_class: battery - unit: "%" - state_class: measurement - source_field: manufacturer_data - decode: { offset: 23, length: 1, type: uint8 } - - - id: parking_beacon - name: "Parking Beacon" - description: "๊ณต์šฉ ์ฃผ์ฐจ ์œ„์น˜ ๋น„์ฝ˜ (์ œ์กฐ์‚ฌ 861 / 0x035D, 02 ์š”์ฒญ ๊ด‘๊ณ  ์†ก์‹  + 04 ์‘๋‹ต ์ˆ˜์‹ )" - device: - id: parking_beacon - name: "Parking Beacon" - source: advertisement - instance_mode: shared - match: - manufacturer_id: 861 # 0x035D - manufacturer_hex_prefix: "04" # 04 ์‘๋‹ต ํฌ๋งท (ํŠน์ • ์Šค๋งˆํŠธํ‚ค๋งŒ ํ•„ํ„ฐ๋ง ์‹œ 04 + 6B MAC HEX ์ž…๋ ฅ) - manufacturer_min_length: 14 # ํฌ๋งท(1B) + ์Šค๋งˆํŠธํ‚ค MAC(6B) + ์‹œ๊ฐ„(4B) + ์ธต(1B) + ๊ตฌ์—ญ(2B) = 14๋ฐ”์ดํŠธ - advertise: - manufacturer_id: 861 # 0x035D - # 02 05 00 | battery 100% | {state} | {counter} โ€” ์นด์šดํ„ฐ๋Š” ๋ฒ„ํŠผ๋งˆ๋‹ค +1, ๋ฒ„์ŠคํŠธ ์ค‘ ๊ณ ์ • - payload: "02050064{state:02X}{counter:02X}" - counter_mode: persist # ์š”์ฒญ๋งˆ๋‹ค ๋ˆ„์ . 0xFF ๋‹ค์Œ์€ 0 - counter_start: 0 - mode: low_latency # ~100ms โ†’ press 200ms ๋™์•ˆ ์•ฝ 1~2ํŒจํ‚ท - tx_power: high - timeout: 4s # ํŽ˜์ด์ฆˆ ํ•ฉ(3.2s)๋ณด๋‹ค ์•ฝ๊ฐ„ ํฐ ์ƒํ•œ - local_name: "APT SmartKey" # Complete Local Name. ์†ก์‹  ์ค‘ ์ด ์ด๋ฆ„์œผ๋กœ ๋ฐ”๊พธ๊ณ , ์ข…๋ฃŒยท์žฌ์‹œ์ž‘ ๋•Œ ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ๋˜๋Œ๋ฆผ - payload_phases: - - state: 65 # 0x41 ๋ฒ„ํŠผ ๋ˆ„๋ฆ„ + ACK ๋Œ€๊ธฐ - duration: 200ms - - state: 64 # 0x40 ํ™€๋“œ + ACK ๋Œ€๊ธฐ - duration: 3s - stop_on_response: true - controls: - - key: request_location - type: button - name: "์ฃผ์ฐจ์œ„์น˜ ์š”์ฒญ" - action: advertise - icon: mdi:car-search - sensors: - - key: parking_time - device_class: timestamp - icon: mdi:clock-time-four-outline - source_field: manufacturer_data - length: 14 - decode: { offset: 7, length: 4, type: timestamp } - - key: parking_floor - icon: mdi:layers-outline - source_field: manufacturer_data - length: 14 - accuracy_decimals: 0 - decode: { offset: 11, length: 1, type: uint8, scale: -1, offset_value: 256 } - - key: parking_location - platform: text_sensor - icon: mdi:map-marker-outline - source_field: manufacturer_data - length: 14 - decode: { offset: 12, length: 2, type: string } - - - id: mytown_parking_beacon - name: "๋งˆ์ดํƒ€์šด ์ฃผ์ฐจ ๋น„์ฝ˜ (MyTown Parking)" - description: "๋งˆ์ดํƒ€์šด ์ฃผ์ฐจ ์œ„์น˜ ๋น„์ฝ˜ (์ œ์กฐ์‚ฌ 861 / 0x035D, 05 ์š”์ฒญ ๊ด‘๊ณ  ์†ก์‹  + 06 ์‘๋‹ต ์ˆ˜์‹ )" - device: - id: mytown_parking - name: "๋งˆ์ดํƒ€์šด ์ฃผ์ฐจ์œ„์น˜" - source: advertisement - instance_mode: shared - match: - manufacturer_id: 861 # 0x035D - manufacturer_hex_prefix: "06" # 06 ์‘๋‹ต ํฌ๋งท (ํŠน์ • ์„ธ๋Œ€๋งŒ ํ•„ํ„ฐ๋ง ์‹œ 06 + 16B ์ˆ˜์‹  UUID HEX ์ž…๋ ฅ) - manufacturer_min_length: 18 # ํฌ๋งท(1B) + ์„ธ๋Œ€ UUID(16B) + ์ธต(1B) = ์ตœ์†Œ 18๋ฐ”์ดํŠธ - advertise: - manufacturer_id: 861 # 0x035D - payload: "05CB34447B91F8C69BBE41157C70BB631C40{counter:02X}" # 05 + 16B UUID + 40 + counter - counter_mode: reset # reset(๊ธฐ๋ณธ) | persist - counter_start: 0 - mode: balanced - tx_power: high - timeout: 15s - repeat_interval: 1s - stop_on_response: true - controls: - - key: request_location - type: button - name: "์ฃผ์ฐจ์œ„์น˜ ์š”์ฒญ" - action: advertise - icon: mdi:car-search - sensors: - # ์ฃผ์ฐจ ์ธต์ˆ˜: 1B uint8 (254=0xFE: B2, 255=0xFF: B1, 0=0x00: LB, 1=0x01: 1F, 2=0x02: 2F ๋“ฑ) - - key: parking_floor - platform: text_sensor - icon: mdi:layers-outline - source_field: manufacturer_data - decode: - offset: 17 - length: 1 - type: uint8 - map: - "251": "B5" - "252": "B4" - "253": "B3" - "254": "B2" - "255": "B1" - "0": "LB" - "1": "1F" - "2": "2F" - "3": "3F" - "4": "4F" - "5": "5F" - # ์ฃผ์ฐจ ๊ตฌ์—ญ: ASCII ํ…์ŠคํŠธ (์˜ˆ: 42 33 31 -> "B31", 41 2D 30 31 -> "A-01", length: 0์œผ๋กœ ๊ฐ€๋ณ€ ๊ธธ์ด ์ž๋™ ํŠธ๋ฆผ) - - key: parking_location - platform: text_sensor - icon: mdi:map-marker-outline - source_field: manufacturer_data - decode: { offset: 18, length: 0, type: string } - - - id: obd_standard - name: "OBD-II (standard PIDs)" - description: "RPM, speed, coolant, fuel โ€” bind ELM327 adapter in app" - device: - id: obd_vehicle - name: "OBD Vehicle" - source: obd - obd: - service_uuid: "FFF0" - tx_char_uuid: "FFF2" - rx_char_uuid: "FFF1" - tx_delay: 50ms - init_commands: [] - sensors: - - { key: rpm, preset: rpm, update_interval: 1s } - - { key: speed, preset: speed, update_interval: 1s } - - { key: coolant_temp, preset: coolant_temp, update_interval: 10s } - - { key: fuel_level, preset: fuel_level, update_interval: 60s } - - - id: obd_gm_extended - name: "OBD-II + GM extensions" - description: "Standard PIDs plus GM mode-22 sensors (ATSP6 init)" - device: - id: car_obd - name: "Vehicle OBD" - source: obd - obd: - service_uuid: "18F0" - tx_char_uuid: "2AF1" - rx_char_uuid: "2AF0" - tx_delay: 50ms - init_commands: ["ATSP6"] - sensors: - - { key: rpm, preset: rpm, update_interval: 1s } - - { key: speed, preset: speed, update_interval: 1s } - - { key: coolant_temp, preset: coolant_temp, update_interval: 10s } - - key: fuel_level - preset: fuel_level - update_interval: 60s - publish: { deadband: 0.5, min_interval: 60s } - - { key: gear, preset: gm_current_gear, update_interval: 2s } - - { key: prnd, preset: gm_prnd_status_alt, update_interval: 2s } - - { key: oil_pressure, preset: gm_oil_pressure, update_interval: 5s } - - { key: trans_temp, preset: gm_trans_temp, update_interval: 10s } - - - id: obd_hyundai_kia - name: "OBD-II + ํ˜„๋Œ€/๊ธฐ์•„ ๊ณ„๊ธฐํŒ" - description: "RPM, ์†๋„, ์ด ์ฃผํ–‰๊ฑฐ๋ฆฌ, ์—ฐ๋ฃŒ์ž”๋Ÿ‰(L), ๊ณ„๊ธฐํŒ ์ „์•• โ€” ๊ณ„๊ธฐํŒ 7C6 / 22B002" - device: - id: car_obd_hk - name: "Hyundai/Kia OBD" - source: obd - obd: - service_uuid: "18F0" - tx_char_uuid: "2AF1" - rx_char_uuid: "2AF0" - tx_delay: 50ms - init_commands: ["ATSP6"] - # default_commands ์ƒ๋žต โ€” ์•„๋ž˜ ATSH7C6 ์„ผ์„œ๊ฐ€ ์žˆ์œผ๋ฏ€๋กœ ์•ฑ์ด ATSH7DF๋กœ ์ž๋™ ๋ณต์› - sensors: - - { key: rpm, preset: rpm, update_interval: 1s } - - { key: speed, preset: speed, update_interval: 1s } - # ๊ณ„๊ธฐํŒ(CLU) UDS. ์š”์ฒญ 7C6 โ†’ ์‘๋‹ต 7CE. ํ•œ ์‘๋‹ต์— ์ฃผํ–‰๊ฑฐ๋ฆฌยท์—ฐ๋ฃŒยท์ „์••์ด ํ•จ๊ป˜ ์˜จ๋‹ค. - # ์‘๋‹ต: 62 B0 02 [a][b][c][d][e][f][g][h][i][j][k][l]โ€ฆ - # (a = 62B002 ์—์ฝ” ๋ฐ”๋กœ ๋‹ค์Œ ๋ฐ”์ดํŠธ) - # e โ†’ ์—ฐ๋ฃŒ์ž”๋Ÿ‰ e*0.5 L - # f โ†’ ๊ณ„๊ธฐํŒ ์ „์•• f/12.8 = f*0.078125 V - # g:h:i โ†’ ์ด ์ฃผํ–‰๊ฑฐ๋ฆฌ 24bit km - # j:k:l โ†’ ์œ„์™€ ๊ฐ™์€ ์ฃผํ–‰๊ฑฐ๋ฆฌ์˜ mile ๊ฐ’ (๋ถ๋ฏธ ์‚ฌ์–‘ ๊ณ„๊ธฐํŒ) - # ์ถœ์ฒ˜: OBDb(obdb.community)์—์„œ ํ˜„๋Œ€ยท๊ธฐ์•„ 11๊ฐœ ์ฐจ์ข…์ด ๋™์ผํ•œ ๋ฐ”์ดํŠธ ๋ฐฐ์น˜๋กœ ํ™•์ธ. - # awesomeit Torque ํ”Œ๋Ÿฌ๊ทธ์ธ(35๊ฐœ ์ฐจ์ข…)ยทElantra CN7 PID ๋ชฉ๋ก๊ณผ๋„ ์ผ์น˜. - # 2013๋…„์‹ ์ดํ›„์—์„œ ๋„๋ฆฌ ๋™์ž‘ํ•˜๋ฉฐ, ๋ฏธ์ง€์› ์ฐจ๋Š” NO DATA๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. - # - # ์˜ˆ์™ธ: ์—‘์„ผํŠธ(RB)๋Š” ๊ณ„๊ธฐํŒ์ด ์ด DID๋ฅผ ์—ด์ง€ ์•Š๋Š”๋‹ค. 2013/2015/2019 ์‹ค์ฐจ ์บก์ฒ˜์—์„œ - # unsupported๋กœ ํ™•์ธ๋๊ณ  (2018๋…„์‹๋งŒ ์˜ˆ์™ธ), ์š”์ฒญํ•˜๋ฉด 7F 22 22๋ฅผ ๋Œ๋ ค์ค€๋‹ค. - # ์—‘์„ผํŠธ๋Š” ์•„๋ž˜ obd_hyundai_accent_rb_diesel ํ…œํ”Œ๋ฆฟ์„ ์“ธ ๊ฒƒ. - - key: odometer - mode: "22" - pid: "B002" - pre_commands: ["ATSH7C6"] - formula: "g*65536+h*256+i" - unit: "km" - device_class: distance - state_class: total_increasing - accuracy_decimals: 0 - icon: mdi:counter - update_interval: 60s - - key: fuel_level - mode: "22" - pid: "B002" - pre_commands: ["ATSH7C6"] - formula: "e*0.5" - unit: "L" - state_class: measurement - accuracy_decimals: 1 - icon: mdi:gas-station - update_interval: 60s - publish: { deadband: 0.5, min_interval: 60s } - - key: cluster_voltage - mode: "22" - pid: "B002" - pre_commands: ["ATSH7C6"] - formula: "f*0.078125" - unit: "V" - device_class: voltage - state_class: measurement - accuracy_decimals: 2 - entity_category: diagnostic - update_interval: 120s - - - id: obd_hyundai_accent_rb_diesel - name: "OBD-II ์—‘์„ผํŠธ(RB) ๋””์ ค" - description: "RPM, ์†๋„, ์—ฐ๋ฃŒ %, ํก๊ธฐ์˜จ๋„, ๋Œ€๊ธฐ์•• + ์ด์ฃผํ–‰๊ฑฐ๋ฆฌ ํ”„๋กœ๋ธŒ โ€” ์—‘์„ผํŠธ RB 1.6 TCI-U2" - device: - id: car_obd_accent - name: "Accent RB Diesel" - source: obd - obd: - service_uuid: "18F0" - tx_char_uuid: "2AF1" - rx_char_uuid: "2AF0" - tx_delay: 50ms - init_commands: ["ATSP6"] - # ์•„๋ž˜ ATSH7E0 ์„ผ์„œ๊ฐ€ ์žˆ์œผ๋ฏ€๋กœ ํ‘œ์ค€ ์„ผ์„œ ์•ž์— ATSH7DF๊ฐ€ ์ž๋™ ์‚ฝ์ž…๋œ๋‹ค - sensors: - - { key: rpm, preset: rpm, update_interval: 1s } - - { key: speed, preset: speed, update_interval: 1s } - # ์—ฐ๋ฃŒ๋Ÿ‰์€ ์ด ์ฐจ์—์„œ ์ฝ์„ ๋ฐฉ๋ฒ•์ด ์—†๋‹ค. ํ‘œ์ค€ 01 2F๋Š” ์‹ค์ฐจ์—์„œ NO DATA๋ฅผ - # ๋Œ๋ ค์ฃผ๊ณ (OBDb ์บก์ฒ˜๋Š” ๋ถ๋ฏธ ๊ฐ€์†”๋ฆฐ ๊ธฐ์ค€์ด๋ผ ๋””์ ค์—๋Š” ๋งž์ง€ ์•Š์•˜๋‹ค), - # ๊ณ„๊ธฐํŒ 22B002๋„ 7F 22 22๋กœ ๊ฑฐ๋ถ€ํ•œ๋‹ค. - # awesomeit ์—‘์„ผํŠธRB 2013 D 1.6 TCI-U2 ํ”„๋กœํ•„์—์„œ ํ™•์ธ๋œ ๊ฐ’๋“ค - - key: intake_temp - mode: "21" - pid: "01" - pre_commands: ["ATSH7E0"] - formula: "k*0.980392-50" - unit: "ยฐC" - device_class: temperature - state_class: measurement - accuracy_decimals: 1 - update_interval: 20s - - key: barometric_pressure - mode: "21" - pid: "01" - pre_commands: ["ATSH7E0"] - formula: "j*1.372549" - unit: "kPa" - device_class: pressure - state_class: measurement - accuracy_decimals: 1 - update_interval: 60s - # โ”€โ”€ ์ด์ฃผํ–‰๊ฑฐ๋ฆฌ (์—”์ง„ ECU์˜ DPF ๋ธ”๋ก์— ๊ฐ™์ด ์‹ค๋ ค ์˜จ๋‹ค) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - # ์—‘์„ผํŠธ RB๋Š” ๊ณ„๊ธฐํŒ(7C6 / 22B002)์ด ์ฃผํ–‰๊ฑฐ๋ฆฌ๋ฅผ ์ง์ ‘ ๋‚ด์ฃผ์ง€ ์•Š๋Š”๋‹ค โ€” - # ์š”์ฒญํ•˜๋ฉด 7F 22 22. ๊ทธ๋ž˜์„œ ๋Œ€์•ˆ์œผ๋กœ ์—”์ง„ ECU์˜ 21 03 ๋ธ”๋ก์„ ์“ด๋‹ค - # (OBDb ๋ฉ”์ด์ปค ๊ณต์šฉ HYUNDAI_ODO_V2): - # byte 49~52 ๋งˆ์ง€๋ง‰ DPF ์žฌ์ƒ ์‹œ์ ์˜ ์ฃผํ–‰๊ฑฐ๋ฆฌ /1000 km - # byte 53~56 ์žฌ์ƒ ์ดํ›„ ๋‹ฌ๋ฆฐ ๊ฑฐ๋ฆฌ /1000 km - # byte 57~60 ์ด์ฃผํ–‰๊ฑฐ๋ฆฌ /1000 km โ† ๋ชฉํ‘œ - # ์…‹์€ ์„œ๋กœ ๋‹ค๋ฅธ ํ•„๋“œ๋‹ค. awesomeit์ด "DPF ์ฃผํ–‰๊ฑฐ๋ฆฌ"๋กœ ๋ถ€๋ฅด๋Š” ๊ฑด byte 53(์žฌ์ƒ ํ›„ ๊ฑฐ๋ฆฌ). - # - # ์‘๋‹ต์ด byte 57๊นŒ์ง€ ๋„์ฐฉํ•˜์ง€ ์•Š์œผ๋ฉด decode๊ฐ€ null์„ ๋Œ๋ ค์ฃผ๊ณ  ์•„๋ฌด๊ฒƒ๋„ - # ๋ฐœํ–‰๋˜์ง€ ์•Š๋Š”๋‹ค โ€” ๋ฏธ์ง€์› ์ฐจ์—์„œ ์—‰๋šฑํ•œ ๊ฐ’์ด ์˜ฌ๋ผ์˜ค์ง€ ์•Š๋Š”๋‹ค. - # - # ๋ณด์ •: 2026-07-30 ์‹ค์ธก์—์„œ ์ด ECU ์นด์šดํ„ฐ๊ฐ€ ๊ณ„๊ธฐํŒ(195958 km)๋ณด๋‹ค - # 0.7331% ๋†’๊ฒŒ(197394.5 km) ๋‚˜์™”๋‹ค. ์ฒ˜์Œ์—” ์ƒ์ˆ˜(offset_value)๋กœ ๋ณด์ •ํ–ˆ์œผ๋‚˜ - # ์‹ ์ฐจ(์นด์šดํ„ฐ=0)์—์„œ dash=-1436.5km ๊ฐ€ ๋‚˜์˜ค๋Š” ๊ฒŒ ๋˜์–ด ์„ฑ๋ฆฝํ•  ์ˆ˜ ์—†๋‹ค. - # ๋ฐฐ์œจ(scale) ๋ณด์ •์€ ์›์ ์„ ์ง€๋‚˜๋ฏ€๋กœ(์นด์šดํ„ฐ=0 โ†’ dash=0) ๋ฌผ๋ฆฌ์ ์œผ๋กœ ๋งž๋‹ค โ€” - # ์ด ์นด์šดํ„ฐ๋Š” ๊ณ„๊ธฐํŒ๊ณผ ๋ณ„๊ฐœ ํ™˜์‚ฐ๊ณ„์ˆ˜๋กœ ๋ฐ”ํ€ด์†๋„ ํŽ„์Šค๋ฅผ ๊ฑฐ๋ฆฌ๋กœ ๋ˆ„์ ํ•˜๋Š” - # ์„œ๋น„์Šค์šฉ ๊ฐ’์ด๋ผ, ์˜ค์ฐจ๊ฐ€ ์ฃผํ–‰๊ฑฐ๋ฆฌ์— ๋น„๋ก€ํ•ด ๋ฒŒ์–ด์ง€๋Š” ๊ฒŒ ์ •์ƒ์ด๋‹ค. - # ์„ธ ํ•„๋“œ๊ฐ€ odometer = at_regen + since_regen ํ•ญ๋“ฑ์‹์„ ๋งŒ์กฑํ•˜๋ ค๋ฉด - # ์…‹ ๋‹ค ๊ฐ™์€ ๋ฐฐ์œจ์„ ์จ์•ผ ํ•œ๋‹ค (์ƒ์ˆ˜ ๋ณด์ •๊ณผ ๋‹ฌ๋ฆฌ since_regen๋„ ์˜ˆ์™ธ ์—†์Œ). - # - # ์ธก์ •์ด ํ•œ ์ ๋ฟ์ด๋ผ ๋ฐฐ์œจ๋งŒ ๊ฐ€์ •ํ–ˆ๊ณ  ์ ˆํŽธ์€ 0์œผ๋กœ ๋’€๋‹ค. 100km ์ด์ƒ - # ์ฃผํ–‰ ํ›„ ์žฌํ™•์ธํ•ด ๋‘ ์ ์œผ๋กœ ์™„์ „ํ•œ affine ์‹(scaleยทoffset_value ๋‘˜ ๋‹ค)์„ - # ํ’€ ๊ฒƒ โ€” ์•„๋ž˜ odometer_flow_control ์ด ๊ณ„๊ธฐํŒ ๊ฐ’์„ ์ง์ ‘ ์ค€๋‹ค๋ฉด ์ด ๋ณด์ • - # ์ž์ฒด๊ฐ€ ํ•„์š” ์—†์–ด์ง€๋ฏ€๋กœ ๊ทธ์ชฝ์„ ๋จผ์ € ํ™•์ธํ•œ๋‹ค. - # ์˜ค๋„๋ฏธํ„ฐ๋Š” ๋ถ„ ๋‹จ์œ„๋กœ ๊ฐฑ์‹ ๋  ํ•„์š”๊ฐ€ ์—†๊ณ , 63๋ฐ”์ดํŠธ ๋ฉ€ํ‹ฐํ”„๋ ˆ์ž„์ด๋ผ ์งง์€ - # PID๋ณด๋‹ค ๋ฌด๊ฒ๋‹ค โ€” ์ฃผ๊ธฐ๋ฅผ ๋Š˜๋ฆฌ๋Š” ๊ฒŒ ๋ฐฐํ„ฐ๋ฆฌ์— ๊ฐ€์žฅ ํฌ๊ฒŒ ๋„์›€๋˜๋Š” ์ง€์ ์ด๋‹ค. - - key: odometer - mode: "21" - pid: "03" - pre_commands: ["ATSH7E0"] - decode: { offset: 57, length: 4, type: uint32, endian: big, scale: 0.000992723 } - unit: "km" - device_class: distance - state_class: total_increasing - accuracy_decimals: 1 - icon: mdi:counter - update_interval: 300s - # ๊ฒ€์‚ฐ์šฉ: ์žฌ์ƒ์‹œ์  ์ฃผํ–‰๊ฑฐ๋ฆฌ + ์žฌ์ƒํ›„ ๊ฑฐ๋ฆฌ = ์ด์ฃผํ–‰๊ฑฐ๋ฆฌ. - # ์…‹ ๋‹ค ๊ฐ™์€ ์นด์šดํ„ฐ๋ฅผ ๊ณต์œ ํ•˜๋ฏ€๋กœ ๊ฐ™์€ ๋ฐฐ์œจ์„ ์ ์šฉํ•ด์•ผ ํ•ญ๋“ฑ์‹์ด ์œ ์ง€๋œ๋‹ค. - - key: odometer_at_last_dpf_regen - mode: "21" - pid: "03" - pre_commands: ["ATSH7E0"] - decode: { offset: 49, length: 4, type: uint32, endian: big, scale: 0.000992723 } - unit: "km" - device_class: distance - state_class: total_increasing - accuracy_decimals: 1 - entity_category: diagnostic - update_interval: 300s - - key: distance_since_dpf_regen - mode: "21" - pid: "03" - pre_commands: ["ATSH7E0"] - decode: { offset: 53, length: 4, type: uint32, endian: big, scale: 0.000992723 } - unit: "km" - device_class: distance - state_class: measurement - accuracy_decimals: 1 - entity_category: diagnostic - update_interval: 300s - - # โ”€โ”€ ๊ณ„๊ธฐํŒ ์˜ค๋„๋ฏธํ„ฐ ์žฌ์‹œ๋„: ํ™•์žฅ ์ง„๋‹จ ์„ธ์…˜ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - # ์œ„ odometer ๋Š” ์–ด๋””๊นŒ์ง€๋‚˜ ๋Œ€์ฒด ๊ฒฝ๋กœ(์ถ”์ • ๋ณด์ •)๋‹ค. ์ง„์งœ ๊ณ„๊ธฐํŒ ๊ฐ’์„ - # ์ง์ ‘ ๋ฐ›์„ ๊ฐ€๋Šฅ์„ฑ์ด ์•„์ง ๋‚จ์•„ ์žˆ๋‹ค โ€” 7F 22 22 ์˜ NRC 22(conditionsNotCorrect)๋Š” - # UDS ํ‘œ์ค€์ƒ "๊ทธ DID๋Š” ์กด์žฌํ•˜๋Š”๋ฐ ์ง€๊ธˆ ์กฐ๊ฑด์—์„œ ๊ฑฐ๋ถ€"๋ผ๋Š” ๋œป์ด๋‹ค. - # DID ์ž์ฒด๊ฐ€ ์—†๋‹ค๋Š” NRC 11(serviceNotSupported)ยท31(requestOutOfRange)์ด ์•„๋‹ˆ์—ˆ๋‹ค. - # - # meatpiHQ/wican-fw#478 ์—์„œ ๊ฐ™์€ ํ—ค๋”(7C6)ยท๊ฐ™์€ PID(22B002)๋กœ ์‹ค์ œ ์„ฑ๊ณตํ•œ - # ์‚ฌ๋ก€ ๋‘˜์„ ํ™•์ธํ–ˆ๋‹ค: ์•„์ด์˜ค๋‹‰ 28kWh(WiCAN, pid_init "ATSH7C6;ATFCSH7C6")์™€ - # ์•„์ด์˜ค๋‹‰5(canair, ์„ธ์…˜ ๋ช…๋ น ์—†์ด ๋ฐ”๋กœ ์กฐํšŒ). ๋‘˜ ๋‹ค ํ™•์žฅ ์„ธ์…˜(10 03) ์—†์ด - # ๋๊ณ , ๊ณตํ†ต์ ์€ ํ๋ฆ„์ œ์–ด(ATFCSH) ์„ค์ •๋ฟ์ด์—ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์„ธ์…˜ ๋Œ€์‹  ํ๋ฆ„์ œ์–ด๋ฅผ - # ๋จผ์ € ์‹œ๋„ํ•œ๋‹ค โ€” ์‹ค์ œ ์„ฑ๊ณต ์‚ฌ๋ก€์— ๋” ๊ฐ€๊น๋‹ค. - # - # ์˜ค๋„๋ฏธํ„ฐ ์œ„์น˜๋„ ์„ธ๋Œ€๋ณ„๋กœ ๋‹ค๋ฅด๋‹ค: ์•„์ด์˜ค๋‹‰5ยทOBDb ICE 11๊ฐœ ์ฐจ์ข…์€ byte - # 6~8(g,h,i)์ธ๋ฐ, ๊ตฌํ˜• ์•„์ด์˜ค๋‹‰ 28kWh๋Š” byte 9~11(j,k,l)์ด์—ˆ๋‹ค - # (WiCAN์ด ISO-TP PCI ๋ฐ”์ดํŠธ๋ฅผ ํŽ˜์ด๋กœ๋“œ์— ์„ž์–ด ๋„ฃ๋Š” ๋ณ„๋„ ๋ฒ„๊ทธ๊ฐ€ ์žˆ์–ด, - # ๊ทธ ์ด์Šˆ์—์„œ ๊ณต๊ฐœํ•œ ๋ณด์ •ํ‘œ๋กœ ์‹ค์ œ ์œ„์น˜๋ฅผ ์—ญ์‚ฐํ•œ ๊ฐ’). ์‘๋‹ต์€ ์™”๋Š”๋ฐ - # 195958๊ณผ ์•ˆ ๋งž์œผ๋ฉด formula ๋ฅผ "j*65536+k*256+l" ๋กœ ๋ฐ”๊ฟ”์„œ ์žฌ์‹œ๋„ํ•  ๊ฒƒ. - # - # pre_commands ์ž์ฒด์˜ ์‘๋‹ต(ํ๋ฆ„์ œ์–ด ์„ค์ • OK/์—๋Ÿฌ)์€ ๋กœ๊ทธ์— ์•ˆ ๋‚จ์ง€๋งŒ - # (ํ•ด๋‹น ์‘๋‹ต์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์„ผ์„œ๊ฐ€ ์—†์–ด ๊ธฐ๋ก ๊ฒฝ๋กœ๋ฅผ ์•ˆ ํƒ„๋‹ค), ๋’ค๋”ฐ๋ฅด๋Š” - # 22B002 ์‘๋‹ต์€ ๊ทธ๋Œ€๋กœ ๋‚จ๋Š”๋‹ค. - # raw=62B002โ€ฆ โ†’ ์„ฑ๊ณต. ๊ณ„๊ธฐํŒ ๊ฐ’์ด ๋ณด์ • ์—†์ด ์ง์ ‘ ๋‚˜์˜จ๋‹ค - # negative response ๊ทธ๋Œ€๋กœ โ†’ ํ๋ฆ„์ œ์–ด๋„ ์†Œ์šฉ์—†์Œ. ์„ธ์…˜(10 03)์œผ๋กœ ํ•œ ๋ฒˆ ๋” - # ์‹œ๋„ํ•ด๋ณผ ์ˆ˜๋Š” ์žˆ์œผ๋‚˜, ์œ„ ๋‘ ์„ฑ๊ณต ์‚ฌ๋ก€ ๋ชจ๋‘ ์„ธ์…˜ ์—†์ด ๋๋‹ค๋Š” ์ ์—์„œ - # ์ด ์ฐจ๋Š” DID ์ž์ฒด๊ฐ€ ์—†์„ ๊ฐ€๋Šฅ์„ฑ์ด ์ด์ „๋ณด๋‹ค ๋†’์•„์กŒ๋‹ค. - - key: odometer_flow_control - mode: "22" - pid: "B002" - pre_commands: ["ATSH7C6", "ATFCSH7C6", "ATFCSD300000", "ATFCSM1"] - formula: "g*65536+h*256+i" - unit: "km" - device_class: distance - state_class: total_increasing - accuracy_decimals: 0 - entity_category: diagnostic - update_interval: 300s - - # ๊ณ„๊ธฐํŒ(22B002)ยทํ‘œ์ค€(01A6)ยท๋ณ€์†๊ธฐ(21A0) ์˜คํ”„์…‹ 0~15 ์Šค์บ”์€ 195958km์™€ - # ์ผ์น˜ํ•˜๋Š” ๊ฐ’์„ ์ฐพ์ง€ ๋ชปํ•ด ์ œ๊ฑฐํ–ˆ๋‹ค. ๊ณ„๊ธฐํŒ์€ ์• ์ดˆ์— 22B002 ์ž์ฒด๋ฅผ - # 7F 22 22๋กœ ๊ฑฐ๋ถ€ํ•˜๋ฏ€๋กœ ๋‹ค๋ฅธ DID๋ฅผ ๋” ๋’ค์ ธ๋ณผ ์ด์œ ๊ฐ€ ์•ฝํ•˜๊ณ , ํ‘œ์ค€ 01A6์€ - # mode 01 ์ง€์› ๋ชฉ๋ก์— ์—†์–ด ์˜ˆ์ƒ๋Œ€๋กœ์˜€๋‹ค. ์œ„ offset_value ๋ณด์ •์„ ๊ณ„์† ์“ด๋‹ค. - - # โ”€โ”€ ๋ณ€์†๊ธฐ(TCU) 21 A0 @ 7E1 โ€” ์‘๋‹ต์ด 4๋ฐ”์ดํŠธ๋ฟ์ด๋‹ค โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - # ์‹ค์ธก: ์š”์ฒญ 116๊ฑด, ์‘๋‹ต 115๊ฑด์ด ์ „๋ถ€ 61A0FFFF0000. - # ์—์ฝ”(61 A0)๋ฅผ ๋บ€ ๋ฐ์ดํ„ฐ๋Š” FF FF 00 00 โ€” 4๋ฐ”์ดํŠธ๊ฐ€ ์ „๋ถ€๋‹ค. - # - # ์ž˜๋ฆฐ ๋ฉ€ํ‹ฐํ”„๋ ˆ์ž„์ด ์•„๋‹ˆ๋ผ ์™„๊ฒฐ๋œ ์‘๋‹ต์ด๋‹ค. ์‘๋‹ต ์ง€์—ฐ ์ค‘์•™๊ฐ’์ด 92ms ๋กœ, - # ๋‹จ์ผํ”„๋ ˆ์ž„ 010C(79ms)ยท๋ฉ€ํ‹ฐํ”„๋ ˆ์ž„ 2101(41๋ฐ”์ดํŠธ, 76ms)๊ณผ ๊ฐ™์€ ์ˆ˜์ค€์ด๋‹ค. - # First Frame ๋งŒ ์˜ค๊ณ  CF ๊ฐ€ ๋Š๊ธด ๊ฒƒ์ด๋ผ๋ฉด ELM327 ์ด CF ๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๋‹ค - # ๋‚ด๋ถ€ ํƒ€์ž„์•„์›ƒ์„ ๋จน์–ด์•ผ ํ•˜๋ฏ€๋กœ ์ง€์—ฐ์ด ํ›จ์”ฌ ์ปค์ง„๋‹ค. ๊ทธ๋Ÿฐ ํ”์ ์ด ์—†๋‹ค. - # ํ๋ฆ„์ œ์–ด(ATFCSH) ๋ฌธ์ œ๋„ ์•„๋‹ˆ๋‹ค โ€” ๊ฐ™์€ ์„ธ์…˜์—์„œ 7E0 ๋ฉ€ํ‹ฐํ”„๋ ˆ์ž„์€ ์ •์ƒ์ด๋‹ค. - # - # ๋”ฐ๋ผ์„œ awesomeit ํ”„๋กœํ•„์˜ byte 13(๋ฏธ์…˜์˜ค์ผ์˜จ๋„)ยท20(๊ธฐ์–ด์œ„์น˜)ยท21(๊ธฐ์–ด๋‹จ์ˆ˜)์€ - # ์ด ์‘๋‹ต์œผ๋กœ๋Š” ์ ˆ๋Œ€ ๋‹ฟ์ง€ ์•Š๋Š”๋‹ค. ํ”„๋กœํ•„์ด ๋‹ค๋ฅธ ์‚ฌ์–‘ ๊ธฐ์ค€์ด๊ฑฐ๋‚˜, - # ์ด TCU ๊ฐ€ ํŠน์ • ์กฐ๊ฑด์—์„œ๋งŒ ์ „์ฒด ๋ธ”๋ก์„ ์ค€๋‹ค๋Š” ๋œป์ด๋‹ค. - # - # ์•„๋ž˜๋Š” ์‹ค์ œ๋กœ ์˜ค๋Š” 4๋ฐ”์ดํŠธ๋ฅผ ๊ทธ๋Œ€๋กœ ๋…ธ์ถœํ•˜๋Š” ํ”„๋กœ๋ธŒ๋‹ค. - # ์ฃผ์ฐจ(P)ยท์—”์ง„๊ณตํšŒ์ „ ์ƒํƒœ์—์„œ๋งŒ ๋กœ๊ทธ๋ฅผ ๋–ด์œผ๋ฏ€๋กœ, ์ฃผํ–‰ ์ค‘์ด๋‚˜ ๊ธฐ์–ด๋ฅผ ๋ฐ”๊ฟ€ ๋•Œ - # ๊ฐ’์ด ๋‹ฌ๋ผ์ง€๋Š”์ง€ ๋ด์•ผ ํ•œ๋‹ค. ๊ฐ’์ด ์›€์ง์ด๋ฉด ๊ทธ ๋ฐ”์ดํŠธ๊ฐ€ ๊ธฐ์–ด ์ •๋ณด์ด๊ณ , - # FF FF 00 00 ์ด ๊ณ„์† ๊ณ ์ •์ด๋ฉด ์ด ์ฐจ TCU ๋Š” ์ด ๋ธ”๋ก์„ ์•ˆ ์ฑ„์šฐ๋Š” ๊ฒƒ์ด๋‹ค. - - key: tcu_byte0 - mode: "21" - pid: "A0" - pre_commands: ["ATSH7E1"] - decode: { offset: 0, length: 1, type: uint8 } - entity_category: diagnostic - update_interval: 2s - - key: tcu_byte1 - mode: "21" - pid: "A0" - pre_commands: ["ATSH7E1"] - decode: { offset: 1, length: 1, type: uint8 } - entity_category: diagnostic - update_interval: 2s - - key: tcu_byte2 - mode: "21" - pid: "A0" - pre_commands: ["ATSH7E1"] - decode: { offset: 2, length: 1, type: uint8 } - entity_category: diagnostic - update_interval: 2s - - key: tcu_byte3 - mode: "21" - pid: "A0" - pre_commands: ["ATSH7E1"] - decode: { offset: 3, length: 1, type: uint8 } - entity_category: diagnostic - update_interval: 2s - - - id: gatt_meter_relay - name: "GATT power meter + relay" - description: "Notify characteristic + switch control example" - device: - id: custom_meter - name: "Custom BLE Meter" - source: gatt_notify - gatt: - service_uuid: "ffe0" - notify_char_uuid: "ffe1" - write_char_uuid: "ffe2" - sensors: - - key: power - unit: "W" - device_class: power - state_class: measurement - decode: { offset: 0, length: 2, type: uint16, endian: little } - controls: - - key: relay - type: switch - command: { on: "A10100", off: "A10000" } +- id: toyota_proace_city + name: Toyota Proace City (Vgate iCar Pro BLE) + description: Standard OBD-II PIDs for the PSA-based Proace City โ€” bind the adapter in the app + device: + id: proace_city_obd + name: Toyota Proace City + source: obd + obd: + service_uuid: E7810A71-73AE-499D-8C15-FAA9AEF0C3F2 + tx_char_uuid: BEF8D6C9-9C21-4C9E-B632-BD58C1009F9F + rx_char_uuid: BEF8D6C9-9C21-4C9E-B632-BD58C1009F9F + tx_delay: 50ms + init_commands: + - ATSP6 + sensors: + - key: rpm + preset: rpm + update_interval: 2s + - key: speed + preset: speed + update_interval: 2s + - key: engine_load + preset: engine_load + update_interval: 5s + - key: coolant_temp + preset: coolant_temp + update_interval: 30s + - key: intake_temp + preset: intake_air_temp + update_interval: 30s + - key: ambient_temp + preset: ambient_temp + update_interval: 60s + - key: battery + preset: battery_voltage + update_interval: 10s + - key: run_time + preset: run_time + update_interval: 10s + - key: fuel_level + preset: fuel_level + update_interval: 30s + publish: + deadband: 0.5 + min_interval: 60s + - key: odometer + preset: odometer + update_interval: 60s + - key: intake_map + mode: '01' + pid: 0B + formula: a + unit: kPa + device_class: pressure + state_class: measurement + accuracy_decimals: 0 + update_interval: 5s + - key: barometric_pressure + mode: '01' + pid: '33' + formula: a + unit: kPa + device_class: pressure + state_class: measurement + accuracy_decimals: 0 + update_interval: 120s + - key: fuel_rail_pressure + mode: '01' + pid: '23' + formula: (a*256+b)*10 + unit: kPa + device_class: pressure + state_class: measurement + accuracy_decimals: 0 + update_interval: 5s + - key: distance_since_dtc_clear + mode: '01' + pid: '31' + formula: a*256+b + unit: km + device_class: distance + state_class: total_increasing + accuracy_decimals: 0 + update_interval: 300s + - key: distance_with_mil_on + mode: '01' + pid: '21' + formula: a*256+b + unit: km + device_class: distance + state_class: measurement + accuracy_decimals: 0 + icon: mdi:engine-off + update_interval: 300s