homebridge-easy-mqtt 2.1.3 → 2.2.0-beta.1

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 CHANGED
@@ -2,7 +2,10 @@
2
2
 
3
3
  All notable changes to homebridge-easy-mqtt will be documented in this file.
4
4
 
5
- ## 2.1.3 (2026-10-11)
5
+ ## 2.2.0-beta.1 ()
6
+
7
+ ### Added
8
+ - [Irrigation System]() for properly grouping multiple valves ([#311](https://github.com/mpatfield/homebridge-easy-mqtt/issues/311))
6
9
 
7
10
  ### Changed
8
11
  - Updated dependencies
@@ -10,6 +13,11 @@ All notable changes to homebridge-easy-mqtt will be documented in this file.
10
13
  ### Notes
11
14
  - Please consider giving this plugin a ⭐️ on [GitHub](https://github.com/mpatfield/homebridge-easy-mqtt) if you're finding it useful!
12
15
 
16
+ ## 2.1.3 (2026-10-11)
17
+
18
+ ### Changed
19
+ - Updated dependencies
20
+
13
21
  ## 2.1.2 (2026-09-08)
14
22
 
15
23
  ### Changed
@@ -21,8 +21,8 @@
21
21
  "type": {
22
22
  "type": "string",
23
23
  "title": "Type",
24
- "enum": [ "AirPurifier", "AirQualitySensor", "CarbonMonoxideSensor", "CarbonDioxideSensor", "ContactSensor", "Doorbell", "Fanv2", "GarageDoorOpener", "HeaterCooler", "HumiditySensor", "LeakSensor", "Lightbulb", "LightSensor", "LockMechanism", "MotionSensor", "OccupancySensor", "Outlet", "SecuritySystem", "SmokeSensor", "StatelessProgrammableSwitch", "Switch", "TemperatureSensor", "Thermostat", "Valve", "Window", "WindowCovering"],
25
- "enumNames": ["Air Purifier", "Air Quality Sensor", "CO Sensor", "CO2 Sensor", "Contact Sensor", "Doorbell", "Fan (v2)", "Garage Door", "Heater/Cooler", "Humidity Sensor", "Leak Sensor", "Lightbulb", "Light Sensor", "Lock Mechanism", "Motion Sensor", "Occupancy Sensor", "Outlet", "Security System", "Smoke Sensor", "Stateless Switch", "Switch", "Temperature Sensor", "Thermostat", "Valve", "Window", "Window Covering"],
24
+ "enum": [ "AirPurifier", "AirQualitySensor", "CarbonMonoxideSensor", "CarbonDioxideSensor", "ContactSensor", "Doorbell", "Fanv2", "GarageDoorOpener", "HeaterCooler", "HumiditySensor", "IrrigationSystem", "LeakSensor", "Lightbulb", "LightSensor", "LockMechanism", "MotionSensor", "OccupancySensor", "Outlet", "SecuritySystem", "SmokeSensor", "StatelessProgrammableSwitch", "Switch", "TemperatureSensor", "Thermostat", "Valve", "Window", "WindowCovering"],
25
+ "enumNames": ["Air Purifier", "Air Quality Sensor", "CO Sensor", "CO2 Sensor", "Contact Sensor", "Doorbell", "Fan (v2)", "Garage Door", "Heater/Cooler", "Humidity Sensor", "Irrigation System", "Leak Sensor", "Lightbulb", "Light Sensor", "Lock Mechanism", "Motion Sensor", "Occupancy Sensor", "Outlet", "Security System", "Smoke Sensor", "Stateless Switch", "Switch", "Temperature Sensor", "Thermostat", "Valve", "Window", "Window Covering"],
26
26
  "required": true
27
27
  },
28
28
  "protocol": {
@@ -123,6 +123,49 @@
123
123
  "type": "string"
124
124
  }
125
125
  }
126
+ },
127
+ "valve": {
128
+ "type": "object",
129
+ "properties": {
130
+ "id": {
131
+ "type": "string"
132
+ },
133
+ "name": {
134
+ "type": "string",
135
+ "title": "Name",
136
+ "required": true
137
+ },
138
+ "topicGetValveActive": {
139
+ "type": "string",
140
+ "title": "Get Active*"
141
+ },
142
+ "topicSetValveActive": {
143
+ "type": "string",
144
+ "title": "Set Active*"
145
+ },
146
+ "topicGetValveInUse": {
147
+ "type": "string",
148
+ "title": "Get In Use*"
149
+ },
150
+ "topicGetValveRemainingDuration": {
151
+ "type": "string",
152
+ "title": "Get Duration Remaining"
153
+ }
154
+ },
155
+ "allOf": [
156
+ {
157
+ "if": {
158
+ "properties": {
159
+ "name": {
160
+ }
161
+ },
162
+ "required": ["name"]
163
+ },
164
+ "then": {
165
+ "required": ["topicGetValveActive", "topicSetValveActive", "topicGetValveInUse"]
166
+ }
167
+ }
168
+ ]
126
169
  }
127
170
  },
