homebridge-easy-mqtt 1.3.0-beta.3 → 1.3.0-beta.5
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 +14 -8
- package/README.md +29 -5
- package/config.schema.json +222 -5
- package/dist/accessory/abstract/base.d.ts +1 -2
- package/dist/accessory/abstract/base.js +2 -21
- package/dist/accessory/abstract/base.js.map +1 -1
- package/dist/accessory/abstract/group.d.ts +8 -0
- package/dist/accessory/abstract/group.js +39 -0
- package/dist/accessory/abstract/group.js.map +1 -0
- package/dist/accessory/abstract/helper.d.ts +5 -0
- package/dist/accessory/abstract/helper.js +53 -0
- package/dist/accessory/abstract/helper.js.map +1 -0
- package/dist/accessory/abstract/mqtt.d.ts +10 -8
- package/dist/accessory/abstract/mqtt.js +55 -9
- package/dist/accessory/abstract/mqtt.js.map +1 -1
- package/dist/accessory/lock.d.ts +6 -5
- package/dist/accessory/lock.js +7 -7
- package/dist/accessory/lock.js.map +1 -1
- package/dist/accessory/onoff/lightbulb.d.ts +4 -3
- package/dist/accessory/onoff/lightbulb.js +9 -9
- package/dist/accessory/onoff/lightbulb.js.map +1 -1
- package/dist/accessory/onoff/onoff.d.ts +1 -1
- package/dist/accessory/onoff/onoff.js +4 -4
- package/dist/accessory/onoff/onoff.js.map +1 -1
- package/dist/accessory/onoff/outlet.d.ts +4 -3
- package/dist/accessory/onoff/outlet.js +5 -5
- package/dist/accessory/onoff/outlet.js.map +1 -1
- package/dist/accessory/onoff/switch.d.ts +4 -3
- package/dist/accessory/onoff/switch.js +5 -4
- package/dist/accessory/onoff/switch.js.map +1 -1
- package/dist/accessory/security.d.ts +6 -5
- package/dist/accessory/security.js +10 -10
- package/dist/accessory/security.js.map +1 -1
- package/dist/accessory/sensor/carbonDioxide.d.ts +4 -3
- package/dist/accessory/sensor/carbonDioxide.js +5 -5
- package/dist/accessory/sensor/carbonDioxide.js.map +1 -1
- package/dist/accessory/sensor/carbonMonoxide.d.ts +4 -3
- package/dist/accessory/sensor/carbonMonoxide.js +5 -5
- package/dist/accessory/sensor/carbonMonoxide.js.map +1 -1
- package/dist/accessory/sensor/contact.d.ts +4 -3
- package/dist/accessory/sensor/contact.js +5 -5
- package/dist/accessory/sensor/contact.js.map +1 -1
- package/dist/accessory/sensor/humidity.d.ts +4 -3
- package/dist/accessory/sensor/humidity.js +6 -6
- package/dist/accessory/sensor/humidity.js.map +1 -1
- package/dist/accessory/sensor/leak.d.ts +4 -3
- package/dist/accessory/sensor/leak.js +5 -5
- package/dist/accessory/sensor/leak.js.map +1 -1
- package/dist/accessory/sensor/motion.d.ts +4 -3
- package/dist/accessory/sensor/motion.js +5 -5
- package/dist/accessory/sensor/motion.js.map +1 -1
- package/dist/accessory/sensor/occupancy.d.ts +4 -3
- package/dist/accessory/sensor/occupancy.js +5 -5
- package/dist/accessory/sensor/occupancy.js.map +1 -1
- package/dist/accessory/sensor/sensor.d.ts +1 -1
- package/dist/accessory/sensor/sensor.js +2 -2
- package/dist/accessory/sensor/sensor.js.map +1 -1
- package/dist/accessory/sensor/smoke.d.ts +4 -3
- package/dist/accessory/sensor/smoke.js +5 -5
- package/dist/accessory/sensor/smoke.js.map +1 -1
- package/dist/accessory/sensor/temperature.d.ts +4 -4
- package/dist/accessory/sensor/temperature.js +6 -18
- package/dist/accessory/sensor/temperature.js.map +1 -1
- package/dist/accessory/thermostat.d.ts +20 -0
- package/dist/accessory/thermostat.js +116 -0
- package/dist/accessory/thermostat.js.map +1 -0
- package/dist/homebridge/platform.d.ts +5 -3
- package/dist/homebridge/platform.js +35 -72
- package/dist/homebridge/platform.js.map +1 -1
- package/dist/homebridge-ui/public/index.html +1 -1
- package/dist/homebridge-ui/public/ui.js +1 -1
- package/dist/i18n/en.d.ts +63 -28
- package/dist/i18n/en.js +65 -30
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/i18n.d.ts +63 -28
- package/dist/i18n/template.d.ts +63 -28
- package/dist/model/enums.d.ts +10 -2
- package/dist/model/enums.js +8 -0
- package/dist/model/enums.js.map +1 -1
- package/dist/model/mqtt.js +2 -1
- package/dist/model/mqtt.js.map +1 -1
- package/dist/model/types.d.ts +23 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,20 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to homebridge-dummy will be documented in this file.
|
|
4
4
|
|
|
5
|
-
## 1.3.0-beta.
|
|
6
|
-
|
|
7
|
-
### HELP NEEDED! (no coding experience required)
|
|
8
|
-
|
|
9
|
-
Would you like to see Homebridge Easy MQTT in your language? Please consider [getting involved](https://github.com/mpatfield/homebridge-easy-mqtt/issues/4).
|
|
5
|
+
## 1.3.0-beta.5 (2025-09-XX)
|
|
10
6
|
|
|
11
7
|
### Added
|
|
12
|
-
-
|
|
13
|
-
-
|
|
8
|
+
- Groups
|
|
9
|
+
- ⚠️ Changing the group name will require you to reconfigure any HomeKit scenes/automations for those accessories
|
|
10
|
+
- Thermostats
|
|
11
|
+
- CO, CO2, Contact, Humidity, Leak, Motion, Occupancy, and Smoke sensors
|
|
12
|
+
- Arbitrary custom characteristics ([documentation](https://github.com/mpatfield/homebridge-easy-mqtt#custom-characteristics))
|
|
14
13
|
- JSONPath support in setter topics ([documentation](https://github.com/mpatfield/homebridge-easy-mqtt#jsonpaths))
|
|
15
14
|
- Banner image in config UI
|
|
16
15
|
|
|
17
16
|
### Changed
|
|
18
|
-
- Significant under-the-hood
|
|
17
|
+
- Significant under-the-hood cleanup to speed future development
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- Exponential backoff for MQTT connection errors
|
|
21
|
+
|
|
22
|
+
### Notes
|
|
23
|
+
|
|
24
|
+
• Would you like to see Homebridge Easy MQTT in your language? Please consider [getting involved](https://github.com/mpatfield/homebridge-easy-mqtt/issues/4). No coding experience required!
|
|
19
25
|
|
|
20
26
|
## 1.2.0 (2025-09-02)
|
|
21
27
|
|
package/README.md
CHANGED
|
@@ -39,6 +39,7 @@ This plugin is designed to be a simple replacement for the fantastic [homebridge
|
|
|
39
39
|
- `SmokeSensor`
|
|
40
40
|
- `Switch`
|
|
41
41
|
- `TemperatureSensor`
|
|
42
|
+
- `Thermostat`
|
|
42
43
|
|
|
43
44
|
## Configuration
|
|
44
45
|
|
|
@@ -53,6 +54,7 @@ Using the Homebridge Config UI is the easiest way to set up this plugin. However
|
|
|
53
54
|
"id": "string",
|
|
54
55
|
"name": "string",
|
|
55
56
|
"type": "string",
|
|
57
|
+
"group": "string",
|
|
56
58
|
"manufacturer": "string",
|
|
57
59
|
"model": "string",
|
|
58
60
|
"serialNumber": "string",
|
|
@@ -87,6 +89,8 @@ Required fields are marked with an asterisk (*)
|
|
|
87
89
|
- `id*` - A unique ID to identify this accessory. Changing this value will result in a new accessory.
|
|
88
90
|
- `name*` - The display name for the accessory in HomeKit
|
|
89
91
|
- `type*` - The type of accessory, currently Lightbulb, LockMechanism, Outlet, SecuritySystem, Switch, and Temperature Sensor are supported
|
|
92
|
+
- `group` - Items sharing the same group name will be grouped together in the Home app UI
|
|
93
|
+
- ⚠️ Changing the group name will require you to reconfigure any HomeKit scenes/automations for those accessories
|
|
90
94
|
- `manufacturer` - The accessory manufacturer which will display in HomeKit device details
|
|
91
95
|
- `model` - The accessory model which will display in HomeKit device details
|
|
92
96
|
- `serialNumber` - The accessory serial number which will display in HomeKit device details
|
|
@@ -197,14 +201,34 @@ As with topics, you will also need to populate the appropriate values based on t
|
|
|
197
201
|
- `topicSetTargetSecurityState*` — For setting the target state of the system
|
|
198
202
|
- `topicGetStatusFault` — For getting whether there is a system error
|
|
199
203
|
- `topicGetStatusTampered` — For getting whether the system has been tampered with
|
|
200
|
-
- `valueArmStay` -
|
|
201
|
-
- `valueArmAway` -
|
|
202
|
-
- `valueArmNight` -
|
|
203
|
-
- `valueDisarm` -
|
|
204
|
-
- `valueAlarmTriggered` -
|
|
204
|
+
- `valueArmStay` - System armed in stay mode, e.g. "SA" or "stay"
|
|
205
|
+
- `valueArmAway` - System armed in away mode, e.g. "AA" or "away"
|
|
206
|
+
- `valueArmNight` - System armed in night mode, e.g. "NA" or "night"
|
|
207
|
+
- `valueDisarm` - System armed in away mode, e.g. "D" or "disarmed"
|
|
208
|
+
- `valueAlarmTriggered` - When the alarm has been triggered, e.g. "true" or "1" or "triggered"
|
|
205
209
|
- `valueFault` - Accessory has a fault
|
|
206
210
|
- `valueTampered` - Accessory has been tampered with
|
|
207
211
|
|
|
212
|
+
### Thermostat
|
|
213
|
+
- `temperatureUnits` - The temperature units of the incoming value supplied by the thermostat, `C` for Celsius (default) `F` for Fahrenheit
|
|
214
|
+
- `topicGetCurrentHeatingCoolingState*` - Get the current mode (i.e. cooling, heating, off)
|
|
215
|
+
- `topicGetTargetHeatingCoolingState*` - Get the target mode (i.e. auto, cooling, heating, off)
|
|
216
|
+
- `topicSetTargetHeatingCoolingState*` - Set the target mode (i.e. auto, cooling, heating, off)
|
|
217
|
+
- `topicGetCurrentTemperature*` - Get the current temperature
|
|
218
|
+
- `topicGetTargetTemperature*` - Get the target temperature
|
|
219
|
+
- `topicSetTargetTemperature*` - Set the target temperature
|
|
220
|
+
- `topicGetCurrentRelativeHumidity` - Get the current humidity
|
|
221
|
+
- `topicGetTargetRelativeHumidity` - Get the target humidity
|
|
222
|
+
- `topicSetTargetRelativeHumidity` - Set the target humidity
|
|
223
|
+
- `topicGetCoolingThresholdTemperature` - Get the cooling threshold temperature
|
|
224
|
+
- `topicSetCoolingThresholdTemperature` - Set the cooling threshold temparture
|
|
225
|
+
- `topicGetHeatingThresholdTemperature` - Get the heating threshold temperature
|
|
226
|
+
- `topicSetHeatingThresholdTemperature` - Set the heating threshold temperature
|
|
227
|
+
- `valueModeAuto` - Auto mode
|
|
228
|
+
- `valueModeCool` - Cool mode
|
|
229
|
+
- `valueModeHeat` - Heat mode
|
|
230
|
+
- `valueModeOff` - Thermostat off
|
|
231
|
+
|
|
208
232
|
## Logging/Debugging:
|
|
209
233
|
|
|
210
234
|
By default, devices will log activity, for example when a Switch is turned on or a LockMechanism is unlocked.
|
package/config.schema.json
CHANGED
|
@@ -15,16 +15,20 @@
|
|
|
15
15
|
},
|
|
16
16
|
"name": {
|
|
17
17
|
"type": "string",
|
|
18
|
-
"title": "${config.title.name}"
|
|
18
|
+
"title": "${config.title.name}",
|
|
19
19
|
"required": true
|
|
20
20
|
},
|
|
21
21
|
"type": {
|
|
22
22
|
"type": "string",
|
|
23
23
|
"title": "${config.title.type}",
|
|
24
|
-
"enum": [ "CarbonMonoxideSensor", "CarbonDioxideSensor", "ContactSensor", "HumiditySensor", "LeakSensor", "Lightbulb", "LockMechanism", "MotionSensor", "OccupancySensor", "Outlet", "SecuritySystem", "SmokeSensor", "Switch", "TemperatureSensor"],
|
|
25
|
-
"enumNames": ["${config.enumNames.carbonMonoxideSensor}", "${config.enumNames.carbonDioxideSensor}", "${config.enumNames.contactSensor}", "${config.enumNames.humiditySensor}", "${config.enumNames.leakSensor}", "${config.enumNames.lightbulb}", "${config.enumNames.lockMechanism}", "${config.enumNames.motionSensor}", "${config.enumNames.occupancySensor}", "${config.enumNames.outlet}", "${config.enumNames.securitySystem}", "${config.enumNames.smokeSensor}", "${config.enumNames.switch}", "${config.enumNames.temperatureSensor}"],
|
|
24
|
+
"enum": [ "CarbonMonoxideSensor", "CarbonDioxideSensor", "ContactSensor", "HumiditySensor", "LeakSensor", "Lightbulb", "LockMechanism", "MotionSensor", "OccupancySensor", "Outlet", "SecuritySystem", "SmokeSensor", "Switch", "TemperatureSensor", "Thermostat"],
|
|
25
|
+
"enumNames": ["${config.enumNames.carbonMonoxideSensor}", "${config.enumNames.carbonDioxideSensor}", "${config.enumNames.contactSensor}", "${config.enumNames.humiditySensor}", "${config.enumNames.leakSensor}", "${config.enumNames.lightbulb}", "${config.enumNames.lockMechanism}", "${config.enumNames.motionSensor}", "${config.enumNames.occupancySensor}", "${config.enumNames.outlet}", "${config.enumNames.securitySystem}", "${config.enumNames.smokeSensor}", "${config.enumNames.switch}", "${config.enumNames.temperatureSensor}", "${config.enumNames.thermostat}"],
|
|
26
26
|
"required": true
|
|
27
27
|
},
|
|
28
|
+
"group": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"title": "${config.title.group}"
|
|
31
|
+
},
|
|
28
32
|
"manufacturer": {
|
|
29
33
|
"type": "string",
|
|
30
34
|
"title": "${config.title.manufacturer}"
|
|
@@ -247,6 +251,50 @@
|
|
|
247
251
|
"type": "string",
|
|
248
252
|
"title": "${config.title.topicGetCurrentTemperature}"
|
|
249
253
|
},
|
|
254
|
+
"topicGetCurrentHeatingCoolingState": {
|
|
255
|
+
"type": "string",
|
|
256
|
+
"title": "${config.title.topicGetCurrentHeatingCoolingState}"
|
|
257
|
+
},
|
|
258
|
+
"topicGetTargetHeatingCoolingState": {
|
|
259
|
+
"type": "string",
|
|
260
|
+
"title": "${config.title.topicGetTargetHeatingCoolingState}"
|
|
261
|
+
},
|
|
262
|
+
"topicSetTargetHeatingCoolingState": {
|
|
263
|
+
"type": "string",
|
|
264
|
+
"title": "${config.title.topicSetTargetHeatingCoolingState}"
|
|
265
|
+
},
|
|
266
|
+
"topicGetTargetTemperature": {
|
|
267
|
+
"type": "string",
|
|
268
|
+
"title": "${config.title.topicGetTargetTemperature}"
|
|
269
|
+
},
|
|
270
|
+
"topicSetTargetTemperature": {
|
|
271
|
+
"type": "string",
|
|
272
|
+
"title": "${config.title.topicSetTargetTemperature}"
|
|
273
|
+
},
|
|
274
|
+
"topicGetTargetRelativeHumidity": {
|
|
275
|
+
"type": "string",
|
|
276
|
+
"title": "${config.title.topicGetTargetRelativeHumidity}"
|
|
277
|
+
},
|
|
278
|
+
"topicSetTargetRelativeHumidity": {
|
|
279
|
+
"type": "string",
|
|
280
|
+
"title": "${config.title.topicSetTargetRelativeHumidity}"
|
|
281
|
+
},
|
|
282
|
+
"topicGetCoolingThresholdTemperature": {
|
|
283
|
+
"type": "string",
|
|
284
|
+
"title": "${config.title.topicGetCoolingThresholdTemperature}"
|
|
285
|
+
},
|
|
286
|
+
"topicSetCoolingThresholdTemperature": {
|
|
287
|
+
"type": "string",
|
|
288
|
+
"title": "${config.title.topicSetCoolingThresholdTemperature}"
|
|
289
|
+
},
|
|
290
|
+
"topicGetHeatingThresholdTemperature": {
|
|
291
|
+
"type": "string",
|
|
292
|
+
"title": "${config.title.topicGetHeatingThresholdTemperature}"
|
|
293
|
+
},
|
|
294
|
+
"topicSetHeatingThresholdTemperature": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"title": "${config.title.topicSetHeatingThresholdTemperature}"
|
|
297
|
+
},
|
|
250
298
|
"valueBatteryLow": {
|
|
251
299
|
"type": "string",
|
|
252
300
|
"title": "${config.title.valueBatteryLow}"
|
|
@@ -335,6 +383,22 @@
|
|
|
335
383
|
"type": "string",
|
|
336
384
|
"title": "${config.title.valueSmokeDetected}"
|
|
337
385
|
},
|
|
386
|
+
"valueModeAuto": {
|
|
387
|
+
"type": "string",
|
|
388
|
+
"title": "${config.title.valueModeAuto}"
|
|
389
|
+
},
|
|
390
|
+
"valueModeCool": {
|
|
391
|
+
"type": "string",
|
|
392
|
+
"title": "${config.title.valueModeCool}"
|
|
393
|
+
},
|
|
394
|
+
"valueModeHeat": {
|
|
395
|
+
"type": "string",
|
|
396
|
+
"title": "${config.title.valueModeHeat}"
|
|
397
|
+
},
|
|
398
|
+
"valueModeOff": {
|
|
399
|
+
"type": "string",
|
|
400
|
+
"title": "${config.title.valueModeOff}"
|
|
401
|
+
},
|
|
338
402
|
"disableLogging": {
|
|
339
403
|
"type": "boolean",
|
|
340
404
|
"title": "${config.title.disableLogging}"
|
|
@@ -363,11 +427,15 @@
|
|
|
363
427
|
"items": [
|
|
364
428
|
{
|
|
365
429
|
"key": "accessories[].info.name",
|
|
366
|
-
"flex": "0 0
|
|
430
|
+
"flex": "0 0 33%"
|
|
367
431
|
},
|
|
368
432
|
{
|
|
369
433
|
"key": "accessories[].info.type",
|
|
370
|
-
"flex": "0 0
|
|
434
|
+
"flex": "0 0 33%"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"key": "accessories[].info.group",
|
|
438
|
+
"flex": "0 0 33%"
|
|
371
439
|
}
|
|
372
440
|
]
|
|
373
441
|
},
|
|
@@ -768,6 +836,129 @@
|
|
|
768
836
|
}
|
|
769
837
|
]
|
|
770
838
|
},
|
|
839
|
+
{
|
|
840
|
+
"type": "fieldset",
|
|
841
|
+
"notitle": true,
|
|
842
|
+
"condition": {
|
|
843
|
+
"functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Thermostat';"
|
|
844
|
+
},
|
|
845
|
+
"items": [
|
|
846
|
+
{
|
|
847
|
+
"type": "div",
|
|
848
|
+
"displayFlex": true,
|
|
849
|
+
"flex-direction": "row",
|
|
850
|
+
"items": [
|
|
851
|
+
{
|
|
852
|
+
"key": "accessories[].topicGetCurrentHeatingCoolingState",
|
|
853
|
+
"flex": "0 0 50%"
|
|
854
|
+
}
|
|
855
|
+
]
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
"type": "div",
|
|
859
|
+
"displayFlex": true,
|
|
860
|
+
"flex-direction": "row",
|
|
861
|
+
"items": [
|
|
862
|
+
{
|
|
863
|
+
"key": "accessories[].topicGetTargetHeatingCoolingState",
|
|
864
|
+
"flex": "0 0 50%"
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
"key": "accessories[].topicSetTargetHeatingCoolingState",
|
|
868
|
+
"flex": "0 0 50%"
|
|
869
|
+
}
|
|
870
|
+
]
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
"type": "div",
|
|
874
|
+
"displayFlex": true,
|
|
875
|
+
"flex-direction": "row",
|
|
876
|
+
"items": [
|
|
877
|
+
{
|
|
878
|
+
"key": "accessories[].topicGetCurrentTemperature",
|
|
879
|
+
"flex": "0 0 50%"
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
"key": "accessories[].temperatureUnits",
|
|
883
|
+
"title": "${config.title.sourceUnits}",
|
|
884
|
+
"flex": "0 0 33%"
|
|
885
|
+
}
|
|
886
|
+
]
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
"type": "div",
|
|
890
|
+
"displayFlex": true,
|
|
891
|
+
"flex-direction": "row",
|
|
892
|
+
"items": [
|
|
893
|
+
{
|
|
894
|
+
"key": "accessories[].topicGetTargetTemperature",
|
|
895
|
+
"flex": "0 0 50%"
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
"key": "accessories[].topicSetTargetTemperature",
|
|
899
|
+
"flex": "0 0 50%"
|
|
900
|
+
}
|
|
901
|
+
]
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
"type": "div",
|
|
905
|
+
"displayFlex": true,
|
|
906
|
+
"flex-direction": "row",
|
|
907
|
+
"items": [
|
|
908
|
+
{
|
|
909
|
+
"key": "accessories[].topicGetCurrentRelativeHumidity",
|
|
910
|
+
"title": "${config.title.topicGetCurrentRelativeHumidityOptional}",
|
|
911
|
+
"flex": "0 0 50%"
|
|
912
|
+
}
|
|
913
|
+
]
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
"type": "div",
|
|
917
|
+
"displayFlex": true,
|
|
918
|
+
"flex-direction": "row",
|
|
919
|
+
"items": [
|
|
920
|
+
{
|
|
921
|
+
"key": "accessories[].topicGetTargetRelativeHumidity",
|
|
922
|
+
"flex": "0 0 50%"
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
"key": "accessories[].topicSetTargetRelativeHumidity",
|
|
926
|
+
"flex": "0 0 50%"
|
|
927
|
+
}
|
|
928
|
+
]
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
"type": "div",
|
|
932
|
+
"displayFlex": true,
|
|
933
|
+
"flex-direction": "row",
|
|
934
|
+
"items": [
|
|
935
|
+
{
|
|
936
|
+
"key": "accessories[].topicGetCoolingThresholdTemperature",
|
|
937
|
+
"flex": "0 0 50%"
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
"key": "accessories[].topicSetCoolingThresholdTemperature",
|
|
941
|
+
"flex": "0 0 50%"
|
|
942
|
+
}
|
|
943
|
+
]
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
"type": "div",
|
|
947
|
+
"displayFlex": true,
|
|
948
|
+
"flex-direction": "row",
|
|
949
|
+
"items": [
|
|
950
|
+
{
|
|
951
|
+
"key": "accessories[].topicGetHeatingThresholdTemperature",
|
|
952
|
+
"flex": "0 0 50%"
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
"key": "accessories[].topicSetHeatingThresholdTemperature",
|
|
956
|
+
"flex": "0 0 50%"
|
|
957
|
+
}
|
|
958
|
+
]
|
|
959
|
+
}
|
|
960
|
+
]
|
|
961
|
+
},
|
|
771
962
|
{
|
|
772
963
|
"type": "div",
|
|
773
964
|
"displayFlex": true,
|
|
@@ -926,6 +1117,32 @@
|
|
|
926
1117
|
}
|
|
927
1118
|
]
|
|
928
1119
|
},
|
|
1120
|
+
{
|
|
1121
|
+
"type": "div",
|
|
1122
|
+
"displayFlex": true,
|
|
1123
|
+
"flex-direction": "row",
|
|
1124
|
+
"condition": {
|
|
1125
|
+
"functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Thermostat';"
|
|
1126
|
+
},
|
|
1127
|
+
"items": [
|
|
1128
|
+
{
|
|
1129
|
+
"key": "accessories[].valueModeAuto",
|
|
1130
|
+
"flex": "0 0 25%"
|
|
1131
|
+
},
|
|
1132
|
+
{
|
|
1133
|
+
"key": "accessories[].valueModeCool",
|
|
1134
|
+
"flex": "0 0 25%"
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
"key": "accessories[].valueModeHeat",
|
|
1138
|
+
"flex": "0 0 25%"
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
"key": "accessories[].valueModeOff",
|
|
1142
|
+
"flex": "0 0 25%"
|
|
1143
|
+
}
|
|
1144
|
+
]
|
|
1145
|
+
},
|
|
929
1146
|
{
|
|
930
1147
|
"type": "div",
|
|
931
1148
|
"displayFlex": true,
|
|
@@ -3,8 +3,7 @@ import { MQTTAccessory } from './mqtt.js';
|
|
|
3
3
|
import { CharacteristicType, BaseAccessoryConfig, ServiceType } from '../../model/types.js';
|
|
4
4
|
import { Log } from '../../tools/log.js';
|
|
5
5
|
export declare abstract class BaseAccessory<C extends BaseAccessoryConfig = BaseAccessoryConfig> extends MQTTAccessory<C> {
|
|
6
|
-
constructor(Service: ServiceType, Characteristic: CharacteristicType, accessory: PlatformAccessory, config: C, log: Log);
|
|
7
|
-
private handleCustomCharacteristics;
|
|
6
|
+
constructor(Service: ServiceType, Characteristic: CharacteristicType, accessory: PlatformAccessory, config: C, log: Log, isGrouped: boolean);
|
|
8
7
|
private onBatteryLowUpdate;
|
|
9
8
|
private onStatusActiveUpdate;
|
|
10
9
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { MQTTAccessory } from './mqtt.js';
|
|
2
|
-
import { CustomCharacteristic } from './customCharacteristic.js';
|
|
3
2
|
import { PLATFORM_NAME } from '../../homebridge/settings.js';
|
|
4
3
|
import { strings } from '../../i18n/i18n.js';
|
|
5
4
|
import { CharacteristicKey } from '../../model/enums.js';
|
|
6
5
|
import { LogType } from '../../tools/log.js';
|
|
7
6
|
import getVersion from '../../tools/version.js';
|
|
8
7
|
export class BaseAccessory extends MQTTAccessory {
|
|
9
|
-
constructor(Service, Characteristic, accessory, config, log) {
|
|
10
|
-
super(Service, Characteristic, accessory, config, log);
|
|
8
|
+
constructor(Service, Characteristic, accessory, config, log, isGrouped) {
|
|
9
|
+
super(Service, Characteristic, accessory, config, log, isGrouped);
|
|
11
10
|
accessory.getService(Service.AccessoryInformation)
|
|
12
11
|
.setCharacteristic(Characteristic.Name, config.info.name)
|
|
13
12
|
.setCharacteristic(Characteristic.ConfiguredName, config.info.name)
|
|
@@ -18,24 +17,6 @@ export class BaseAccessory extends MQTTAccessory {
|
|
|
18
17
|
this.setupCharacteristic(CharacteristicKey.BatteryLevel, 100, 'topicGetBatteryLevel', this.bindOnUpdateNumeric(CharacteristicKey.BatteryLevel, strings.accessory.batteryLevel), false);
|
|
19
18
|
this.setupCharacteristic(CharacteristicKey.StatusLowBattery, false, 'topicGetBatteryLow', this.onBatteryLowUpdate.bind(this), false);
|
|
20
19
|
this.setupCharacteristic(CharacteristicKey.StatusActive, true, 'topicGetStatusActive', this.onStatusActiveUpdate.bind(this), false);
|
|
21
|
-
this.handleCustomCharacteristics();
|
|
22
|
-
}
|
|
23
|
-
handleCustomCharacteristics() {
|
|
24
|
-
const keepUUIDs = new Set(Object.values(CharacteristicKey).map((key) => this.Characteristic[key].UUID));
|
|
25
|
-
const toRemove = this.accessoryService.characteristics.filter((characteristic) => !keepUUIDs.has(characteristic.UUID));
|
|
26
|
-
for (const characteristic of toRemove) {
|
|
27
|
-
characteristic.updateValue(null);
|
|
28
|
-
this.accessoryService.removeCharacteristic(characteristic);
|
|
29
|
-
}
|
|
30
|
-
if (!this.config.customCharacteristics) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
for (const config of this.config.customCharacteristics) {
|
|
34
|
-
const customChar = CustomCharacteristic.create(this.accessoryService, this.Characteristic, config, this.name, this.log, this.config.disableLogging);
|
|
35
|
-
if (customChar !== undefined) {
|
|
36
|
-
this.addTopicHandler(customChar.topic, customChar.onUpdateHandler);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
20
|
}
|
|
40
21
|
async onBatteryLowUpdate(topic, value) {
|
|
41
22
|
const batteryLow = value === this.getPrimitiveValue('valueBatteryLow');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/accessory/abstract/base.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/accessory/abstract/base.ts"],"names":[],"mappings":"AAEA,O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,YAAY,EAAE,CAAC;YACjB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PlatformAccessory } from 'homebridge';
|
|
2
|
+
import { BaseAccessoryConfig, CharacteristicType, ServiceType } from '../../model/types.js';
|
|
3
|
+
import { Log } from '../../tools/log.js';
|
|
4
|
+
export declare class GroupAccessory {
|
|
5
|
+
private readonly accessories;
|
|
6
|
+
constructor(Service: ServiceType, Characteristic: CharacteristicType, platformAccessory: PlatformAccessory, log: Log, name: string, configs: BaseAccessoryConfig[]);
|
|
7
|
+
teardown(): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createAccessory } from './helper.js';
|
|
2
|
+
import { PLATFORM_NAME } from '../../homebridge/settings.js';
|
|
3
|
+
import getVersion from '../../tools/version.js';
|
|
4
|
+
export class GroupAccessory {
|
|
5
|
+
accessories = [];
|
|
6
|
+
constructor(Service, Characteristic, platformAccessory, log, name, configs) {
|
|
7
|
+
if (configs.length === 0) {
|
|
8
|
+
throw new Error('Trying to create a group with no accessories');
|
|
9
|
+
}
|
|
10
|
+
platformAccessory.getService(Service.AccessoryInformation)
|
|
11
|
+
.setCharacteristic(Characteristic.Name, name)
|
|
12
|
+
.setCharacteristic(Characteristic.ConfiguredName, name)
|
|
13
|
+
.setCharacteristic(Characteristic.Manufacturer, configs[0].info.manufacturer ?? PLATFORM_NAME)
|
|
14
|
+
.setCharacteristic(Characteristic.Model, configs[0].info.model ?? GroupAccessory.name)
|
|
15
|
+
.setCharacteristic(Characteristic.SerialNumber, configs[0].info.serialNumber ?? name)
|
|
16
|
+
.setCharacteristic(Characteristic.FirmwareRevision, configs[0].info.version ?? getVersion());
|
|
17
|
+
const keepSubtypes = new Set();
|
|
18
|
+
for (const config of configs) {
|
|
19
|
+
const accessory = createAccessory(Service, Characteristic, platformAccessory, config, log, true);
|
|
20
|
+
if (!accessory) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
keepSubtypes.add(accessory.subtype);
|
|
24
|
+
this.accessories.push(accessory);
|
|
25
|
+
}
|
|
26
|
+
;
|
|
27
|
+
for (const service of [...platformAccessory.services]) {
|
|
28
|
+
if (service.subtype && !keepSubtypes.has(service.subtype)) {
|
|
29
|
+
platformAccessory.removeService(service);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
teardown() {
|
|
34
|
+
this.accessories.forEach(accessory => {
|
|
35
|
+
accessory.teardown();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/accessory/abstract/group.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,MAAM,OAAO,cAAc;IAER,WAAW,GAA2C,EAAE,CAAC;IAE1E,YACE,OAAoB,EACpB,cAAkC,EAClC,iBAAoC,EACpC,GAAQ,EACR,IAAY,EACZ,OAA8B;QAG9B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QAED,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,oBAAoB,CAAE;aACxD,iBAAiB,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC;aAC5C,iBAAiB,CAAC,cAAc,CAAC,cAAc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AE,SAAS,CAAC,EAAE;YACpC,SAAS,CAAC,QAAQ,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PlatformAccessory } from 'homebridge';
|
|
2
|
+
import { BaseAccessory } from './base.js';
|
|
3
|
+
import * as Configs from '../../model/types.js';
|
|
4
|
+
import { Log } from '../../tools/log.js';
|
|
5
|
+
export declare function createAccessory(Service: Configs.ServiceType, Characteristic: Configs.CharacteristicType, platformAccessory: PlatformAccessory, accessoryConfig: Configs.BaseAccessoryConfig, log: Log, isGrouped?: boolean): BaseAccessory | undefined;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { strings } from '../../i18n/i18n.js';
|
|
2
|
+
import { AccessoryType } from '../../model/enums.js';
|
|
3
|
+
import { LockMechanismAccessory } from '../lock.js';
|
|
4
|
+
import { SecuritySystemAccessory } from '../security.js';
|
|
5
|
+
import { ThermostatAccessory } from '../thermostat.js';
|
|
6
|
+
import { LightbulbAccessory } from '../onoff/lightbulb.js';
|
|
7
|
+
import { OutletAccessory } from '../onoff/outlet.js';
|
|
8
|
+
import { SwitchAccessory } from '../onoff/switch.js';
|
|
9
|
+
import { CO2SensorAccessory } from '../sensor/carbonDioxide.js';
|
|
10
|
+
import { COSensorAccessory } from '../sensor/carbonMonoxide.js';
|
|
11
|
+
import { ContactSensorAccessory } from '../sensor/contact.js';
|
|
12
|
+
import { HumiditySensorAccessory } from '../sensor/humidity.js';
|
|
13
|
+
import { LeakSensorAccessory } from '../sensor/leak.js';
|
|
14
|
+
import { MotionSensorAccessory } from '../sensor/motion.js';
|
|
15
|
+
import { OccupancySensorAccessory } from '../sensor/occupancy.js';
|
|
16
|
+
import { SmokeSensorAccessory } from '../sensor/smoke.js';
|
|
17
|
+
import { TemperatureSensorAccessory } from '../sensor/temperature.js';
|
|
18
|
+
export function createAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped = false) {
|
|
19
|
+
switch (accessoryConfig.info.type) {
|
|
20
|
+
case AccessoryType.CarbonDioxideSensor:
|
|
21
|
+
return new CO2SensorAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
22
|
+
case AccessoryType.CarbonMonoxideSensor:
|
|
23
|
+
return new COSensorAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
24
|
+
case AccessoryType.ContactSensor:
|
|
25
|
+
return new ContactSensorAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
26
|
+
case AccessoryType.HumiditySensor:
|
|
27
|
+
return new HumiditySensorAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
28
|
+
case AccessoryType.LeakSensor:
|
|
29
|
+
return new LeakSensorAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
30
|
+
case AccessoryType.Lightbulb:
|
|
31
|
+
return new LightbulbAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
32
|
+
case AccessoryType.LockMechanism:
|
|
33
|
+
return new LockMechanismAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
34
|
+
case AccessoryType.MotionSensor:
|
|
35
|
+
return new MotionSensorAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
36
|
+
case AccessoryType.OccupancySensor:
|
|
37
|
+
return new OccupancySensorAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
38
|
+
case AccessoryType.Outlet:
|
|
39
|
+
return new OutletAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
40
|
+
case AccessoryType.SecuritySystem:
|
|
41
|
+
return new SecuritySystemAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
42
|
+
case AccessoryType.SmokeSensor:
|
|
43
|
+
return new SmokeSensorAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
44
|
+
case AccessoryType.Switch:
|
|
45
|
+
return new SwitchAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
46
|
+
case AccessoryType.TemperatureSensor:
|
|
47
|
+
return new TemperatureSensorAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
48
|
+
case AccessoryType.Thermostat:
|
|
49
|
+
return new ThermostatAccessory(Service, Characteristic, platformAccessory, accessoryConfig, log, isGrouped);
|
|
50
|
+
}
|
|
51
|
+
log.error(strings.startup.unsupportedType, accessoryConfig.info.type);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/accessory/abstract/helper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,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AE,iBAAiB,EAAE,eAA2C,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;IAC1I,CAAC;IAED,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { Characteristic, CharacteristicSetHandler, CharacteristicValue, PlatformAccessory, PrimitiveTypes
|
|
2
|
-
import { CharacteristicKey } from '../../model/enums.js';
|
|
3
|
-
import { CharacteristicType, MQTTAccessoryConfig, ServiceType } from '../../model/types.js';
|
|
1
|
+
import { Characteristic, CharacteristicSetHandler, CharacteristicValue, PlatformAccessory, PrimitiveTypes } from 'homebridge';
|
|
2
|
+
import { AccessoryType, CharacteristicKey } from '../../model/enums.js';
|
|
3
|
+
import { CharacteristicType, MQTTAccessoryConfig, ServiceType, TemperatureConfig } from '../../model/types.js';
|
|
4
4
|
import { Log, LogType } from '../../tools/log.js';
|
|
5
5
|
type OnUpdateHandler = (topic: string, value: PrimitiveTypes) => (Promise<void>);
|
|
6
6
|
export declare abstract class MQTTAccessory<C extends MQTTAccessoryConfig> {
|
|
7
|
-
protected readonly Service: ServiceType;
|
|
8
7
|
protected readonly Characteristic: CharacteristicType;
|
|
9
|
-
protected readonly accessory: PlatformAccessory;
|
|
10
8
|
protected readonly config: C;
|
|
11
9
|
protected readonly log: Log;
|
|
12
10
|
private readonly mqttClient;
|
|
13
11
|
private readonly properties;
|
|
14
12
|
private readonly topicHandlers;
|
|
15
|
-
|
|
16
|
-
constructor(Service: ServiceType, Characteristic: CharacteristicType, accessory: PlatformAccessory, config: C, log: Log);
|
|
17
|
-
protected abstract
|
|
13
|
+
private readonly accessoryService;
|
|
14
|
+
constructor(Service: ServiceType, Characteristic: CharacteristicType, accessory: PlatformAccessory, config: C, log: Log, isGrouped: boolean);
|
|
15
|
+
protected abstract getAccessoryType(): AccessoryType;
|
|
18
16
|
protected get name(): string;
|
|
17
|
+
get subtype(): string | undefined;
|
|
18
|
+
private setupCustomCharacteristics;
|
|
19
19
|
protected setupCharacteristic(characteristicKey: CharacteristicKey, defaultValue: CharacteristicValue, getTopicKey: keyof C, onUpdateHandler: OnUpdateHandler, assertGetTopic: boolean, setTopicKey?: keyof C | undefined, onSetHandler?: CharacteristicSetHandler | undefined): Characteristic | undefined;
|
|
20
20
|
protected bindOnUpdateNumeric(charKey: CharacteristicKey, logTemplate: string): OnUpdateHandler;
|
|
21
21
|
protected bindOnUpdateNumericBoolean(charKey: CharacteristicKey, valueKey: keyof C, logTrue: string, logFalse: string): OnUpdateHandler;
|
|
22
|
+
protected bindTemperatureUpdate<C extends TemperatureConfig>(config: C, charKey: CharacteristicKey, logTemplate: string): OnUpdateHandler;
|
|
22
23
|
protected addTopicHandler(topic: string, handler: (topic: string, value: PrimitiveTypes) => Promise<void>): void;
|
|
23
24
|
protected getRawValue(property: keyof C, assert?: boolean): string | undefined;
|
|
24
25
|
protected getPrimitiveValue(property: keyof C, assert?: boolean): PrimitiveTypes | undefined;
|
|
25
26
|
protected publish(topic: string, value: PrimitiveTypes): void;
|
|
26
27
|
teardown(): void;
|
|
27
28
|
protected assert(...keys: (keyof C)[]): boolean;
|
|
29
|
+
protected setCharacteristicValue(key: CharacteristicKey, value: CharacteristicValue): void;
|
|
28
30
|
protected onUpdate(key: CharacteristicKey, value: CharacteristicValue, logString?: string | undefined): boolean;
|
|
29
31
|
protected onSet(key: CharacteristicKey, value: CharacteristicValue, publish: PrimitiveTypes, topic: keyof C, logString: string | undefined): void;
|
|
30
32
|
protected logIfDesired(message: string, ...parameters: string[]): void;
|