From e38b2cc9547b2a3af4e00fb5aea69ccfe9771c30 Mon Sep 17 00:00:00 2001 From: eigger Date: Thu, 25 Jun 2026 12:12:51 +0900 Subject: [PATCH] Add templates.yaml for HassBle import template feature Include Jaalee JHT, parking beacon, OBD, and GATT starter templates. Update README for fixed config.yaml + templates.yaml layout. Co-authored-by: Cursor --- README.md | 20 ++++++-- config.yaml | 9 ++-- templates.yaml | 133 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+), 7 deletions(-) create mode 100644 templates.yaml diff --git a/README.md b/README.md index 286256c..27ec6f6 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,23 @@ --- +## Repository files + +| File | Purpose | +|------|---------| +| `config.yaml` | Active gateway configuration (devices the app runs) | +| `templates.yaml` | Device templates for **Import template** in the Sensors tab | + +The app loads both from the repo root on the selected branch (`owner/repo` + branch — file names are fixed). + ## How It Works -The HassBle app downloads your `config.yaml` from a Git raw URL, 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. +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. + +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) @@ -51,8 +65,8 @@ Android Phone (BLE Scan) ## Quick Start 1. Fork or copy this repository to your GitHub account. -2. Edit `config.yaml` to describe your BLE devices. -3. In the HassBle app → **Sensors tab** → enter `your-username/hassble-config` → press **Browse** → select `config.yaml`. +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. diff --git a/config.yaml b/config.yaml index f3fb0ee..d78cadb 100644 --- a/config.yaml +++ b/config.yaml @@ -1,9 +1,10 @@ # HassBle Configuration File -# -# Host this config.yaml file in a Git repository (e.g., GitHub) and enter the RAW URL in the HassBle Android app. -# The app will download this configuration, decode BLE advertisements/sensors, and declare/update them in Home Assistant. # -# Do NOT put any Home Assistant credentials (URL/Token) in this file. Enter them directly in the app. +# 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. +# +# Do NOT put any Home Assistant credentials (URL/Token) in this file. Enter them in the app. version: 1 diff --git a/templates.yaml b/templates.yaml new file mode 100644 index 0000000..7342a05 --- /dev/null +++ b/templates.yaml @@ -0,0 +1,133 @@ +# Device templates for HassBle app → Sensors tab → Import template +# 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: "Shared parking beacon (manufacturer 861 / 0x035D)" + device: + id: parking_beacon + name: "Parking Beacon" + source: advertisement + instance_mode: shared + match: + manufacturer_id: 861 + sensors: + - key: parking_time + device_class: timestamp + source_field: manufacturer_data + min_length: 14 + decode: { offset: 7, length: 4, type: timestamp } + - key: parking_battery + device_class: battery + unit: "%" + state_class: measurement + source_field: manufacturer_data + min_length: 14 + decode: { offset: 11, length: 1, type: uint8, scale: -1, offset_value: 256 } + - key: parking_location + platform: text_sensor + source_field: manufacturer_data + min_length: 14 + decode: { offset: 12, length: 2, 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: ["ATZ", "ATE0", "ATL0", "ATS0", "ATH0", "ATSP0"] + 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 } + + - 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: ["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: 0.5, min_interval: 60s } + - { key: gear, preset: gm_current_gear, update_interval: 1s } + - { key: prnd, preset: gm_prnd_status_alt, update_interval: 1s } + - { key: oil_pressure, preset: gm_oil_pressure, update_interval: 2s } + - { key: trans_temp, preset: gm_trans_temp, update_interval: 10s } + + - 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" }