128
171
  "properties": {
@@ -206,6 +249,10 @@
206
249
  "enum": ["GENERIC_VALVE", "IRRIGATION", "SHOWER_HEAD", "WATER_FAUCET"],
207
250
  "enumNames": ["Generic", "Irrigation", "Shower Head", "Water Faucet"]
208
251
  },
252
+ "valves": {
253
+ "type": "array",
254
+ "items": { "$ref": "#/definitions/valve" }
255
+ },
209
256
  "minimumDuration": {
210
257
  "type": "integer",
211
258
  "title": "Minimum Duration (Minutes)",
@@ -1850,6 +1897,22 @@
1850
1897
  "then": {
1851
1898
  "required": ["topicGetMuted"]
1852
1899
  }
1900
+ },
1901
+ {
1902
+ "if": {
1903
+ "properties": {
1904
+ "info": {
1905
+ "properties": {
1906
+ "type" : {
1907
+ "const": "IrrigationSystem"
1908
+ }
1909
+ }
1910
+ }
1911
+ }
1912
+ },
1913
+ "then": {
1914
+ "required": ["valves", "valueActive", "valueInactive", "valueInUse"]
1915
+ }
1853
1916
  }
1854
1917
  ]
1855
1918
  },
@@ -1925,7 +1988,7 @@
1925
1988
  "type": "fieldset",
1926
1989
  "notitle": true,
1927
1990
  "condition": {
1928
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Valve';"
1991
+ "functionBody": "return ['IrrigationSystem', 'Valve'].includes(model.accessories?.[arguments[1]]?.info?.type);"
1929
1992
  },
1930
1993
  "items": [
1931
1994
  {
@@ -3405,6 +3468,58 @@
3405
3468
  }
3406
3469
  ]
3407
3470
  },
