mqtt2matter 0.1.0 → 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.
Files changed (72) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +8 -0
  3. package/dist/config/schema.d.ts +6 -6
  4. package/dist/engine/payload.d.ts +6 -0
  5. package/dist/engine/payload.js +8 -3
  6. package/dist/engine/payload.js.map +1 -1
  7. package/dist/engine/runtime.js +6 -1
  8. package/dist/engine/runtime.js.map +1 -1
  9. package/dist/engine/template.js +22 -5
  10. package/dist/engine/template.js.map +1 -1
  11. package/dist/families/fan.js +3 -1
  12. package/dist/families/fan.js.map +1 -1
  13. package/dist/families/index.d.ts +1 -0
  14. package/dist/families/index.js +4 -0
  15. package/dist/families/index.js.map +1 -1
  16. package/dist/families/power-source.js +5 -0
  17. package/dist/families/power-source.js.map +1 -1
  18. package/dist/families/rvc.d.ts +40 -0
  19. package/dist/families/rvc.js +83 -0
  20. package/dist/families/rvc.js.map +1 -0
  21. package/dist/importers/ha/generate.js +3 -0
  22. package/dist/importers/ha/generate.js.map +1 -1
  23. package/dist/importers/z2m/generate.js +7 -0
  24. package/dist/importers/z2m/generate.js.map +1 -1
  25. package/dist/model/catalog.js +6 -3
  26. package/dist/model/catalog.js.map +1 -1
  27. package/dist/model/schema.d.ts +32 -32
  28. package/dist/model/schema.js +7 -4
  29. package/dist/model/schema.js.map +1 -1
  30. package/dist/model/validate.js +6 -0
  31. package/dist/model/validate.js.map +1 -1
  32. package/docs/config.md +149 -20
  33. package/docs/importers.md +2 -2
  34. package/package.json +1 -1
  35. package/presets/mqtt-smarthome/button.json +47 -0
  36. package/presets/mqtt-smarthome/contact.json +37 -0
  37. package/presets/mqtt-smarthome/cover.json +50 -0
  38. package/presets/mqtt-smarthome/dimmer.json +57 -0
  39. package/presets/mqtt-smarthome/humidity.json +38 -0
  40. package/presets/mqtt-smarthome/light.json +47 -0
  41. package/presets/mqtt-smarthome/occupancy.json +46 -0
  42. package/presets/mqtt-smarthome/switch.json +47 -0
  43. package/presets/mqtt-smarthome/temperature.json +38 -0
  44. package/presets/openbeken/color-light.json +64 -0
  45. package/presets/openbeken/ct-light.json +51 -0
  46. package/presets/openbeken/dimmer.json +47 -0
  47. package/presets/openbeken/humidity.json +37 -0
  48. package/presets/openbeken/relay.json +40 -0
  49. package/presets/openbeken/temperature.json +41 -0
  50. package/presets/shelly-gen1/dimmer.json +48 -0
  51. package/presets/shelly-gen1/door-window.json +43 -0
  52. package/presets/shelly-gen1/ht.json +43 -0
  53. package/presets/shelly-gen1/relay-pm.json +60 -0
  54. package/presets/shelly-gen1/relay.json +36 -0
  55. package/presets/shelly-gen1/roller.json +52 -0
  56. package/presets/shelly-gen2/cover.json +68 -0
  57. package/presets/shelly-gen2/dimmer.json +61 -0
  58. package/presets/shelly-gen2/ht.json +47 -0
  59. package/presets/shelly-gen2/i4.json +82 -0
  60. package/presets/shelly-gen2/switch-pm.json +101 -0
  61. package/presets/shelly-gen2/switch.json +47 -0
  62. package/presets/tasmota/climate.json +52 -0
  63. package/presets/tasmota/color-light.json +63 -0
  64. package/presets/tasmota/ct-light.json +50 -0
  65. package/presets/tasmota/dimmer.json +45 -0
  66. package/presets/tasmota/relay.json +14 -3
  67. package/presets/tasmota/shutter.json +46 -0
  68. package/presets/tasmota/temperature-humidity.json +42 -0
  69. package/presets/tasmota/temperature.json +32 -0
  70. package/presets/valetudo/vacuum.json +103 -0
  71. package/presets/wled/dimmer.json +46 -0
  72. package/presets/wled/light.json +59 -0
