mqtt2matter 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +76 -0
- package/LICENSE +202 -0
- package/NOTICE +23 -0
- package/README.md +172 -2
- package/dist/app.d.ts +34 -0
- package/dist/app.js +157 -0
- package/dist/app.js.map +1 -0
- package/dist/commands/import-z2m.d.ts +20 -0
- package/dist/commands/import-z2m.js +173 -0
- package/dist/commands/import-z2m.js.map +1 -0
- package/dist/commands/install.d.ts +41 -0
- package/dist/commands/install.js +250 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/update.d.ts +14 -0
- package/dist/commands/update.js +109 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/load.d.ts +57 -0
- package/dist/config/load.js +137 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/schema.d.ts +496 -0
- package/dist/config/schema.js +115 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/engine/payload.d.ts +94 -0
- package/dist/engine/payload.js +515 -0
- package/dist/engine/payload.js.map +1 -0
- package/dist/engine/runtime.d.ts +79 -0
- package/dist/engine/runtime.js +438 -0
- package/dist/engine/runtime.js.map +1 -0
- package/dist/engine/template.d.ts +20 -0
- package/dist/engine/template.js +264 -0
- package/dist/engine/template.js.map +1 -0
- package/dist/engine/units.d.ts +9 -0
- package/dist/engine/units.js +42 -0
- package/dist/engine/units.js.map +1 -0
- package/dist/families/climate.d.ts +11 -0
- package/dist/families/climate.js +68 -0
- package/dist/families/climate.js.map +1 -0
- package/dist/families/color.d.ts +30 -0
- package/dist/families/color.js +152 -0
- package/dist/families/color.js.map +1 -0
- package/dist/families/cover.d.ts +17 -0
- package/dist/families/cover.js +308 -0
- package/dist/families/cover.js.map +1 -0
- package/dist/families/fan.d.ts +16 -0
- package/dist/families/fan.js +154 -0
- package/dist/families/fan.js.map +1 -0
- package/dist/families/index.d.ts +32 -0
- package/dist/families/index.js +162 -0
- package/dist/families/index.js.map +1 -0
- package/dist/families/light.d.ts +36 -0
- package/dist/families/light.js +258 -0
- package/dist/families/light.js.map +1 -0
- package/dist/families/lock.d.ts +10 -0
- package/dist/families/lock.js +31 -0
- package/dist/families/lock.js.map +1 -0
- package/dist/families/on-off.d.ts +7 -0
- package/dist/families/on-off.js +56 -0
- package/dist/families/on-off.js.map +1 -0
- package/dist/families/power-source.d.ts +12 -0
- package/dist/families/power-source.js +60 -0
- package/dist/families/power-source.js.map +1 -0
- package/dist/families/registry.d.ts +40 -0
- package/dist/families/registry.js +72 -0
- package/dist/families/registry.js.map +1 -0
- package/dist/families/rvc.d.ts +40 -0
- package/dist/families/rvc.js +83 -0
- package/dist/families/rvc.js.map +1 -0
- package/dist/families/switch.d.ts +19 -0
- package/dist/families/switch.js +94 -0
- package/dist/families/switch.js.map +1 -0
- package/dist/importers/actions.d.ts +19 -0
- package/dist/importers/actions.js +98 -0
- package/dist/importers/actions.js.map +1 -0
- package/dist/importers/ha/areas.d.ts +6 -0
- package/dist/importers/ha/areas.js +279 -0
- package/dist/importers/ha/areas.js.map +1 -0
- package/dist/importers/ha/generate.d.ts +51 -0
- package/dist/importers/ha/generate.js +1376 -0
- package/dist/importers/ha/generate.js.map +1 -0
- package/dist/importers/ha/index.d.ts +6 -0
- package/dist/importers/ha/index.js +7 -0
- package/dist/importers/ha/index.js.map +1 -0
- package/dist/importers/ha/source.d.ts +36 -0
- package/dist/importers/ha/source.js +95 -0
- package/dist/importers/ha/source.js.map +1 -0
- package/dist/importers/ha/sync.d.ts +29 -0
- package/dist/importers/ha/sync.js +132 -0
- package/dist/importers/ha/sync.js.map +1 -0
- package/dist/importers/ha/templates.d.ts +18 -0
- package/dist/importers/ha/templates.js +285 -0
- package/dist/importers/ha/templates.js.map +1 -0
- package/dist/importers/ha/types.d.ts +78 -0
- package/dist/importers/ha/types.js +479 -0
- package/dist/importers/ha/types.js.map +1 -0
- package/dist/importers/index.d.ts +5 -0
- package/dist/importers/index.js +8 -0
- package/dist/importers/index.js.map +1 -0
- package/dist/importers/patch.d.ts +50 -0
- package/dist/importers/patch.js +224 -0
- package/dist/importers/patch.js.map +1 -0
- package/dist/importers/sync.d.ts +112 -0
- package/dist/importers/sync.js +220 -0
- package/dist/importers/sync.js.map +1 -0
- package/dist/importers/twins.d.ts +10 -0
- package/dist/importers/twins.js +34 -0
- package/dist/importers/twins.js.map +1 -0
- package/dist/importers/z2m/generate.d.ts +81 -0
- package/dist/importers/z2m/generate.js +1171 -0
- package/dist/importers/z2m/generate.js.map +1 -0
- package/dist/importers/z2m/index.d.ts +5 -0
- package/dist/importers/z2m/index.js +6 -0
- package/dist/importers/z2m/index.js.map +1 -0
- package/dist/importers/z2m/source.d.ts +18 -0
- package/dist/importers/z2m/source.js +46 -0
- package/dist/importers/z2m/source.js.map +1 -0
- package/dist/importers/z2m/sync.d.ts +29 -0
- package/dist/importers/z2m/sync.js +92 -0
- package/dist/importers/z2m/sync.js.map +1 -0
- package/dist/importers/z2m/types.d.ts +72 -0
- package/dist/importers/z2m/types.js +46 -0
- package/dist/importers/z2m/types.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/log.d.ts +17 -0
- package/dist/log.js +54 -0
- package/dist/log.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +202 -0
- package/dist/main.js.map +1 -0
- package/dist/matter/bridge.d.ts +113 -0
- package/dist/matter/bridge.js +467 -0
- package/dist/matter/bridge.js.map +1 -0
- package/dist/matter/check.d.ts +11 -0
- package/dist/matter/check.js +116 -0
- package/dist/matter/check.js.map +1 -0
- package/dist/matter/cluster-defaults.d.ts +6 -0
- package/dist/matter/cluster-defaults.js +63 -0
- package/dist/matter/cluster-defaults.js.map +1 -0
- package/dist/matter/commissioning.d.ts +21 -0
- package/dist/matter/commissioning.js +88 -0
- package/dist/matter/commissioning.js.map +1 -0
- package/dist/matter/device-types.d.ts +44 -0
- package/dist/matter/device-types.js +230 -0
- package/dist/matter/device-types.js.map +1 -0
- package/dist/matter/ids.d.ts +31 -0
- package/dist/matter/ids.js +83 -0
- package/dist/matter/ids.js.map +1 -0
- package/dist/matter/index.d.ts +7 -0
- package/dist/matter/index.js +8 -0
- package/dist/matter/index.js.map +1 -0
- package/dist/matter/node-manager.d.ts +39 -0
- package/dist/matter/node-manager.js +161 -0
- package/dist/matter/node-manager.js.map +1 -0
- package/dist/matter/shards.d.ts +26 -0
- package/dist/matter/shards.js +93 -0
- package/dist/matter/shards.js.map +1 -0
- package/dist/model/attribute.d.ts +18 -0
- package/dist/model/attribute.js +28 -0
- package/dist/model/attribute.js.map +1 -0
- package/dist/model/catalog.d.ts +79 -0
- package/dist/model/catalog.js +223 -0
- package/dist/model/catalog.js.map +1 -0
- package/dist/model/index.d.ts +7 -0
- package/dist/model/index.js +8 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/migrate.d.ts +4 -0
- package/dist/model/migrate.js +39 -0
- package/dist/model/migrate.js.map +1 -0
- package/dist/model/options.d.ts +102 -0
- package/dist/model/options.js +88 -0
- package/dist/model/options.js.map +1 -0
- package/dist/model/presets.d.ts +37 -0
- package/dist/model/presets.js +105 -0
- package/dist/model/presets.js.map +1 -0
- package/dist/model/schema.d.ts +1747 -0
- package/dist/model/schema.js +243 -0
- package/dist/model/schema.js.map +1 -0
- package/dist/model/validate.d.ts +21 -0
- package/dist/model/validate.js +484 -0
- package/dist/model/validate.js.map +1 -0
- package/dist/mqtt/client.d.ts +38 -0
- package/dist/mqtt/client.js +94 -0
- package/dist/mqtt/client.js.map +1 -0
- package/dist/mqtt/index.d.ts +2 -0
- package/dist/mqtt/index.js +3 -0
- package/dist/mqtt/index.js.map +1 -0
- package/dist/mqtt/topic-cache.d.ts +20 -0
- package/dist/mqtt/topic-cache.js +58 -0
- package/dist/mqtt/topic-cache.js.map +1 -0
- package/dist/server/auth.d.ts +59 -0
- package/dist/server/auth.js +185 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/catalog.d.ts +52 -0
- package/dist/server/catalog.js +96 -0
- package/dist/server/catalog.js.map +1 -0
- package/dist/server/compact.d.ts +3 -0
- package/dist/server/compact.js +105 -0
- package/dist/server/compact.js.map +1 -0
- package/dist/server/config-store.d.ts +36 -0
- package/dist/server/config-store.js +155 -0
- package/dist/server/config-store.js.map +1 -0
- package/dist/server/events.d.ts +50 -0
- package/dist/server/events.js +71 -0
- package/dist/server/events.js.map +1 -0
- package/dist/server/http.d.ts +27 -0
- package/dist/server/http.js +168 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/importers.d.ts +40 -0
- package/dist/server/importers.js +75 -0
- package/dist/server/importers.js.map +1 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +8 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/log-buffer.d.ts +22 -0
- package/dist/server/log-buffer.js +55 -0
- package/dist/server/log-buffer.js.map +1 -0
- package/dist/server/presets.d.ts +17 -0
- package/dist/server/presets.js +55 -0
- package/dist/server/presets.js.map +1 -0
- package/dist/server/preview.d.ts +19 -0
- package/dist/server/preview.js +121 -0
- package/dist/server/preview.js.map +1 -0
- package/dist/server/server.d.ts +107 -0
- package/dist/server/server.js +810 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/update.d.ts +60 -0
- package/dist/server/update.js +191 -0
- package/dist/server/update.js.map +1 -0
- package/docs/api.md +128 -0
- package/docs/architecture.md +121 -0
- package/docs/config.md +538 -0
- package/docs/importers.md +241 -0
- package/example/mqtt2matter.json +276 -0
- package/package.json +90 -4
- package/presets/mqtt-smarthome/button.json +47 -0
- package/presets/mqtt-smarthome/contact.json +37 -0
- package/presets/mqtt-smarthome/cover.json +50 -0
- package/presets/mqtt-smarthome/dimmer.json +57 -0
- package/presets/mqtt-smarthome/humidity.json +38 -0
- package/presets/mqtt-smarthome/light.json +47 -0
- package/presets/mqtt-smarthome/occupancy.json +46 -0
- package/presets/mqtt-smarthome/switch.json +47 -0
- package/presets/mqtt-smarthome/temperature.json +38 -0
- package/presets/openbeken/color-light.json +64 -0
- package/presets/openbeken/ct-light.json +51 -0
- package/presets/openbeken/dimmer.json +47 -0
- package/presets/openbeken/humidity.json +37 -0
- package/presets/openbeken/relay.json +40 -0
- package/presets/openbeken/temperature.json +41 -0
- package/presets/shelly-gen1/dimmer.json +48 -0
- package/presets/shelly-gen1/door-window.json +43 -0
- package/presets/shelly-gen1/ht.json +43 -0
- package/presets/shelly-gen1/relay-pm.json +60 -0
- package/presets/shelly-gen1/relay.json +36 -0
- package/presets/shelly-gen1/roller.json +52 -0
- package/presets/shelly-gen2/cover.json +68 -0
- package/presets/shelly-gen2/dimmer.json +61 -0
- package/presets/shelly-gen2/ht.json +47 -0
- package/presets/shelly-gen2/i4.json +82 -0
- package/presets/shelly-gen2/switch-pm.json +101 -0
- package/presets/shelly-gen2/switch.json +47 -0
- package/presets/tasmota/climate.json +52 -0
- package/presets/tasmota/color-light.json +63 -0
- package/presets/tasmota/ct-light.json +50 -0
- package/presets/tasmota/dimmer.json +45 -0
- package/presets/tasmota/relay.json +39 -0
- package/presets/tasmota/shutter.json +46 -0
- package/presets/tasmota/temperature-humidity.json +42 -0
- package/presets/tasmota/temperature.json +32 -0
- package/presets/valetudo/vacuum.json +103 -0
- package/presets/wled/dimmer.json +46 -0
- package/presets/wled/light.json +59 -0
- package/ui/dist/assets/index-BDtT6bdH.js +10 -0
- package/ui/dist/assets/index-CHiG-aoU.css +1 -0
- package/ui/dist/index.html +18 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# Importers
|
|
2
|
+
|
|
3
|
+
An importer turns a foreign description into ordinary `devices` entries of the manual model
|
|
4
|
+
([config.md](config.md)) with `source: {kind, key, version, raw}`, so the user can edit the result like any
|
|
5
|
+
other device. The imported **baseline** and the user's **edits** are kept apart: on a re-sync the baseline is
|
|
6
|
+
regenerated from the new description, the edits are reapplied, and an edit on a path the new baseline changed
|
|
7
|
+
too is a **conflict** — reported, never silently resolved (the edit wins; the report says what the importer
|
|
8
|
+
would have written). A device whose description disappears is marked **orphaned** (`source.orphaned: true`) and
|
|
9
|
+
never removed by the importer; removal is the user's click.
|
|
10
|
+
|
|
11
|
+
Importers depend on `model/` and `mqtt/` only ([architecture.md](architecture.md)); the runtime does not know
|
|
12
|
+
where a device came from. They are plain functions over a `devices` record as it stands in the file (no
|
|
13
|
+
defaults filled in: `DeviceInput`, `DevicesInput` from `model/schema.ts`), so the command line and the server
|
|
14
|
+
for the UI call the same code. The report (`diff`), the adoption (`adopt`), the re-sync, orphaning and
|
|
15
|
+
restoring are one generic implementation (`src/importers/sync.ts`); an importer brings its discovery, its
|
|
16
|
+
`source.raw` format and the generator that turns a raw description into a baseline.
|
|
17
|
+
|
|
18
|
+
## Baseline + patch (`src/importers/patch.ts`)
|
|
19
|
+
|
|
20
|
+
Generic, nothing in it knows zigbee2mqtt. A device is diffed as a **keyed tree**: endpoints by their id
|
|
21
|
+
(`main` for the first), mappings by their target (`attribute:OnOff.onOff`, `invoke:WindowCovering.stopMotion`,
|
|
22
|
+
`event:Switch`; a repeated target gets `#2`, `#3`), everything else by its key; `source` is left out. The
|
|
23
|
+
user's edits are `diffTrees(toTree(oldBaseline), toTree(current))`: sets of changed or added leaves and
|
|
24
|
+
subtrees, deletes of removed ones. `applyOps(edits, oldBaseline, newBaseline)` reapplies them:
|
|
25
|
+
|
|
26
|
+
| The edit | The new baseline at that path | Result |
|
|
27
|
+
| ------------------- | ----------------------------- | ----------------------------------------------- |
|
|
28
|
+
| set | unchanged | applied |
|
|
29
|
+
| set | changed too | applied, **conflict** (`user`, `before`, `now`) |
|
|
30
|
+
| set below something | that no longer exists | not applied, **conflict** (`applied: false`) |
|
|
31
|
+
| delete | anything | stays deleted (what the user removed is theirs) |
|
|
32
|
+
|
|
33
|
+
`resync(oldBaseline, current, newBaseline)` does the whole round and returns the device, the edits and the
|
|
34
|
+
conflicts; endpoints and mappings keep the new baseline's order, the user's additions follow.
|
|
35
|
+
|
|
36
|
+
## Zigbee2MQTT (`src/importers/z2m/`)
|
|
37
|
+
|
|
38
|
+
Reads the retained `<base>/bridge/devices` and `<base>/bridge/groups` (zigbee2mqtt 1.x and 2.x). Keys:
|
|
39
|
+
`z2m:<ieee address>` for devices, `z2m:group:<id>` for groups. Topics are zigbee2mqtt's: `<base>/<friendly
|
|
40
|
+
name>` (state), `…/set`, `…/get`, `…/availability`.
|
|
41
|
+
|
|
42
|
+
### What becomes what
|
|
43
|
+
|
|
44
|
+
Per zigbee2mqtt endpoint (`''` = the device itself, `l1` … = child endpoints with that id) the exposes decide
|
|
45
|
+
the device types and mappings of one Matter endpoint; the device's own endpoint comes first, the children after
|
|
46
|
+
it, and a child that shares its device type with a sibling carries a number tag in its Descriptor (`features:
|
|
47
|
+
{Descriptor: ["TagList"]}`, `attributes.Descriptor.tagList`) as Matter's disambiguation rule asks. `access`
|
|
48
|
+
bits decide the halves: 1 → status, 2 → command, 4 → one `get` per endpoint on its first gettable feature.
|
|
49
|
+
|
|
50
|
+
| Expose | Device type, mappings |
|
|
51
|
+
| ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
52
|
+
| `light` | `OnOffLight` / `DimmableLight` / `ColorTemperatureLight` / `ExtendedColorLight` (xy or hs); `OnOff.onOff` (`state`), `LevelControl.currentLevel` (`brightness`, identity 1–254), `ColorControl.colorTemperatureMireds` (`color_temp`, its range → `options.light.minMireds/maxMireds`), `ColorControl.colorXy` on `color` (hs becomes the `HueSaturation` feature; hs alone → `colorHs`), `ColorControl.colorMode` from `color_mode` when colour and colour temperature meet; `coalesce: 50` |
|
|
53
|
+
| `switch` | `OnOffPlugInUnit`, `OnOff.onOff` |
|
|
54
|
+
| `cover` | `WindowCovering`; `position` → `currentPositionLiftPercent100ths` (status) / `targetPositionLiftPercent100ths` (command), both `scale {from: [0,100], to: [10000,0]}` (zigbee2mqtt counts 100 = open); `tilt` likewise; `state` → `stopMotion` (`STOP`), and for a cover without `position` also `upOrOpen` / `downOrClose` plus `motion` from `state`; a `moving` / `motor_state` enum → `motion`; IKEA E1757/E1926 get `options.cover.echoFilter` |
|
|
55
|
+
| `lock` (state `state`) | `DoorLock.lockState` from `lock_state` (else `state`), command `LOCK` / `UNLOCK`; a `child_lock` is no lock |
|
|
56
|
+
| `climate` | `Thermostat`: `localTemperature`, `occupiedHeatingSetpoint` / `occupiedCoolingSetpoint` (`current_…` or `occupied_…`, their limits → `options.climate`), `systemMode` by name, `thermostatRunningState`; `coalesce: 50` |
|
|
57
|
+
| `fan` | `Fan`: `state` → `OnOff.onOff`; `mode` by name → `FanControl.fanMode`; numeric modes (`1` … `n`) → `percentSetting` through the mode with a template back, and to `fanMode` in thirds both ways (`Low`/`Medium`/`High` write the top step of their third, every step reads back as its third); a mode `auto` → the `Auto` feature, `percentSetting` `null` while in auto; `speed` → `percentSetting` scaled |
|
|
58
|
+
| `temperature`, `humidity`, `pressure` | `TemperatureSensor` (°C / °F), `HumiditySensor`, `PressureSensor` (hPa, kPa) |
|
|
59
|
+
| `illuminance_lux`, `illuminance` (lx) | `LightSensor` (once per endpoint) |
|
|
60
|
+
| `battery`, `voltage` (mV/V), `battery_low` | `PowerSource` on the device's endpoint: `batPercentRemaining`, `batVoltage`, `batChargeLevel` |
|
|
61
|
+
| `co2`, `co`, `voc` (ppb/ppm), `pm1/25/10`, `formaldehyde` (ppb/ppm), `air_quality` | `AirQualitySensor` with the concentration clusters and `AirQuality.airQuality` |
|
|
62
|
+
| `contact`, `occupancy` / `presence`, `water_leak`, `rain`, `smoke`, `carbon_monoxide` | `ContactSensor`, `OccupancySensor`, `WaterLeakDetector`, `RainSensor`, `SmokeCoAlarm` (`smokeState` / `coState`) |
|
|
63
|
+
| `action` | one `GenericSwitch` per button: `single`/`double`/`hold`/`release` (one button), `single_l1` (a button per suffix), `brightness_up_click` (per prefix), bare names (`on`, `off`, `open`, `shake`, `tap` …) as single-press buttons; moves, steps, stops, scene recalls, rotations are left out; `options.switch.multiPressMax` from the kinds |
|
|
64
|
+
|
|
65
|
+
Everything else (`linkquality`, `power`/`energy`/`current` — electrical measurement comes later —, settings,
|
|
66
|
+
diagnostics, VOC in µg/m³, soil moisture, vibration as a state) is listed under `unmapped` so the UI can show
|
|
67
|
+
it. Every device gets `availability: {topic: "<base>/<name>/availability", template}` for both of
|
|
68
|
+
zigbee2mqtt's payload forms. The device's `name` is the friendly name (cut to 32 characters), `vendor` and
|
|
69
|
+
`model` the definition's, `serial` the IEEE address.
|
|
70
|
+
|
|
71
|
+
**Groups** become one endpoint with the union of the members' features: a light group when any member is a
|
|
72
|
+
light (brightness, colour temperature range, xy, hs from all), a switch group, or a cover group when every
|
|
73
|
+
member is a cover; empty groups, and groups of other members without scenes, are unsupported. Groups have no
|
|
74
|
+
`/get` and no availability.
|
|
75
|
+
|
|
76
|
+
**Scenes** stored on a device (`endpoints.<n>.scenes`) or a group (`scenes`) become one child endpoint each,
|
|
77
|
+
`scene_<id>`: an `OnOffPlugInUnit` with `options.onOff.momentary: 1000` whose on publishes
|
|
78
|
+
`{"scene_recall": <id>}` to the set topic and falls back to off a second later; children sharing the type carry
|
|
79
|
+
the scene's name as their tag label. A group of other members (thermostats) is adopted for its scenes alone.
|
|
80
|
+
Matter's own Scenes Management cluster is not used: its scenes are stored by a controller per fabric, and none
|
|
81
|
+
of the common controllers is known to offer them for a bridged device.
|
|
82
|
+
|
|
83
|
+
### `source`
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
"source": {"kind": "z2m", "key": "0x00158d000945f2b1", "version": "1.3f2c…", "raw": {"kind": "device", "base_topic": "zigbee2mqtt", "ieee_address": "…", "friendly_name": "…", "type": "EndDevice", "power_source": "Battery", "definition": {"vendor": "…", "model": "…", "exposes": [ … ]}}}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`raw` is the description trimmed to what regenerates the baseline (a group's `raw` carries the computed
|
|
90
|
+
union instead of the members' descriptions); `version` is `<generator version>.<hash of raw>`. A device
|
|
91
|
+
without a usable `raw` is kept as it is on a re-sync and only its `source` refreshed.
|
|
92
|
+
|
|
93
|
+
### The API (`src/importers/z2m/sync.ts`, `source.ts`)
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import {z2m} from 'mqtt2matter'; // src/importers/index.ts
|
|
97
|
+
|
|
98
|
+
const source = new z2m.Z2mSource('zigbee2mqtt'); // .topics to subscribe; .handle(topic, payload); .load(cache)
|
|
99
|
+
const discovery = source.discover(); // or z2m.discover({devices, groups, baseTopic})
|
|
100
|
+
// Discovery {baseTopic, items: Discovered[], sawDevices, sawGroups}
|
|
101
|
+
// Discovered {key, kind: 'device'|'group', name, vendor?, model?, description?, supported, reason?, baseline?, unmapped}
|
|
102
|
+
|
|
103
|
+
const report = z2m.diff(discovery, config.devices); // SyncEntry[]: what adopting would do, nothing touched
|
|
104
|
+
const {devices, report} = z2m.adopt(config.devices, discovery, {keys?, resync?, orphan?});
|
|
105
|
+
// SyncEntry {key, kind, name, status, device?, conflicts: Conflict[], edits, unmapped, notes}
|
|
106
|
+
// status: 'new' | 'unchanged' | 'updated' | 'orphaned' | 'restored' | 'invalid' | 'unsupported' | 'covered'
|
|
107
|
+
// covered?: the key that covers a `covered` entry; twins?: configured devices for the same physical device
|
|
108
|
+
// adopt(devices, discovery, {keys?, resync?, orphan?, force?, replace?}) — `force` takes the covered ones in `keys`
|
|
109
|
+
z2m.orphaned(devices); // the keys marked orphaned
|
|
110
|
+
z2m.edits(device); // the user's edits against the baseline
|
|
111
|
+
z2m.generate(raw); // the baseline for a stored `source.raw`
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`adopt` keeps the record's order, re-syncs every `z2m` device (`resync: false` keeps them as they are), adds
|
|
115
|
+
the selected new keys (default: every supported one), marks the missing ones orphaned (`orphan: false` does
|
|
116
|
+
not) and restores an orphaned one that is back. A merge that does not validate against the schema leaves the
|
|
117
|
+
device as it was (`invalid`, with the messages in `notes`). Groups are evaluable only together with the devices
|
|
118
|
+
payload; without it they count as not seen. Manual devices are never touched.
|
|
119
|
+
|
|
120
|
+
The server runs `adopt` on every retained `bridge/devices` / `bridge/groups` it receives and shows the
|
|
121
|
+
report in the Adopt view; the command line does the same without the UI:
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
mqtt2matter --import-z2m [config.json] [--base-topic zigbee2mqtt] [--dry-run] [--no-groups] [--timeout 15]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
It connects to the broker of the configuration (file and environment), reads the two retained topics, adopts
|
|
128
|
+
everything supported that is not in the file yet, re-syncs the rest, writes the file back (other keys
|
|
129
|
+
untouched) and prints one line per device plus the static validation; `--dry-run` prints without writing.
|
|
130
|
+
Run it again after pairing, renaming or removing devices in zigbee2mqtt; the normal start afterwards logs the
|
|
131
|
+
pairing code.
|
|
132
|
+
|
|
133
|
+
## Home Assistant MQTT discovery (`src/importers/ha/`)
|
|
134
|
+
|
|
135
|
+
Reads every retained `<prefix>/<component>/[<node_id>/]<object_id>/config` (the per-entity form) and
|
|
136
|
+
`<prefix>/device/[<node_id>/]<object_id>/config` (the device-based form with `components`, each with a
|
|
137
|
+
`platform`), prefix `homeassistant` by default. The 289 abbreviations of Home Assistant's `abbreviations.py`
|
|
138
|
+
(`stat_t`, `cmd_t`, `val_tpl`, `dev`, `cmps`, …) are expanded once, `~` is substituted at the start or end of
|
|
139
|
+
every `*_topic`, a component inherits the shared fields of a device-based payload (`device`, `origin`,
|
|
140
|
+
`availability`, `state_topic`, `command_topic`, …), and an empty retained payload removes the entity (a
|
|
141
|
+
component reduced to its `platform` is removed too). Topics with more than two levels between component and
|
|
142
|
+
`config` are no discovery topics — Home Assistant ignores them as well.
|
|
143
|
+
|
|
144
|
+
Keys: `ha:<first identifier or connection>` of the `device` block, cleaned to the key alphabet and hashed
|
|
145
|
+
when longer than 64 characters. **One Matter device per Home Assistant device**: the primary entity (a
|
|
146
|
+
`light`, `cover`, `climate`, `lock`, `fan`, `valve`, else a `switch`, in that order) is the node's own
|
|
147
|
+
endpoint, every other entity a child endpoint named after its object id; children sharing a device type with
|
|
148
|
+
a sibling carry a number tag as the zigbee2mqtt importer's do. An entity without a `device` block is listed as
|
|
149
|
+
unsupported (Home Assistant itself needs `device` and `unique_id` to group entities). A `suggested_area`
|
|
150
|
+
travels in the report (`area`) and, when the name matches one of Matter's Common Area tags (English, or
|
|
151
|
+
German through a synonym table — `Küche`, `Wohnzimmer`, `Bad`, …), becomes a `Descriptor` tag of namespace
|
|
152
|
+
`0x10` on the device's own endpoint.
|
|
153
|
+
|
|
154
|
+
### One device, two descriptions
|
|
155
|
+
|
|
156
|
+
zigbee2mqtt describes its devices natively and, with its Home Assistant integration on, a second time through
|
|
157
|
+
discovery; adopting both would put the same device twice on the bridge. A discovered HA device is reported
|
|
158
|
+
with `native: "z2m:<ieee>"` (or `z2m:group:<id>`) when its identifiers are zigbee2mqtt's own
|
|
159
|
+
(`zigbee2mqtt_<ieee>`, `zigbee2mqtt_<n>_<group id>` — with or without `origin`, which older versions do not
|
|
160
|
+
send), or when a Zigbee IEEE address is among its connections (`["zigbee", …]`, `["ieee", …]`) or its
|
|
161
|
+
identifiers (`0x…`). The shared sync makes it a rule for both importers, the API and the command line alike:
|
|
162
|
+
|
|
163
|
+
- an HA entry with a native key is `covered` (by that key): the native description is preferred;
|
|
164
|
+
- a zigbee2mqtt entry whose HA twin is already adopted (and neither disabled nor orphaned) is `covered` by the
|
|
165
|
+
twin, `twins: [<ha key>]`;
|
|
166
|
+
- `adopt` never takes a `covered` entry, not even when it is named in `keys`, unless the call says `force`;
|
|
167
|
+
with `replace` as well, the twins are disabled (`enabled: false`) — kept in the file, removed by a click;
|
|
168
|
+
- an adopted device whose twin is adopted too is reported with `twins` and a note.
|
|
169
|
+
|
|
170
|
+
### What becomes what
|
|
171
|
+
|
|
172
|
+
| Component (keys) | Device type, mappings |
|
|
173
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
174
|
+
| `switch` (`state_on/off`, `payload_on/off`, `value_template`, `command_template`) | `OnOffPlugInUnit` (the user switches it to `OnOffLight` / `OnOffMountedSwitch` in the editor); `OnOff.onOff` with `map` / `format` |
|
|
175
|
+
| `light`, default schema (`brightness_*`, `brightness_scale`, `color_temp_*`, `color_temp_kelvin`, `min/max_mireds`, `hs_*`, `xy_*`, `rgb_*`, `on_command_type`, `color_mode_state_topic`) | `OnOffLight` / `DimmableLight` / `ColorTemperatureLight` / `ExtendedColorLight` by the topics present; brightness `scale [1, brightness_scale] → [1, 254]`; colour temperature in mireds or `unit: kelvin`; `colorHs` / `colorXy` / `colorRgb` as `h,s` / `x,y` / `r,g,b` text with the command templates `{{ hue }},{{ saturation }}`, `{{ x }},{{ y }}`, `{{ red }},{{ green }},{{ blue }}` unless the config has its own; `options.light.onCommandType`; `colorMode` when colour and colour temperature meet; `rgbw`, `rgbww`, `white`, `effect` listed |
|
|
176
|
+
| `light`, json schema (`supported_color_modes`, `brightness`, one JSON state and command) | the same types; `extract` / `wrap` on `state`, `brightness`, `color_temp`, `color` (xy as an object both ways; hs and rgb back as `{"state": "ON", "color": {…}}` templates), `color_mode`; `coalesce: 50` |
|
|
177
|
+
| `light`, template schema (`command_on/off_template`, `state_template`, `brightness_template`, `color_temp_template`) | on/off as `{% if value %}<on>{% else %}<off>{% endif %}`, brightness and colour temperature through the on template; colour through separate templates is listed |
|
|
178
|
+
| `cover` (`position_*`, `set_position_*`, `position_open/closed`, `state_*`, `payload_open/close/stop`, `tilt_*`) | `WindowCovering`: position `scale [closed, open] → [10000, 0]`; `set_position_template` with `{% set position = open %}` in front so Home Assistant's `position` (100 = open) keeps its meaning; `motion` from the state topic (opening/closing/stopped; open/closed too for a cover without position); `upOrOpen` / `downOrClose` for a cover without `set_position_topic`, `stopMotion` always; tilt likewise with `tilt_closed/opened_value` |
|
|
179
|
+
| `climate` (`modes`, `mode_*`, `temperature_*`, `temperature_low/high_*`, `current_temperature_*`, `action_*`, `min/max_temp`, `temperature_unit`, `current_humidity_*`) | `Thermostat`: `localTemperature`, `occupiedHeatingSetpoint` / `occupiedCoolingSetpoint` by the modes (both on one `temperature_*` topic unless low/high topics exist), limits → `options.climate`, `systemMode` by name with `{% set value = … %}` giving a `mode_command_template` Home Assistant's `value`, `thermostatRunningState` from `action_topic`; `current_humidity_topic` → a `HumiditySensor` child; fan, swing, preset modes and target humidity listed; `coalesce: 50` |
|
|
180
|
+
| `lock` (`payload_lock/unlock`, `state_locked/unlocked/jammed`) | `DoorLock.lockState` (`Locked`, `Unlocked`, `NotFullyLocked`) |
|
|
181
|
+
| `fan` (`percentage_*`, `speed_range_max`, `preset_modes`) | `Fan`: `OnOff.onOff`, `percentSetting` `scale [0, speed_range_max] → [0, 100]`, `fanMode` from the preset modes named `off` / `low` / `medium` / `high` / `auto` (`auto` adds the `Auto` feature; the percentage's `None` is `null` while in auto); oscillation and direction listed; `coalesce: 50` |
|
|
182
|
+
| `valve` (`state_open/opening/closed/closing`, `payload_open/close`) | `WaterValve`: `ValveConfigurationAndControl.currentState`, `open` / `close` |
|
|
183
|
+
| `binary_sensor` by `device_class` | door / window / opening / garage_door → `ContactSensor` (inverted: Home Assistant's on is the open contact); motion / occupancy / presence / moving → `OccupancySensor`; moisture → `WaterLeakDetector`; cold → `WaterFreezeDetector`; smoke, carbon_monoxide → `SmokeCoAlarm`; battery → `PowerSource.batChargeLevel`, battery_charging → `batChargeState` (the `Rechargeable` feature); every other class and no class: listed |
|
|
184
|
+
| `sensor` by `device_class` and `unit_of_measurement` | temperature (°C, °F) → `TemperatureSensor`; humidity → `HumiditySensor`; pressure / atmospheric_pressure (hPa, mbar, kPa, Pa, bar, psi, inHg, mmHg) → `PressureSensor`; illuminance (lx) → `LightSensor`; battery (%) → `PowerSource.batPercentRemaining`; carbon_dioxide, carbon_monoxide (ppm), pm1 / pm25 / pm10 (µg/m³), volatile_organic_compounds(_parts), nitrogen_dioxide, ozone, formaldehyde (ppb; ppm × 1000) → `AirQualitySensor`; aqi → `AirQuality.airQuality` through the US bands; volume_flow_rate (m³/h) → `FlowSensor`; °C / °F / lx without a class count as temperature / illuminance; everything else listed (the electrical classes until electrical measurement exists) |
|
|
185
|
+
| `event` (`event_types`, payload `{"event_type": …}`) | one `GenericSwitch` per button the event types name (`single` / `double` / `long` / `single_push` / `double_press` …, the shared press-kind table), `extract: event_type` unless a `value_template` renders it |
|
|
186
|
+
| `device_trigger` / `device_automation` (`topic`, `type`, `subtype`, `payload`) | accumulated per device: one button per `subtype` (Tasmota's `button_1`), the kind from the `type` (`button_short_press`, `button_double_press`, `button_long_press`, …) or, for zigbee2mqtt's `type: action`, from the subtype as the zigbee2mqtt importer reads actions; continuous actions listed |
|
|
187
|
+
| `scene` (`command_topic`, `payload_on`) | a child `OnOffPlugInUnit` with `options.onOff.momentary: 1000`: on publishes `payload_on` (default `ON`), off nothing; tagged with the scene's name |
|
|
188
|
+
| `button`, `number`, `select`, `text`, `update`, `device_tracker`, `notify`, `image`, … | listed as unmapped (a Matter button emits events), never dropped silently |
|
|
189
|
+
|
|
190
|
+
Entities with an `entity_category` (`config`, `diagnostic`) or `enabled_by_default: false` are listed, not
|
|
191
|
+
mapped — settings and metrics are not the device's function — except battery sensors, which Matter has a place
|
|
192
|
+
for. Every status half of an entity with `expire_after` gets `expire`; `optimistic: true` and `retain: true`
|
|
193
|
+
are carried into the command half. The device's availability is the primary entity's (`availability_topic`
|
|
194
|
+
with `payload_available` / `payload_not_available`, or the `availability` list with `availability_mode`),
|
|
195
|
+
else the first entity's that has one. `name`, `vendor`, `model` and `serial` come from the device block,
|
|
196
|
+
merged over every entity (each repeats it, often only with its identifiers).
|
|
197
|
+
|
|
198
|
+
**Templates** go to the payload engine when it can run them: the importer parses every `*_template` with the
|
|
199
|
+
same library and checks the filters, tests, functions and free names against what the engine provides
|
|
200
|
+
([config.md](config.md), "Templates"; `src/importers/ha/templates.ts`). A template it cannot run — `states()`,
|
|
201
|
+
`now()`, `this`, the time and regex helpers, `int(base=16)`, a dictionary with integer keys, macros — leaves
|
|
202
|
+
that half of the mapping out and is listed under `unmapped` with the template text, so the user sees what to
|
|
203
|
+
write by hand. Where Home Assistant's command template sees a value the engine names differently, a `{% set …
|
|
204
|
+
%}` prelude gives it Home Assistant's meaning: `value` is `ON` / `OFF` (`payload_on` / `payload_off`) for a
|
|
205
|
+
switch, the mode string for a climate or a fan, `LOCK` / `UNLOCK` for a lock; `position` and `tilt_position`
|
|
206
|
+
are the open-percentage for a cover. A `value_template` on a `light` is read as its `state_value_template`
|
|
207
|
+
(what Tasmota sends).
|
|
208
|
+
|
|
209
|
+
### `source`
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
"source": {"kind": "ha-discovery", "key": "aa0000000002", "version": "1.9f0c…", "raw": {"kind": "ha", "prefix": "homeassistant", "identity": "aa0000000002", "device": {"identifiers": "aa0000000002", "name": "…", "manufacturer": "Espressif", "model": "esp01_1m", "suggested_area": "Küche"}, "entities": [{"id": "relay", "topic": "homeassistant/switch/usb-relay-02/relay/config", "component": "switch", "config": { … }}]}}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
`raw` holds the expanded configs trimmed of what the generator does not read (`icon`, `entity_picture`,
|
|
216
|
+
`json_attributes_*`, `configuration_url`, …), in a stable order; `version` is `<generator version>.<hash of raw>`.
|
|
217
|
+
|
|
218
|
+
### The API (`src/importers/ha/sync.ts`, `source.ts`)
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
import {ha} from 'mqtt2matter';
|
|
222
|
+
|
|
223
|
+
const source = new ha.HaSource('homeassistant'); // .topics = ['homeassistant/#']; .handle(topic, payload); .load(cache)
|
|
224
|
+
const discovery = source.discover(); // or ha.discover({entities, prefix, seen})
|
|
225
|
+
// Discovery {prefix, items: Discovered[], seen}
|
|
226
|
+
// Discovered {key, kind: 'device', name, vendor?, model?, area?, native?, supported, reason?, baseline?, unmapped}
|
|
227
|
+
|
|
228
|
+
const report = ha.diff(discovery, config.devices); // SyncEntry[] as the zigbee2mqtt importer's, plus `area` and `native`
|
|
229
|
+
const {devices, report} = ha.adopt(config.devices, discovery, {keys?, resync?, orphan?});
|
|
230
|
+
ha.orphaned(devices);
|
|
231
|
+
ha.edits(device);
|
|
232
|
+
ha.generate(raw);
|
|
233
|
+
ha.checkTemplate(source, 'status' | 'command'); // {ok} | {ok: false, reason}
|
|
234
|
+
ha.areaTag('Wohnzimmer'); // {name: 'LivingRoom', id: 52} | undefined
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
`seen` is true once any discovery message (or removal) was handled: before that nothing is orphaned. The
|
|
238
|
+
server subscribes `<prefix>/#` when `importers.ha.enabled` is set ([config.md](config.md)), feeds the
|
|
239
|
+
importer every message and shows the report on the Adopt page; a re-sync regenerates the baseline from the
|
|
240
|
+
retained configs and carries the user's edits over like the zigbee2mqtt importer does. There is no command
|
|
241
|
+
line for it; the UI is the way to adopt.
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mqtt": {
|
|
3
|
+
"url": "mqtt://localhost:1883"
|
|
4
|
+
},
|
|
5
|
+
"storage": "./data",
|
|
6
|
+
"log": {
|
|
7
|
+
"level": "info",
|
|
8
|
+
"matter": "warn"
|
|
9
|
+
},
|
|
10
|
+
"bridges": {
|
|
11
|
+
"default": {
|
|
12
|
+
"port": 5540
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"devices": {
|
|
16
|
+
"living-room-plug": {
|
|
17
|
+
"name": "Living room plug",
|
|
18
|
+
"vendor": "Tasmota",
|
|
19
|
+
"model": "Sonoff S26",
|
|
20
|
+
"availability": {"topic": "tele/s26/LWT", "online": "Online", "offline": "Offline"},
|
|
21
|
+
"endpoints": [
|
|
22
|
+
{
|
|
23
|
+
"deviceTypes": ["OnOffPlugInUnit"],
|
|
24
|
+
"mappings": [
|
|
25
|
+
{
|
|
26
|
+
"attribute": "OnOff.onOff",
|
|
27
|
+
"status": {"topic": "stat/s26/RESULT", "extract": "$.POWER", "map": {"ON": true, "OFF": false}},
|
|
28
|
+
"command": {"topic": "cmnd/s26/POWER", "format": {"true": "ON", "false": "OFF"}}
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"floor-lamp": {
|
|
35
|
+
"name": "Floor lamp",
|
|
36
|
+
"vendor": "Tasmota",
|
|
37
|
+
"model": "Sonoff B1",
|
|
38
|
+
"availability": {"topic": "tele/b1/LWT", "online": "Online", "offline": "Offline"},
|
|
39
|
+
"endpoints": [
|
|
40
|
+
{
|
|
41
|
+
"deviceTypes": ["ColorTemperatureLight"],
|
|
42
|
+
"options": {"light": {"onCommandType": "last", "minMireds": 153, "maxMireds": 500}},
|
|
43
|
+
"mappings": [
|
|
44
|
+
{
|
|
45
|
+
"attribute": "OnOff.onOff",
|
|
46
|
+
"status": {"topic": "stat/b1/RESULT", "extract": "$.POWER", "map": {"ON": true, "OFF": false}},
|
|
47
|
+
"command": {"topic": "cmnd/b1/POWER", "format": {"true": "ON", "false": "OFF"}}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"attribute": "LevelControl.currentLevel",
|
|
51
|
+
"status": {"topic": "stat/b1/RESULT", "extract": "$.Dimmer", "unit": "percentLevel"},
|
|
52
|
+
"command": {"topic": "cmnd/b1/Dimmer", "unit": "percentLevel", "round": 0}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"attribute": "ColorControl.colorTemperatureMireds",
|
|
56
|
+
"status": {"topic": "stat/b1/RESULT", "extract": "$.CT"},
|
|
57
|
+
"command": {"topic": "cmnd/b1/CT"}
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"kitchen-light": {
|
|
64
|
+
"name": "Kitchen light",
|
|
65
|
+
"vendor": "IKEA",
|
|
66
|
+
"model": "TRADFRI bulb E27 CWS",
|
|
67
|
+
"availability": {"topic": "zigbee2mqtt/kitchen-light/availability", "extract": "state"},
|
|
68
|
+
"endpoints": [
|
|
69
|
+
{
|
|
70
|
+
"deviceTypes": ["ExtendedColorLight"],
|
|
71
|
+
"coalesce": 50,
|
|
72
|
+
"mappings": [
|
|
73
|
+
{
|
|
74
|
+
"attribute": "OnOff.onOff",
|
|
75
|
+
"status": {"topic": "zigbee2mqtt/kitchen-light", "extract": "state", "map": {"ON": true, "OFF": false}},
|
|
76
|
+
"command": {
|
|
77
|
+
"topic": "zigbee2mqtt/kitchen-light/set",
|
|
78
|
+
"wrap": "state",
|
|
79
|
+
"format": {"true": "ON", "false": "OFF"}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"attribute": "LevelControl.currentLevel",
|
|
84
|
+
"status": {"topic": "zigbee2mqtt/kitchen-light", "extract": "brightness", "unit": "byteLevel"},
|
|
85
|
+
"command": {
|
|
86
|
+
"topic": "zigbee2mqtt/kitchen-light/set",
|
|
87
|
+
"wrap": "brightness",
|
|
88
|
+
"unit": "byteLevel",
|
|
89
|
+
"round": 0
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"attribute": "ColorControl.colorTemperatureMireds",
|
|
94
|
+
"status": {"topic": "zigbee2mqtt/kitchen-light", "extract": "color_temp"},
|
|
95
|
+
"command": {"topic": "zigbee2mqtt/kitchen-light/set", "wrap": "color_temp"}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"attribute": "ColorControl.colorXy",
|
|
99
|
+
"status": {"topic": "zigbee2mqtt/kitchen-light", "extract": "color"},
|
|
100
|
+
"command": {"topic": "zigbee2mqtt/kitchen-light/set", "wrap": "color"}
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"bedroom-blind": {
|
|
107
|
+
"name": "Bedroom blind",
|
|
108
|
+
"vendor": "IKEA",
|
|
109
|
+
"model": "FYRTUR",
|
|
110
|
+
"endpoints": [
|
|
111
|
+
{
|
|
112
|
+
"deviceTypes": ["WindowCovering", "PowerSource"],
|
|
113
|
+
"options": {"cover": {"echoFilter": true, "reportTimeout": 30}},
|
|
114
|
+
"mappings": [
|
|
115
|
+
{
|
|
116
|
+
"attribute": "WindowCovering.currentPositionLiftPercent100ths",
|
|
117
|
+
"status": {
|
|
118
|
+
"topic": "zigbee2mqtt/bedroom-blind",
|
|
119
|
+
"extract": "position",
|
|
120
|
+
"scale": {"from": [0, 100], "to": [10000, 0]}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"attribute": "WindowCovering.targetPositionLiftPercent100ths",
|
|
125
|
+
"command": {
|
|
126
|
+
"topic": "zigbee2mqtt/bedroom-blind/set",
|
|
127
|
+
"wrap": "position",
|
|
128
|
+
"scale": {"from": [0, 100], "to": [10000, 0]},
|
|
129
|
+
"round": 0
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"invoke": "WindowCovering.stopMotion",
|
|
134
|
+
"command": {"topic": "zigbee2mqtt/bedroom-blind/set", "wrap": "state", "payload": "STOP"}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"attribute": "PowerSource.batPercentRemaining",
|
|
138
|
+
"status": {"topic": "zigbee2mqtt/bedroom-blind", "extract": "battery", "unit": "halfPercent"}
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
"hallway-thermostat": {
|
|
145
|
+
"name": "Hallway radiator",
|
|
146
|
+
"endpoints": [
|
|
147
|
+
{
|
|
148
|
+
"deviceTypes": ["Thermostat"],
|
|
149
|
+
"options": {"climate": {"minHeat": 5, "maxHeat": 30}},
|
|
150
|
+
"mappings": [
|
|
151
|
+
{
|
|
152
|
+
"attribute": "Thermostat.localTemperature",
|
|
153
|
+
"status": {"topic": "zigbee2mqtt/hallway-trv", "extract": "local_temperature", "unit": "celsius"}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"attribute": "Thermostat.occupiedHeatingSetpoint",
|
|
157
|
+
"status": {"topic": "zigbee2mqtt/hallway-trv", "extract": "current_heating_setpoint", "unit": "celsius"},
|
|
158
|
+
"command": {
|
|
159
|
+
"topic": "zigbee2mqtt/hallway-trv/set",
|
|
160
|
+
"wrap": "current_heating_setpoint",
|
|
161
|
+
"unit": "celsius",
|
|
162
|
+
"round": 1
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"attribute": "Thermostat.systemMode",
|
|
167
|
+
"status": {
|
|
168
|
+
"topic": "zigbee2mqtt/hallway-trv",
|
|
169
|
+
"extract": "system_mode",
|
|
170
|
+
"map": {"heat": "Heat", "off": "Off"}
|
|
171
|
+
},
|
|
172
|
+
"command": {
|
|
173
|
+
"topic": "zigbee2mqtt/hallway-trv/set",
|
|
174
|
+
"wrap": "system_mode",
|
|
175
|
+
"format": {"Heat": "heat", "Off": "off"}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"attribute": "Thermostat.thermostatRunningState",
|
|
180
|
+
"status": {
|
|
181
|
+
"topic": "zigbee2mqtt/hallway-trv",
|
|
182
|
+
"extract": "running_state",
|
|
183
|
+
"map": {"heat": "heat", "idle": ""}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
"front-door": {
|
|
191
|
+
"name": "Front door",
|
|
192
|
+
"endpoints": [
|
|
193
|
+
{
|
|
194
|
+
"deviceTypes": ["DoorLock"],
|
|
195
|
+
"mappings": [
|
|
196
|
+
{
|
|
197
|
+
"attribute": "DoorLock.lockState",
|
|
198
|
+
"status": {
|
|
199
|
+
"topic": "zigbee2mqtt/front-door",
|
|
200
|
+
"extract": "state",
|
|
201
|
+
"map": {"LOCK": "Locked", "UNLOCK": "Unlocked"}
|
|
202
|
+
},
|
|
203
|
+
"command": {
|
|
204
|
+
"topic": "zigbee2mqtt/front-door/set",
|
|
205
|
+
"wrap": "state",
|
|
206
|
+
"format": {"Locked": "LOCK", "Unlocked": "UNLOCK"}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
},
|
|
213
|
+
"desk-button": {
|
|
214
|
+
"name": "Desk button",
|
|
215
|
+
"endpoints": [
|
|
216
|
+
{
|
|
217
|
+
"deviceTypes": ["GenericSwitch", "PowerSource"],
|
|
218
|
+
"mappings": [
|
|
219
|
+
{
|
|
220
|
+
"event": "Switch",
|
|
221
|
+
"status": {
|
|
222
|
+
"topic": "zigbee2mqtt/desk-button",
|
|
223
|
+
"extract": "action",
|
|
224
|
+
"map": {"single": "single", "double": "double", "hold": "long"}
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"attribute": "PowerSource.batPercentRemaining",
|
|
229
|
+
"status": {"topic": "zigbee2mqtt/desk-button", "extract": "battery", "unit": "halfPercent"}
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
"greenhouse": {
|
|
236
|
+
"name": "Greenhouse",
|
|
237
|
+
"vendor": "ESPHome",
|
|
238
|
+
"endpoints": [
|
|
239
|
+
{
|
|
240
|
+
"deviceTypes": ["TemperatureSensor"],
|
|
241
|
+
"mappings": [
|
|
242
|
+
{
|
|
243
|
+
"attribute": "TemperatureMeasurement.measuredValue",
|
|
244
|
+
"status": {
|
|
245
|
+
"topic": "greenhouse/sensor/temperature/state",
|
|
246
|
+
"type": "number",
|
|
247
|
+
"unit": "celsius",
|
|
248
|
+
"expire": 600
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"id": "humidity",
|
|
255
|
+
"deviceTypes": ["HumiditySensor"],
|
|
256
|
+
"mappings": [
|
|
257
|
+
{
|
|
258
|
+
"attribute": "RelativeHumidityMeasurement.measuredValue",
|
|
259
|
+
"status": {"topic": "greenhouse/sensor/humidity/state", "type": "number", "unit": "percent100ths"}
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"id": "door",
|
|
265
|
+
"deviceTypes": ["ContactSensor"],
|
|
266
|
+
"mappings": [
|
|
267
|
+
{
|
|
268
|
+
"attribute": "BooleanState.stateValue",
|
|
269
|
+
"status": {"topic": "greenhouse/binary_sensor/door/state", "map": {"ON": false, "OFF": true}}
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|