3471
+ {
3472
+ "type": "array",
3473
+ "key": "accessories[].valves",
3474
+ "title": "Valve",
3475
+ "notitle": true,
3476
+ "condition": {
3477
+ "functionBody": "return ['IrrigationSystem'].includes(model.accessories?.[arguments[1]]?.info?.type);"
3478
+ },
3479
+ "items": [
3480
+ {
3481
+ "type": "fieldset",
3482
+ "expandable": true,
3483
+ "title": "Valve",
3484
+ "items": [
3485
+ {
3486
+ "type": "div",
3487
+ "displayFlex": true,
3488
+ "flex-direction": "row",
3489
+ "items": [
3490
+ {
3491
+ "key": "accessories[].valves[].name",
3492
+ "flex": "0 0 34%"
3493
+ },
3494
+ {
3495
+ "key": "accessories[].valves[].topicGetValveInUse",
3496
+ "flex": "0 0 33%"
3497
+ },
3498
+ {
3499
+ "key": "accessories[].valves[].topicGetValveRemainingDuration",
3500
+ "flex": "0 0 33%"
3501
+ }
3502
+ ]
3503
+ },
3504
+ {
3505
+ "type": "div",
3506
+ "displayFlex": true,
3507
+ "flex-direction": "row",
3508
+ "items": [
3509
+ {
3510
+ "key": "accessories[].valves[].topicGetValveActive",
3511
+ "flex": "0 0 50%"
3512
+ },
3513
+ {
3514
+ "key": "accessories[].valves[].topicSetValveActive",
3515
+ "flex": "0 0 50%"
3516
+ }
3517
+ ]
3518
+ }
3519
+ ]
3520
+ }
3521
+ ]
3522
+ },
3408
3523
  {
3409
3524
  "type": "fieldset",
3410
3525
  "title": "Values",
@@ -3756,7 +3871,7 @@
3756
3871
  "type": "fieldset",
3757
3872
  "notitle": true,
3758
3873
  "condition": {
3759
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Valve';"
3874
+ "functionBody": "return ['IrrigationSystem', 'Valve'].includes(model.accessories?.[arguments[1]]?.info?.type);"
3760
3875
  },
3761
3876
  "items": [
3762
3877
  {
@@ -21,8 +21,8 @@
21
21
  "type": {
22
22
  "type": "string",
23
23
  "title": "${config.title.type}",
24
- "enum": [ "AirPurifier", "AirQualitySensor", "CarbonMonoxideSensor", "CarbonDioxideSensor", "ContactSensor", "Doorbell", "Fanv2", "GarageDoorOpener", "HeaterCooler", "HumiditySensor", "LeakSensor", "Lightbulb", "LightSensor", "LockMechanism", "MotionSensor", "OccupancySensor", "Outlet", "SecuritySystem", "SmokeSensor", "StatelessProgrammableSwitch", "Switch", "TemperatureSensor", "Thermostat", "Valve", "Window", "WindowCovering"],
25
- "enumNames": ["${config.enumNames.airPurifier}", "${config.enumNames.airQualitySensor}", "${config.enumNames.carbonMonoxideSensor}", "${config.enumNames.carbonDioxideSensor}", "${config.enumNames.contactSensor}", "${config.enumNames.doorbell}", "${config.enumNames.fanv2}", "${config.enumNames.garageDoorOpener}", "${config.enumNames.heaterCooler}", "${config.enumNames.humiditySensor}", "${config.enumNames.leakSensor}", "${config.enumNames.lightbulb}", "${config.enumNames.lightSensor}", "${config.enumNames.lockMechanism}", "${config.enumNames.motionSensor}", "${config.enumNames.occupancySensor}", "${config.enumNames.outlet}", "${config.enumNames.securitySystem}", "${config.enumNames.smokeSensor}", "${config.enumNames.statelessSwitch}", "${config.enumNames.switch}", "${config.enumNames.temperatureSensor}", "${config.enumNames.thermostat}", "${config.enumNames.valve}", "${config.enumNames.window}", "${config.enumNames.windowCovering}"],
24
+ "enum": [ "AirPurifier", "AirQualitySensor", "CarbonMonoxideSensor", "CarbonDioxideSensor", "ContactSensor", "Doorbell", "Fanv2", "GarageDoorOpener", "HeaterCooler", "HumiditySensor", "IrrigationSystem", "LeakSensor", "Lightbulb", "LightSensor", "LockMechanism", "MotionSensor", "OccupancySensor", "Outlet", "SecuritySystem", "SmokeSensor", "StatelessProgrammableSwitch", "Switch", "TemperatureSensor", "Thermostat", "Valve", "Window", "WindowCovering"],
25
+ "enumNames": ["${config.enumNames.airPurifier}", "${config.enumNames.airQualitySensor}", "${config.enumNames.carbonMonoxideSensor}", "${config.enumNames.carbonDioxideSensor}", "${config.enumNames.contactSensor}", "${config.enumNames.doorbell}", "${config.enumNames.fanv2}", "${config.enumNames.garageDoorOpener}", "${config.enumNames.heaterCooler}", "${config.enumNames.humiditySensor}", "${config.enumNames.irrigationSystem}", "${config.enumNames.leakSensor}", "${config.enumNames.lightbulb}", "${config.enumNames.lightSensor}", "${config.enumNames.lockMechanism}", "${config.enumNames.motionSensor}", "${config.enumNames.occupancySensor}", "${config.enumNames.outlet}", "${config.enumNames.securitySystem}", "${config.enumNames.smokeSensor}", "${config.enumNames.statelessSwitch}", "${config.enumNames.switch}", "${config.enumNames.temperatureSensor}", "${config.enumNames.thermostat}", "${config.enumNames.valve}", "${config.enumNames.window}", "${config.enumNames.windowCovering}"],
26
26
  "required": true
27
27
  },
28
28
  "protocol": {
@@ -123,6 +123,49 @@
123
123
  "type": "string"
124
124
  }
125
125
  }
126
+ },
127
+ "valve": {
128
+ "type": "object",
129
+ "properties": {
130
+ "id": {
131
+ "type": "string"
132
+ },
133
+ "name": {
134
+ "type": "string",
135
+ "title": "${config.title.name}",
136
+ "required": true
137
+ },
138
+ "topicGetValveActive": {
139
+ "type": "string",
140
+ "title": "${config.title.topicGetValveActive}"
141
+ },
142
+ "topicSetValveActive": {
143
+ "type": "string",
144
+ "title": "${config.title.topicSetValveActive}"
145
+ },
146
+ "topicGetValveInUse": {
147
+ "type": "string",
148
+ "title": "${config.title.topicGetValveInUse}"
149
+ },
150
+ "topicGetValveRemainingDuration": {
151
+ "type": "string",
152
+ "title": "${config.title.topicGetValveRemainingDuration}"
153
+ }
154
+ },
155
+ "allOf": [
156
+ {
157
+ "if": {
158
+ "properties": {
159
+ "name": {
160
+ }
161
+ },
162
+ "required": ["name"]
163
+ },
164
+ "then": {
165
+ "required": ["topicGetValveActive", "topicSetValveActive", "topicGetValveInUse"]
166
+ }
167
+ }
168
+ ]
126
169
  }
127
170
  },
128
171
  "properties": {
@@ -206,6 +249,10 @@
206
249
  "enum": ["GENERIC_VALVE", "IRRIGATION", "SHOWER_HEAD", "WATER_FAUCET"],
207
250
  "enumNames": ["${config.enumNames.valveGeneric}", "${config.enumNames.valveIrrigation}", "${config.enumNames.valveShower}", "${config.enumNames.valveFaucet}"]
208
251
  },