@@ -0,0 +1,63 @@
1
+ {
2
+ "id": "tasmota/color-light",
3
+ "name": "Tasmota colour light",
4
+ "description": "A Tasmota RGB, RGBW or RGBCCT light: POWER, Dimmer, the colour from HSBColor (sent as Color2 r,g,b, which keeps the dimmer), CT for the white channels; the colour mode follows Channel (RGB all 0 = white).",
5
+ "vendor": "Tasmota",
6
+ "format": 1,
7
+ "variables": {
8
+ "topic": {"label": "Tasmota topic", "description": "The device's MQTT topic (Configuration → MQTT → Topic)"},
9
+ "name": {"label": "Name", "default": "Light"}
10
+ },
11
+ "device": {
12
+ "name": "%name%",
13
+ "vendor": "Tasmota",
14
+ "availability": {"topic": "tele/%topic%/LWT", "online": "Online", "offline": "Offline"},
15
+ "endpoints": [
16
+ {
17
+ "deviceTypes": ["ExtendedColorLight"],
18
+ "features": {"ColorControl": ["HueSaturation"]},
19
+ "options": {"light": {"onCommandType": "first"}},
20
+ "mappings": [
21
+ {
22
+ "attribute": "OnOff.onOff",
23
+ "status": {
24
+ "topic": "stat/%topic%/RESULT",
25
+ "extract": "$.POWER",
26
+ "map": {"ON": true, "OFF": false},
27
+ "get": {"topic": "cmnd/%topic%/POWER", "payload": ""}
28
+ },
29
+ "command": {"topic": "cmnd/%topic%/POWER", "format": {"true": "ON", "false": "OFF"}}
30
+ },
31
+ {
32
+ "attribute": "LevelControl.currentLevel",
33
+ "status": {
34
+ "topic": "stat/%topic%/RESULT",
35
+ "template": "{{ value_json.Dimmer if value_json.Dimmer is defined and value_json.Dimmer > 0 else '' }}",
36
+ "type": "number",
37
+ "unit": "percentLevel",
38
+ "get": {"topic": "cmnd/%topic%/Dimmer", "payload": ""}
39
+ },
40
+ "command": {"topic": "cmnd/%topic%/Dimmer", "unit": "percentLevel", "round": 0}
41
+ },
42
+ {
43
+ "attribute": "ColorControl.colorHs",
44
+ "status": {"topic": "stat/%topic%/RESULT", "extract": "$.HSBColor"},
45
+ "command": {"topic": "cmnd/%topic%/Color2", "template": "{{ red }},{{ green }},{{ blue }}"}
46
+ },
47
+ {
48
+ "attribute": "ColorControl.colorTemperatureMireds",
49
+ "status": {"topic": "stat/%topic%/RESULT", "extract": "$.CT"},
50
+ "command": {"topic": "cmnd/%topic%/CT"}
51
+ },
52
+ {
53
+ "attribute": "ColorControl.colorMode",
54
+ "status": {
55
+ "topic": "stat/%topic%/RESULT",
56
+ "template": "{% if value_json.Channel is defined and value_json.Channel | length > 3 %}{{ 'ColorTemperatureMireds' if (value_json.Channel[0:3] | max) == 0 else 'CurrentHueAndCurrentSaturation' }}{% elif value_json.HSBColor is defined %}CurrentHueAndCurrentSaturation{% endif %}"
57
+ }
58
+ }
59
+ ]
60
+ }
61
+ ]
62
+ }
63
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "id": "tasmota/ct-light",
3
+ "name": "Tasmota CT light",
4
+ "description": "A Tasmota light with cold and warm white (2 channels): POWER, Dimmer and CT (153–500 mireds).",
5
+ "vendor": "Tasmota",
6
+ "format": 1,
7
+ "variables": {
8
+ "topic": {"label": "Tasmota topic", "description": "The device's MQTT topic (Configuration → MQTT → Topic)"},
9
+ "name": {"label": "Name", "default": "Light"}
10
+ },
11
+ "device": {
12
+ "name": "%name%",
13
+ "vendor": "Tasmota",
14
+ "availability": {"topic": "tele/%topic%/LWT", "online": "Online", "offline": "Offline"},
15
+ "endpoints": [
16
+ {
17
+ "deviceTypes": ["ColorTemperatureLight"],
18
+ "options": {"light": {"onCommandType": "first"}},
19
+ "mappings": [
20
+ {
21
+ "attribute": "OnOff.onOff",
22
+ "status": {
23
+ "topic": "stat/%topic%/RESULT",
24
+ "extract": "$.POWER",
25
+ "map": {"ON": true, "OFF": false},
26
+ "get": {"topic": "cmnd/%topic%/POWER", "payload": ""}
27
+ },
28
+ "command": {"topic": "cmnd/%topic%/POWER", "format": {"true": "ON", "false": "OFF"}}
29
+ },
30
+ {
31
+ "attribute": "LevelControl.currentLevel",
32
+ "status": {
33
+ "topic": "stat/%topic%/RESULT",
34
+ "template": "{{ value_json.Dimmer if value_json.Dimmer is defined and value_json.Dimmer > 0 else '' }}",
35
+ "type": "number",
36
+ "unit": "percentLevel",
37
+ "get": {"topic": "cmnd/%topic%/Dimmer", "payload": ""}
38
+ },
39
+ "command": {"topic": "cmnd/%topic%/Dimmer", "unit": "percentLevel", "round": 0}
40
+ },
41
+ {
42
+ "attribute": "ColorControl.colorTemperatureMireds",
43
+ "status": {"topic": "stat/%topic%/RESULT", "extract": "$.CT"},
44
+ "command": {"topic": "cmnd/%topic%/CT"}
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ }
50
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "id": "tasmota/dimmer",
3
+ "name": "Tasmota dimmer",
4
+ "description": "A Tasmota dimmer or single-channel light: POWER and Dimmer (0–100) from stat/<topic>/RESULT, commands to cmnd/<topic>/POWER and Dimmer.",
5
+ "vendor": "Tasmota",
6
+ "format": 1,
7
+ "variables": {
8
+ "topic": {"label": "Tasmota topic", "description": "The device's MQTT topic (Configuration → MQTT → Topic)"},
9
+ "name": {"label": "Name", "default": "Dimmer"}
10
+ },
11
+ "device": {
12
+ "name": "%name%",
13
+ "vendor": "Tasmota",
14
+ "availability": {"topic": "tele/%topic%/LWT", "online": "Online", "offline": "Offline"},
15
+ "endpoints": [
16
+ {
17
+ "deviceTypes": ["DimmableLight"],
18
+ "options": {"light": {"onCommandType": "first"}},
19
+ "mappings": [
20
+ {
21
+ "attribute": "OnOff.onOff",
22
+ "status": {
23
+ "topic": "stat/%topic%/RESULT",
24
+ "extract": "$.POWER",
25
+ "map": {"ON": true, "OFF": false},
26
+ "get": {"topic": "cmnd/%topic%/POWER", "payload": ""}
27
+ },
28
+ "command": {"topic": "cmnd/%topic%/POWER", "format": {"true": "ON", "false": "OFF"}}
29
+ },
30
+ {
31
+ "attribute": "LevelControl.currentLevel",
32
+ "status": {
33
+ "topic": "stat/%topic%/RESULT",
34
+ "template": "{{ value_json.Dimmer if value_json.Dimmer is defined and value_json.Dimmer > 0 else '' }}",
35
+ "type": "number",
36
+ "unit": "percentLevel",
37
+ "get": {"topic": "cmnd/%topic%/Dimmer", "payload": ""}
38
+ },
39
+ "command": {"topic": "cmnd/%topic%/Dimmer", "unit": "percentLevel", "round": 0}
40
+ }
41
+ ]
42
+ }
43
+ ]
44
+ }
45
+ }
@@ -1,11 +1,17 @@
1
1
  {
2
2
  "id": "tasmota/relay",
3
3
  "name": "Tasmota relay",
4
- "description": "One relay of a Tasmota device as a plug-in unit: POWER over stat/cmnd, availability from LWT.",
4
+ "description": "One relay of a Tasmota device as a plug-in unit: POWER (or POWER<n> of a multi-relay device) over stat/cmnd, asked for at start, availability from LWT.",
5
5
  "vendor": "Tasmota",
6
6
  "format": 1,
7
7
  "variables": {
8
8
  "topic": {"label": "Tasmota topic", "description": "The device's MQTT topic (Configuration → MQTT → Topic)"},
9
+ "index": {
10
+ "label": "Relay",
11
+ "description": "Empty for a device with one relay (POWER); 1, 2, … for one relay of several (POWER1, POWER2, …)",
12
+ "default": "",
13
+ "optional": true
14
+ },
9
15
  "name": {"label": "Name", "default": "Relay"}
10
16
  },
11
17
  "device": {
@@ -18,8 +24,13 @@
18
24
  "mappings": [
19
25
  {
20
26
  "attribute": "OnOff.onOff",
21
- "status": {"topic": "stat/%topic%/RESULT", "extract": "$.POWER", "map": {"ON": true, "OFF": false}},
22
- "command": {"topic": "cmnd/%topic%/POWER", "format": {"true": "ON", "false": "OFF"}}
27
+ "status": {
28
+ "topic": "stat/%topic%/RESULT",
29
+ "extract": "$.POWER%index%",
30
+ "map": {"ON": true, "OFF": false},
31
+ "get": {"topic": "cmnd/%topic%/POWER%index%", "payload": ""}
32
+ },
33
+ "command": {"topic": "cmnd/%topic%/POWER%index%", "format": {"true": "ON", "false": "OFF"}}
23
34
  }
24
35
  ]
25
36
  }
@@ -0,0 +1,46 @@
1
+ {
2
+ "id": "tasmota/shutter",
3
+ "name": "Tasmota shutter",
4
+ "description": "A Tasmota shutter (Shutter<n>, 100 = open) as a position-aware window covering: the position from stat/<topic>/RESULT, ShutterPosition<n>, ShutterOpen<n>, ShutterClose<n>, ShutterStop<n>.",
5
+ "vendor": "Tasmota",
6
+ "format": 1,
7
+ "variables": {
8
+ "topic": {"label": "Tasmota topic", "description": "The device's MQTT topic (Configuration → MQTT → Topic)"},
9
+ "index": {"label": "Shutter", "description": "The shutter's number: 1, 2, …", "default": "1"},
10
+ "name": {"label": "Name", "default": "Shutter"}
11
+ },
12
+ "device": {
13
+ "name": "%name%",
14
+ "vendor": "Tasmota",
15
+ "availability": {"topic": "tele/%topic%/LWT", "online": "Online", "offline": "Offline"},
16
+ "endpoints": [
17
+ {
18
+ "deviceTypes": ["WindowCovering"],
19
+ "mappings": [
20
+ {
21
+ "attribute": "WindowCovering.currentPositionLiftPercent100ths",
22
+ "status": {
23
+ "topic": "stat/%topic%/RESULT",
24
+ "extract": "$.Shutter%index%.Position",
25
+ "scale": {"from": [0, 100], "to": [10000, 0]},
26
+ "get": {"topic": "cmnd/%topic%/ShutterPosition%index%", "payload": ""}
27
+ }
28
+ },
29
+ {
30
+ "attribute": "WindowCovering.targetPositionLiftPercent100ths",
31
+ "command": {"topic": "cmnd/%topic%/ShutterPosition%index%", "template": "{{ open }}"}
32
+ },
33
+ {"invoke": "WindowCovering.upOrOpen", "command": {"topic": "cmnd/%topic%/ShutterOpen%index%", "payload": ""}},
34
+ {
35
+ "invoke": "WindowCovering.downOrClose",
36
+ "command": {"topic": "cmnd/%topic%/ShutterClose%index%", "payload": ""}
37
+ },
38
+ {
39
+ "invoke": "WindowCovering.stopMotion",
40
+ "command": {"topic": "cmnd/%topic%/ShutterStop%index%", "payload": ""}
41
+ }
42
+ ]
43
+ }
44
+ ]
45
+ }
46
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "id": "tasmota/temperature-humidity",
3
+ "name": "Tasmota temperature and humidity sensor",
4
+ "description": "A temperature and humidity sensor attached to Tasmota (SHT3X, AM2301, DHT11, SI7021, …) from tele/<topic>/SENSOR every TelePeriod; humidity as a child endpoint.",
5
+ "vendor": "Tasmota",
6
+ "format": 1,
7
+ "variables": {
8
+ "topic": {"label": "Tasmota topic", "description": "The device's MQTT topic (Configuration → MQTT → Topic)"},
9
+ "sensor": {
10
+ "label": "Sensor",
11
+ "description": "The sensor's key in tele/<topic>/SENSOR (SHT3X, AM2301, DHT11, SI7021, …)",
12
+ "default": "SHT3X"
13
+ },
14
+ "name": {"label": "Name", "default": "Climate"}
15
+ },
16
+ "device": {
17
+ "name": "%name%",
18
+ "vendor": "Tasmota",
19
+ "availability": {"topic": "tele/%topic%/LWT", "online": "Online", "offline": "Offline"},
20
+ "endpoints": [
21
+ {
22
+ "deviceTypes": ["TemperatureSensor"],
23
+ "mappings": [
24
+ {
25
+ "attribute": "TemperatureMeasurement.measuredValue",
26
+ "status": {"topic": "tele/%topic%/SENSOR", "extract": "$.%sensor%.Temperature", "unit": "celsius"}
27
+ }
28
+ ]
29
+ },
30
+ {
31
+ "id": "humidity",
32
+ "deviceTypes": ["HumiditySensor"],
33
+ "mappings": [
34
+ {
35
+ "attribute": "RelativeHumidityMeasurement.measuredValue",
36
+ "status": {"topic": "tele/%topic%/SENSOR", "extract": "$.%sensor%.Humidity", "unit": "percent100ths"}
37
+ }
38
+ ]
39
+ }
40
+ ]
41
+ }
42
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "id": "tasmota/temperature",
3
+ "name": "Tasmota temperature sensor",
4
+ "description": "A temperature sensor attached to Tasmota (DS18B20, …) from tele/<topic>/SENSOR every TelePeriod; set TempUnit to C (SetOption8 0).",
5
+ "vendor": "Tasmota",
6
+ "format": 1,
7
+ "variables": {
8
+ "topic": {"label": "Tasmota topic", "description": "The device's MQTT topic (Configuration → MQTT → Topic)"},
9
+ "sensor": {
10
+ "label": "Sensor",
11
+ "description": "The sensor's key in tele/<topic>/SENSOR (DS18B20, DS18B20-1, …)",
12
+ "default": "DS18B20"
13
+ },
14
+ "name": {"label": "Name", "default": "Temperature"}
15
+ },
16
+ "device": {
17
+ "name": "%name%",
18
+ "vendor": "Tasmota",
19
+ "availability": {"topic": "tele/%topic%/LWT", "online": "Online", "offline": "Offline"},
20
+ "endpoints": [
21
+ {
22
+ "deviceTypes": ["TemperatureSensor"],
23
+ "mappings": [
24
+ {
25
+ "attribute": "TemperatureMeasurement.measuredValue",
26
+ "status": {"topic": "tele/%topic%/SENSOR", "extract": "$.%sensor%.Temperature", "unit": "celsius"}
27
+ }
28
+ ]
29
+ }
30
+ ]
31
+ }
32
+ }
@@ -0,0 +1,103 @@
1
+ {
2
+ "id": "valetudo/vacuum",
3
+ "name": "Valetudo robot vacuum",
4
+ "description": "A robot vacuum running Valetudo as a Matter robotic vacuum cleaner: run mode (Idle/Cleaning), operational state from StatusStateAttribute/status, start, pause, resume and return to the dock over BasicControlCapability, the battery. Bridged vacuums show in Google Home and Home Assistant; Apple Home and Alexa want a vacuum as a Matter node of its own.",
5
+ "vendor": "Valetudo",
6
+ "format": 1,
7
+ "variables": {
8
+ "prefix": {
9
+ "label": "Topic prefix",
10
+ "description": "Valetudo → Connectivity → MQTT → Topic prefix",
11
+ "default": "valetudo"
12
+ },
13
+ "identifier": {
14
+ "label": "Identifier",
15
+ "description": "Valetudo → Connectivity → MQTT → Identifier (the robot's name in the topics)"
16
+ },
17
+ "name": {"label": "Name", "default": "Vacuum"}
18
+ },
19
+ "device": {
20
+ "name": "%name%",
21
+ "vendor": "Valetudo",
22
+ "availability": {
23
+ "topic": "%prefix%/%identifier%/$state",
24
+ "template": "{{ 'online' if value == 'ready' else 'offline' }}"
25
+ },
26
+ "endpoints": [
27
+ {
28
+ "deviceTypes": ["RoboticVacuumCleaner", "PowerSource"],
29
+ "features": {"PowerSource": ["Battery", "Rechargeable"]},
30
+ "mappings": [
31
+ {
32
+ "attribute": "RvcRunMode.currentMode",
33
+ "status": {
34
+ "topic": "%prefix%/%identifier%/StatusStateAttribute/status",
35
+ "map": {
36
+ "cleaning": 1,
37
+ "paused": 1,
38
+ "moving": 1,
39
+ "manual_control": 1,
40
+ "returning": 0,
41
+ "docked": 0,
42
+ "idle": 0,
43
+ "error": 0
44
+ }
45
+ },
46
+ "command": {
47
+ "topic": "%prefix%/%identifier%/BasicControlCapability/operation/set",
48
+ "format": {"1": "START", "0": "HOME"}
49
+ }
50
+ },
51
+ {
52
+ "attribute": "RvcOperationalState.operationalState",
53
+ "status": {
54
+ "topic": "%prefix%/%identifier%/StatusStateAttribute/status",
55
+ "map": {
56
+ "cleaning": "Running",
57
+ "moving": "Running",
58
+ "manual_control": "Running",
59
+ "paused": "Paused",
60
+ "returning": "SeekingCharger",
61
+ "docked": "Docked",
62
+ "idle": "Stopped",
63
+ "error": "Error"
64
+ }
65
+ }
66
+ },
67
+ {
68
+ "invoke": "RvcOperationalState.pause",
69
+ "command": {"topic": "%prefix%/%identifier%/BasicControlCapability/operation/set", "payload": "PAUSE"}
70
+ },
71
+ {
72
+ "invoke": "RvcOperationalState.resume",
73
+ "command": {"topic": "%prefix%/%identifier%/BasicControlCapability/operation/set", "payload": "START"}
74
+ },
75
+ {
76
+ "invoke": "RvcOperationalState.goHome",
77
+ "command": {"topic": "%prefix%/%identifier%/BasicControlCapability/operation/set", "payload": "HOME"}
78
+ },
79
+ {
80
+ "attribute": "PowerSource.batPercentRemaining",
81
+ "status": {
82
+ "topic": "%prefix%/%identifier%/BatteryStateAttribute/level",
83
+ "type": "number",
84
+ "unit": "halfPercent"
85
+ }
86
+ },
87
+ {
88
+ "attribute": "PowerSource.batChargeState",
89
+ "status": {
90
+ "topic": "%prefix%/%identifier%/BatteryStateAttribute/status",
91
+ "map": {
92
+ "charging": "IsCharging",
93
+ "charged": "IsAtFullCharge",
94
+ "discharging": "IsNotCharging",
95
+ "none": "Unknown"
96
+ }
97
+ }
98
+ }
99
+ ]
100
+ }
101
+ ]
102
+ }
103
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "id": "wled/dimmer",
3
+ "name": "WLED dimmer",
4
+ "description": "A single-colour WLED strip as a dimmable light: on/off and brightness from <topic>/g, commands to <topic>; availability from <topic>/status.",
5
+ "vendor": "WLED",
6
+ "format": 1,
7
+ "variables": {
8
+ "topic": {
9
+ "label": "Device topic",
10
+ "description": "WLED's MQTT device topic (Config → Sync Interfaces → MQTT → Device Topic; default wled/<MAC>)"
11
+ },
12
+ "name": {"label": "Name", "default": "WLED"}
13
+ },
14
+ "device": {
15
+ "name": "%name%",
16
+ "vendor": "WLED",
17
+ "availability": {"topic": "%topic%/status", "online": "online", "offline": "offline"},
18
+ "endpoints": [
19
+ {
20
+ "deviceTypes": ["DimmableLight"],
21
+ "options": {"light": {"onCommandType": "brightness"}},
22
+ "mappings": [
23
+ {
24
+ "attribute": "OnOff.onOff",
25
+ "status": {
26
+ "topic": "%topic%/g",
27
+ "template": "{{ 'true' if value | int > 0 else 'false' }}",
28
+ "map": {"true": true, "false": false}
29
+ },
30
+ "command": {"topic": "%topic%", "format": {"true": "ON", "false": "OFF"}}
31
+ },
32
+ {
33
+ "attribute": "LevelControl.currentLevel",
34
+ "status": {
35
+ "topic": "%topic%/g",
36
+ "template": "{{ value if value | int > 0 else '' }}",
37
+ "type": "number",
38
+ "unit": "byteLevel"
39
+ },
40
+ "command": {"topic": "%topic%", "unit": "byteLevel", "round": 0}
41
+ }
42
+ ]
43
+ }
44
+ ]
45
+ }
46
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "id": "wled/light",
3
+ "name": "WLED light",
4
+ "description": "A WLED strip as a colour light: on/off and brightness from <topic>/g, the colour from <topic>/c, commands to <topic> and <topic>/col; colour temperature goes to the main segment's cct over <topic>/api (white channels only); availability from <topic>/status.",
5
+ "vendor": "WLED",
6
+ "format": 1,
7
+ "variables": {
8
+ "topic": {
9
+ "label": "Device topic",
10
+ "description": "WLED's MQTT device topic (Config → Sync Interfaces → MQTT → Device Topic; default wled/<MAC>)"
11
+ },
12
+ "name": {"label": "Name", "default": "WLED"}
13
+ },
14
+ "device": {
15
+ "name": "%name%",
16
+ "vendor": "WLED",
17
+ "availability": {"topic": "%topic%/status", "online": "online", "offline": "offline"},
18
+ "endpoints": [
19
+ {
20
+ "deviceTypes": ["ExtendedColorLight"],
21
+ "features": {"ColorControl": ["HueSaturation"]},
22
+ "options": {"light": {"onCommandType": "brightness"}},
23
+ "mappings": [
24
+ {
25
+ "attribute": "OnOff.onOff",
26
+ "status": {
27
+ "topic": "%topic%/g",
28
+ "template": "{{ 'true' if value | int > 0 else 'false' }}",
29
+ "map": {"true": true, "false": false}
30
+ },
31
+ "command": {"topic": "%topic%", "format": {"true": "ON", "false": "OFF"}}
32
+ },
33
+ {
34
+ "attribute": "LevelControl.currentLevel",
35
+ "status": {
36
+ "topic": "%topic%/g",
37
+ "template": "{{ value if value | int > 0 else '' }}",
38
+ "type": "number",
39
+ "unit": "byteLevel"
40
+ },
41
+ "command": {"topic": "%topic%", "unit": "byteLevel", "round": 0}
42
+ },
43
+ {
44
+ "attribute": "ColorControl.colorRgb",
45
+ "status": {
46
+ "topic": "%topic%/c",
47
+ "template": "{% set h = value[-6:] %}{{ h[0:2] | int(0, 16) }},{{ h[2:4] | int(0, 16) }},{{ h[4:6] | int(0, 16) }}"
48
+ },
49
+ "command": {"topic": "%topic%/col", "template": "{{ red * 65536 + green * 256 + blue }}"}
50
+ },
51
+ {
52
+ "attribute": "ColorControl.colorTemperatureMireds",
53
+ "command": {"topic": "%topic%/api", "template": "{\"seg\":{\"cct\":{{ kelvin | round(0) | int }}}}"}
54
+ }
55
+ ]
56
+ }
57
+ ]
58
+ }
59
+ }