252
+ "valves": {
253
+ "type": "array",
254
+ "items": { "$ref": "#/definitions/valve" }
255
+ },
209
256
  "minimumDuration": {
210
257
  "type": "integer",
211
258
  "title": "${config.title.minimumDuration}",
@@ -1850,6 +1897,22 @@
1850
1897
  "then": {
1851
1898
  "required": ["topicGetMuted"]
1852
1899
  }
1900
+ },
1901
+ {
1902
+ "if": {
1903
+ "properties": {
1904
+ "info": {
1905
+ "properties": {
1906
+ "type" : {
1907
+ "const": "IrrigationSystem"
1908
+ }
1909
+ }
1910
+ }
1911
+ }
1912
+ },
1913
+ "then": {
1914
+ "required": ["valves", "valueActive", "valueInactive", "valueInUse"]
1915
+ }
1853
1916
  }
1854
1917
  ]
1855
1918
  },
@@ -1925,7 +1988,7 @@
1925
1988
  "type": "fieldset",
1926
1989
  "notitle": true,
1927
1990
  "condition": {
1928
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Valve';"
1991
+ "functionBody": "return ['IrrigationSystem', 'Valve'].includes(model.accessories?.[arguments[1]]?.info?.type);"
1929
1992
  },
1930
1993
  "items": [
1931
1994
  {
@@ -3405,6 +3468,58 @@
3405
3468
  }
3406
3469
  ]
3407
3470
  },
3471
+ {
3472
+ "type": "array",
3473
+ "key": "accessories[].valves",
3474
+ "title": "${config.title.valve}",
3475
+ "notitle": true,
3476
+ "condition": {
3477
+ "functionBody": "return ['IrrigationSystem'].includes(model.accessories?.[arguments[1]]?.info?.type);"
3478
+ },
3479
+ "items": [
3480
+ {
3481
+ "type": "fieldset",
3482
+ "expandable": true,
3483
+ "title": "${config.title.valve}",
3484
+ "items": [
3485
+ {
3486
+ "type": "div",
3487
+ "displayFlex": true,
3488
+ "flex-direction": "row",
3489
+ "items": [
3490
+ {
3491
+ "key": "accessories[].valves[].name",
3492
+ "flex": "0 0 34%"
3493
+ },
3494
+ {
3495
+ "key": "accessories[].valves[].topicGetValveInUse",
3496
+ "flex": "0 0 33%"
3497
+ },
3498
+ {
3499
+ "key": "accessories[].valves[].topicGetValveRemainingDuration",
3500
+ "flex": "0 0 33%"
3501
+ }
3502
+ ]
3503
+ },
3504
+ {
3505
+ "type": "div",
3506
+ "displayFlex": true,
3507
+ "flex-direction": "row",
3508
+ "items": [
3509
+ {
3510
+ "key": "accessories[].valves[].topicGetValveActive",
3511
+ "flex": "0 0 50%"
3512
+ },
3513
+ {
3514
+ "key": "accessories[].valves[].topicSetValveActive",
3515
+ "flex": "0 0 50%"
3516
+ }
3517
+ ]
3518
+ }
3519
+ ]
3520
+ }
3521
+ ]
3522
+ },
3408
3523
  {
3409
3524
  "type": "fieldset",
3410
3525
  "title": "${config.title.values}",
@@ -3756,7 +3871,7 @@
3756
3871
  "type": "fieldset",
3757
3872
  "notitle": true,
3758
3873
  "condition": {
3759
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Valve';"
3874
+ "functionBody": "return ['IrrigationSystem', 'Valve'].includes(model.accessories?.[arguments[1]]?.info?.type);"
3760
3875
  },
3761
3876
  "items": [
3762
3877
  {
@@ -25,5 +25,5 @@
25
25
  <footer id="footer" class="text-center" style="display: none; font-style: italic; font-size: 0.9em;" i18n="required"></footer>
26
26
 
27
27
  <script>
28
- (()=>{var i={da:{accessory:"Tilbeh\xF8r",continue:"Forts\xE6t &rarr;",support:'For dokumentation og support bes\xF8g venligst <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"P\xE5kr\xE6vede felter er markeret med en stjerne (*)",thankYou:"Tak fordi du installerede Homebridge Easy MQTT"},de:{accessory:"Zubeh\xF6r",continue:"Setze &rarr; fort",support:'F\xFCr Dokumentation und Unterst\xFCtzung besuchen Sie bitte <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"Erforderliche Felder sind mit einem Sternchen (*) gekennzeichnet",thankYou:"Danke, dass Sie Homebridge Easy MQTT installiert haben"},en:{accessory:"Accessory",continue:"Continue &rarr;",support:'For documentation and support please visit <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"Required fields are marked with an asterisk (*)",thankYou:"Thank you for installing Homebridge Easy MQTT"},fr:{accessory:"Accessoire",continue:"Continuer &rarr;",support:'Pour la documentation et le support, veuillez visiter <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"Les champs obligatoires sont marqu\xE9s d'un ast\xE9risque (*)",thankYou:"Merci d'avoir install\xE9 Homebridge Easy MQTT"},it:{accessory:"Accessorio",continue:"Continua &rarr;",support:'Per documentazione e supporto visita <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"I campi obbligatori sono contrassegnati con un asterisco (*)",thankYou:"Grazie per aver installato Homebridge Easy MQTT"},ro:{accessory:"Accesoriu",continue:"Continu\u0103 &rarr;",support:'Pentru documenta\u021Bie \u0219i suport, v\u0103 rug\u0103m s\u0103 vizita\u021Bi <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"C\xE2mpurile obligatorii sunt marcate cu asterisc (*)",thankYou:"V\u0103 mul\u021Bumim c\u0103 a\u021Bi instalat Homebridge Easy MQTT"},vi:{accessory:"Thi\u1EBFt b\u1ECB",continue:"Ti\u1EBFp t\u1EE5c &rarr;",support:'Xem t\xE0i li\u1EC7u v\xE0 h\u1ED7 tr\u1EE3 t\u1EA1i <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"C\xE1c tr\u01B0\u1EDDng b\u1EAFt bu\u1ED9c \u0111\u01B0\u1EE3c \u0111\xE1nh d\u1EA5u b\u1EB1ng d\u1EA5u hoa th\u1ECB (*)",thankYou:"C\u1EA3m \u01A1n b\u1EA1n \u0111\xE3 c\xE0i \u0111\u1EB7t Homebridge Easy MQTT"}};function a(){try{return window.parent.document}catch{console.warn("Unable to access parent document (cross-origin). Some UI features disabled.");return}}function c(){document.querySelectorAll("[i18n]").forEach(e=>{let t=e.getAttribute("i18n");e.innerHTML=i[t]})}function s(){let e=a();if(!e)return;let t=Array.from(e.querySelectorAll("fieldset legend"));for(let n of t){let r=n.closest("fieldset")?.querySelector('input[type="text"][name="name"]');r&&n.textContent!==(r.value||i.accessory)&&(n.textContent=r.value!==""?r.value:i.accessory),r&&!r.dataset.accessoryNameListener&&(r.addEventListener("input",()=>s()),r.dataset.accessoryNameListener="true")}}function d(){if(typeof crypto<"u"){if(crypto.randomUUID)return crypto.randomUUID();if(crypto.getRandomValues)return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=crypto.getRandomValues(new Uint8Array(1))[0]&15;return(e==="x"?t:t&3|8).toString(16)})}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function m(e){let t=!1;e.accessories?.forEach(n=>{if(n.info&&!n.info.id){let o=d();n.info.id=o,t=!0}}),t&&homebridge.updatePluginConfig([e])}function u(){document.getElementById("pageIntro").style.display="none",document.getElementById("support").style.display="block",document.getElementById("footer").style.display="block";let e=a();e&&new MutationObserver(()=>{s()}).observe(e.body,{childList:!0,subtree:!0}),homebridge.addEventListener("configChanged",t=>{let n=t.data;n.length&&m(n[0])}),homebridge.showSchemaForm(),homebridge.hideSpinner(),homebridge.enableSaveButton()}function l(){document.getElementById("introContinue").addEventListener("click",async()=>{u()}),document.getElementById("pageIntro").style.display="block",homebridge.hideSpinner()}homebridge.disableSaveButton(),homebridge.showSpinner();(async()=>{let e=await homebridge.i18nCurrentLang();i=e in i?i[e]:i.en,c(),(await homebridge.getPluginConfig()).length?u():(await homebridge.updatePluginConfig([{name:"Easy MQTT"}]),l())})();})();
28
+ (()=>{var n={da:{accessory:"Tilbeh\xF8r",continue:"Forts\xE6t &rarr;",support:'For dokumentation og support bes\xF8g venligst <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"P\xE5kr\xE6vede felter er markeret med en stjerne (*)",thankYou:"Tak fordi du installerede Homebridge Easy MQTT",valve:"Valve"},de:{accessory:"Zubeh\xF6r",continue:"Setze &rarr; fort",support:'F\xFCr Dokumentation und Unterst\xFCtzung besuchen Sie bitte <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"Erforderliche Felder sind mit einem Sternchen (*) gekennzeichnet",thankYou:"Danke, dass Sie Homebridge Easy MQTT installiert haben",valve:"Valve"},en:{accessory:"Accessory",continue:"Continue &rarr;",support:'For documentation and support please visit <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"Required fields are marked with an asterisk (*)",thankYou:"Thank you for installing Homebridge Easy MQTT",valve:"Valve"},fr:{accessory:"Accessoire",continue:"Continuer &rarr;",support:'Pour la documentation et le support, veuillez visiter <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"Les champs obligatoires sont marqu\xE9s d'un ast\xE9risque (*)",thankYou:"Merci d'avoir install\xE9 Homebridge Easy MQTT",valve:"Valve"},it:{accessory:"Accessorio",continue:"Continua &rarr;",support:'Per documentazione e supporto visita <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"I campi obbligatori sono contrassegnati con un asterisco (*)",thankYou:"Grazie per aver installato Homebridge Easy MQTT",valve:"Valve"},ro:{accessory:"Accesoriu",continue:"Continu\u0103 &rarr;",support:'Pentru documenta\u021Bie \u0219i suport, v\u0103 rug\u0103m s\u0103 vizita\u021Bi <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"C\xE2mpurile obligatorii sunt marcate cu asterisc (*)",thankYou:"V\u0103 mul\u021Bumim c\u0103 a\u021Bi instalat Homebridge Easy MQTT",valve:"Valve"},vi:{accessory:"Thi\u1EBFt b\u1ECB",continue:"Ti\u1EBFp t\u1EE5c &rarr;",support:'Xem t\xE0i li\u1EC7u v\xE0 h\u1ED7 tr\u1EE3 t\u1EA1i <a target="_blank" href="https://github.com/mpatfield/homebridge-easy-mqtt/wiki">GitHub</a>',required:"C\xE1c tr\u01B0\u1EDDng b\u1EAFt bu\u1ED9c \u0111\u01B0\u1EE3c \u0111\xE1nh d\u1EA5u b\u1EB1ng d\u1EA5u hoa th\u1ECB (*)",thankYou:"C\u1EA3m \u01A1n b\u1EA1n \u0111\xE3 c\xE0i \u0111\u1EB7t Homebridge Easy MQTT",valve:"Valve"}};function c(){try{return window.parent.document}catch{console.warn("Unable to access parent document (cross-origin). Some UI features disabled.");return}}function m(){document.querySelectorAll("[i18n]").forEach(e=>{let t=e.getAttribute("i18n");e.innerHTML=n[t]})}function d(){let e=c();if(!e)return;let t=Array.from(e.querySelectorAll("fieldset legend"));for(let r of t){let i=r.closest("fieldset")?.querySelector('input[type="text"][name="name"]');if(!i)continue;let a=r.textContent,s=i.value!==""?i.value:a===n.valve?n.valve:n.accessory;a!==s&&(r.textContent=s),i&&!i.dataset.accessoryNameListener&&(i.addEventListener("input",()=>d()),i.dataset.accessoryNameListener="true")}}function u(){if(typeof crypto<"u"){if(crypto.randomUUID)return crypto.randomUUID();if(crypto.getRandomValues)return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=crypto.getRandomValues(new Uint8Array(1))[0]&15;return(e==="x"?t:t&3|8).toString(16)})}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function g(e){let t=!1;e.accessories?.forEach(r=>{r.info&&!r.info.id&&(r.info.id=u(),t=!0),"valves"in r&&Array.isArray(r.valves)&&r.valves.forEach(o=>{o.id||(o.id=u(),t=!0)})}),t&&homebridge.updatePluginConfig([e])}function l(){document.getElementById("pageIntro").style.display="none",document.getElementById("support").style.display="block",document.getElementById("footer").style.display="block";let e=c();e&&new MutationObserver(()=>{d()}).observe(e.body,{childList:!0,subtree:!0}),homebridge.addEventListener("configChanged",t=>{let r=t.data;r.length&&g(r[0])}),homebridge.showSchemaForm(),homebridge.hideSpinner(),homebridge.enableSaveButton()}function b(){document.getElementById("introContinue").addEventListener("click",async()=>{l()}),document.getElementById("pageIntro").style.display="block",homebridge.hideSpinner()}homebridge.disableSaveButton(),homebridge.showSpinner();(async()=>{let e=await homebridge.i18nCurrentLang();n=e in n?n[e]:n.en,m(),(await homebridge.getPluginConfig()).length?l():(await homebridge.updatePluginConfig([{name:"Easy MQTT"}]),b())})();})();
29
29
  </script>
@@ -1,6 +1,7 @@
1
1
  import { strings } from '../../i18n/i18n.js';
2
2
  import { AccessoryType } from '../../model/enums.js';
3
3
  import { GarageDoorAccessory } from '../garage.js';
4
+ import { IrrigationSystemAccessory } from '../irrigation.js';
4
5
  import { LockMechanismAccessory } from '../lock.js';
5
6
  import { SecuritySystemAccessory } from '../security.js';
6
7
  import { ValveAccessory } from '../valve.js';
@@ -53,6 +54,8 @@ export function createHomeKitAccessory(dependency, config, isGrouped = false) {
53
54
  return new HeaterCoolerAccessory(mqttDependency);
54
55
  case AccessoryType.HumiditySensor:
55
56
  return new HumiditySensorAccessory(mqttDependency);
57
+ case AccessoryType.IrrigationSystem:
58
+ return new IrrigationSystemAccessory(mqttDependency);
56
59
  case AccessoryType.LeakSensor:
57
60
  return new LeakSensorAccessory(mqttDependency);
58
61
  case AccessoryType.Lightbulb:
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/homekit/abstract/helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,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2B;YAC5C,OAAO,IAAI,wBAAwB,CAAC,cAA6D,CAAC,CAAC;QACrG,KAAK,aAAa,CAAC,MAAM;YACvB,OAAO,IAAI,eAAe,CAAC,cAA6D,CAAC,CAAC;QAC5F,KAAK,aAAa,CAAC,iBAAiB;YAClC,OAAO,IAAI,0BAA0B,CAAC,cAAwE,CAAC,CAAC;QAClH,KAAK,aAAa,CAAC,UAAU;YAC3B,OAAO,IAAI,mBAAmB,CAAC,cAAiE,CAAC,CAAC;QACpG,KAAK,aAAa,CAAC,KAAK;YACtB,OAAO,IAAI,cAAc,CAAC,cAA4D,CAAC,CAAC;QAC1F,KAAK,aAAa,CAAC,MAAM;YACvB,OAAO,IAAI,eAAe,CAAC,cAA+D,CAAC,CAAC;QAC9F,KAAK,aAAa,CAAC,cAAc;YAC/B,OAAO,IAAI,cAAc,CAAC,cAA4D,CAAC,CAAC;IAC1F,CAAC;IAED,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { HomeKitAccessory } from './abstract/base.js';
2
+ import { AccessoryType } from '../model/enums.js';
3
+ import { MQTTAccessoryDependency } from '../model/homekit.js';
4
+ import { IrrigationSystemConfig } from '../model/types.js';
5
+ export declare class IrrigationSystemAccessory extends HomeKitAccessory<IrrigationSystemConfig> {
6
+ private readonly valveAccessories;
7
+ protected getAccessoryType(): AccessoryType;
8
+ constructor(dependency: MQTTAccessoryDependency<IrrigationSystemConfig>);
9
+ private updateState;
10
+ }
@@ -0,0 +1,77 @@
1
+ import { HomeKitAccessory } from './abstract/base.js';
2
+ import { ValveAccessory } from './valve.js';
3
+ import { strings } from '../i18n/i18n.js';
4
+ import { AccessoryType, ValveType } from '../model/enums.js';
5
+ import { HKCharacteristicKey } from '../model/homekit.js';
6
+ import { assert } from '../tools/validation.js';
7
+ export class IrrigationSystemAccessory extends HomeKitAccessory {
8
+ valveAccessories = [];
9
+ getAccessoryType() {
10
+ return AccessoryType.IrrigationSystem;
11
+ }
12
+ constructor(dependency) {
13
+ super(dependency);
14
+ this.setupTopicless(HKCharacteristicKey.ProgramMode, dependency.Characteristic.ProgramMode.NO_PROGRAM_SCHEDULED);
15
+ this.setupTopicless(HKCharacteristicKey.Active, dependency.Characteristic.Active.INACTIVE);
16
+ this.setupTopicless(HKCharacteristicKey.InUse, dependency.Characteristic.InUse.NOT_IN_USE);
17
+ if (!this.assert('valves', 'valueActive', 'valueInactive', 'valueInUse')) {
18
+ return;
19
+ }
20
+ const valves = dependency.config.valves ?? [];
21
+ valves?.forEach((config, index) => {
22
+ if (config.name === undefined) {
23
+ this.log.error(strings.irrigation.badValveConfig, this.name, '\'name\'');
24
+ return;
25
+ }
26
+ if (!assert(dependency.log, config.name, config, 'topicGetValveInUse', 'topicGetValveActive', 'topicSetValveActive')) {
27
+ return;
28
+ }
29
+ const valveConfig = {
30
+ info: {
31
+ ...(dependency.config.info),
32
+ id: config.id ?? `${this.identifier}_${index + 1}`,
33
+ name: config.name,
34
+ type: AccessoryType.Valve,
35
+ },
36
+ mqtt: dependency.config.mqtt,
37
+ disableLogging: dependency.config.disableLogging,
38
+ valveType: dependency.config.valveType ?? ValveType.IRRIGATION,
39
+ minimumDuration: dependency.config.minimumDuration,
40
+ maximumDuration: dependency.config.maximumDuration,
41
+ simulateDuration: dependency.config.simulateDuration,
42
+ topicGetValveActive: config.topicGetValveActive,
43
+ topicSetValveActive: config.topicSetValveActive,
44
+ topicGetValveInUse: config.topicGetValveInUse,
45
+ topicGetValveRemainingDuration: config.topicGetValveRemainingDuration,
46
+ valueActive: dependency.config.valueActive,
47
+ valueInactive: dependency.config.valueInactive,
48
+ valueInUse: dependency.config.valueInUse,
49
+ };
50
+ const valveAccessory = new ValveAccessory({ ...dependency, config: valveConfig, isGrouped: true });
51
+ valveAccessory.service.setCharacteristic(dependency.Characteristic.ServiceLabelIndex, index + 1);
52
+ valveAccessory.service.setCharacteristic(dependency.Characteristic.IsConfigured, dependency.Characteristic.IsConfigured.CONFIGURED);
53
+ this.service.addLinkedService(valveAccessory.service);
54
+ this.valveAccessories.push(valveAccessory);
55
+ valveAccessory.service.getCharacteristic(dependency.Characteristic.Active).on('change', () => this.updateState());
56
+ valveAccessory.service.getCharacteristic(dependency.Characteristic.InUse).on('change', () => this.updateState());
57
+ });
58
+ const keepSubtypes = new Set(this.valveAccessories.map(accessory => accessory.service.subtype));
59
+ for (const service of [...dependency.platformAccessory.services]) {
60
+ if (service.UUID === dependency.Service.Valve.UUID && service.subtype && !keepSubtypes.has(service.subtype)) {
61
+ dependency.platformAccessory.removeService(service);
62
+ }
63
+ }
64
+ this.updateState();
65
+ }
66
+ updateState() {
67
+ let active = false;
68
+ let inUse = false;
69
+ this.valveAccessories.forEach(valve => {
70
+ active = active || valve.service.getCharacteristic(this.Characteristic.Active).value === this.Characteristic.Active.ACTIVE;
71
+ inUse = inUse || valve.service.getCharacteristic(this.Characteristic.InUse).value === this.Characteristic.InUse.IN_USE;
72
+ });
73
+ this.onUpdate(HKCharacteristicKey.Active, active ? this.Characteristic.Active.ACTIVE : this.Characteristic.Active.INACTIVE);
74
+ this.onUpdate(HKCharacteristicKey.InUse, inUse ? this.Characteristic.InUse.IN_USE : this.Characteristic.InUse.NOT_IN_USE);
75
+ }
76
+ }
77
+ //# sourceMappingURL=irrigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"irrigation.js","sourceRoot":"","sources":["../../src/homekit/irrigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAA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K,CAAC;QAE3B,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAE,KAAK,CAAC,EAAE;YACrC,MAAM,GAAG,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC;YAC3H,KAAK,GAAG,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC;QACzH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5H,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC5H,CAAC;CACF"}
package/dist/i18n/en.d.ts CHANGED
@@ -88,6 +88,7 @@ declare const en: {
88
88
  hours: string;
89
89
  hsb: string;
90
90
  humiditySensor: string;
91
+ irrigationSystem: string;
91
92
  leakSensor: string;
92
93
  lightbulb: string;
93
94
  lightSensor: string;
@@ -333,8 +334,10 @@ declare const en: {
333
334
  valueSwingEnabled: string;
334
335
  valueTampered: string;
335
336
  valueUnmuted: string;
337
+ valve: string;
336
338
  verbose: string;
337
339
  };
340
+ valve: string;
338
341
  };
339
342
  doorbell: {
340
343
  brightnessPercent: string;
@@ -411,6 +414,9 @@ declare const en: {
411
414
  entry: string;
412
415
  updatedCharacteristic: string;
413
416
  };
417
+ irrigation: {
418
+ badValveConfig: string;
419
+ };
414
420
  lightbulb: {
415
421
  badColorType: string;
416
422
  badHexValue: string;
package/dist/i18n/en.js CHANGED
@@ -88,6 +88,7 @@ const en = {
88
88
  hours: 'Hours',
89
89
  hsb: 'HSB (Default)',
90
90
  humiditySensor: 'Humidity Sensor',
91
+ irrigationSystem: 'Irrigation System',
91
92
  leakSensor: 'Leak Sensor',
92
93
  lightbulb: 'Lightbulb',
93
94
  lightSensor: 'Light Sensor',
@@ -333,8 +334,10 @@ const en = {
333
334
  valueSwingEnabled: 'Swing Enabled',
334
335
  valueTampered: 'Tampered',
335
336
  valueUnmuted: 'Unmuted',
337
+ valve: 'Valve',
336
338
  verbose: 'Additional Logging',
337
339
  },
340
+ valve: 'Valve',
338
341
  },
339
342
  doorbell: {
340
343
  brightnessPercent: '%s brightness is %d%', // accessory name, number
@@ -411,6 +414,9 @@ const en = {
411
414
  entry: '%s logging history entry:', // accessory name
412
415
  updatedCharacteristic: '%s updated %s with value %s', // accessory name, characteristic name, value
413
416
  },
417
+ irrigation: {
418
+ badValveConfig: '%s valve config is missing required field: %s', // accessory name, field name
419
+ },
414
420
  lightbulb: {
415
421
  badColorType: '%s has invalid color type %s. Must be one of: %s', // accessory name, input, list of type names
416
422
  badHexValue: '%s expects hex values %s but received %s', // accessory name, example, input