matterbridge-daikin-local 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.9.0] - 2026-10-19
8
+
9
+ ### Changed
10
+
11
+ - [devices]: Add the swing as the rocking of the fan control, a new choice named Native rocking beside the switches, the mode select and not shown: up and down for the vertical swing and left and right for the horizontal one, on the axes the unit swings on. The switches and the select take its place, so the fan control has no rocking beside them, as Apple Home is reported not to handle it well. The Google Home and the Full Matter support presets show the rocking, where they showed no swing and a mode select, or the switches on a unit whose fan speed cannot be set.
12
+
13
+ ### Fixed
14
+
15
+ - [devices]: Write the state of the unit again after a factory reset of the Matter node once the node is back online, instead of as each endpoint comes back. A unit that answered at once held the thermostat as the node went online, which failed the reset and left Matterbridge stuck.
16
+
17
+ ## [0.8.0] - 2026-10-19
18
+
19
+ ### Changed
20
+
21
+ - [setup]: Name each air conditioner in its options in the setup page. The name starts as the one its adapter announces, with a number after it when another device has that name, such as `Bedroom 2`. A new name of the adapter no longer renames the device, and adapters that share a name can each be set up.
22
+ - [devices]: **Breaking:** give a switch, a mode select, a fan or a sensor that is a device of its own the serial number of its air conditioner with a dash before its letter, such as `A4:08:EA:CC:91:D4-V` in place of `A4:08:EA:CC:91:D4V`. A Matter app takes each of them for a new device.
23
+ - [setup]: Say after adding or removing an air conditioner that Matterbridge's own list of devices shows the change once its page is reloaded: Matterbridge does not tell its page when a plugin adds or removes a device.
24
+
25
+ ### Fixed
26
+
27
+ - [devices]: Set the speed nearest the percent a Matter app sets, as the README says, instead of the one above it.
28
+ - [devices]: **Breaking:** the fan modes Low, Medium and High follow, since Matterbridge sets each to the middle percentage of its third: on a unit with Silent and Level 1 to 5 they set Silent, Level 2 and Level 4 instead of Level 1, Level 2 and Level 5, and with auto as the first step Low sets auto.
29
+
7
30
  ## [0.7.0] - 2026-10-15
8
31
 
9
32
  ### Added
package/README.md CHANGED
@@ -18,13 +18,14 @@ It is a [Matterbridge](https://matterbridge.io) plugin built on [daikin-local-co
18
18
 
19
19
  - **It finds your air conditioners for you.** Open the setup page and it searches your network, lists every adapter that answers and says what each one will ask for. There are no IP addresses to look up and no configuration file to edit: see [Guided setup](#guided-setup).
20
20
  - **It works with adapters that ask for their KEY.** Some classic adapters only answer an app they have registered, and some have a child lock code. The setup page asks for each where it is needed, and the plugin does the rest. It is the only Matterbridge plugin that connects to these adapters: see the [comparison](#compared-with-other-daikin-plugins).
21
- - **It keeps working when an adapter gets a new IP address.** The plugin finds the adapter again and updates the address by itself, so an adapter on the same network as Matterbridge needs no fixed address on your router. The same goes for an adapter you rename. See [How devices are stored](#how-devices-are-stored).
21
+ - **It keeps working when an adapter gets a new IP address.** The plugin finds the adapter again and updates the address by itself, so an adapter on the same network as Matterbridge needs no fixed address on your router. Each air conditioner has the name you give it in the setup page, which a new name of its adapter does not change. The other local plugins know an adapter by the address you enter and by its name: see [How devices are stored](#how-devices-are-stored).
22
+ - **It says when a unit stops answering.** After two reads in a row fail, your Matter app shows the air conditioner as unreachable, and it comes back by itself on the first read that works. A unit that is off when Matterbridge starts is still added, from what the plugin stored. None of the other Daikin plugins reports a unit as unreachable.
22
23
  - **Nothing needs a restart.** Add, change, reconnect and remove air conditioners while Matterbridge keeps running.
23
- - **It is more than a thermostat.** Besides power, mode and temperature you get the fan speed, the swing, the dry and fan modes, and Powerful, Econo and Streamer. The humidity and the outdoor temperature appear by themselves on a unit that gives them.
24
+ - **It is more than a thermostat.** Besides power, mode and temperature you get the fan speed, the swing, the dry and fan modes, and Powerful, Econo and Streamer. The humidity appears by itself on a unit that gives it, and the outdoor temperature on a sensor you turn on.
24
25
  - **It fits the Matter app you use.** Matter apps differ in what they show, so you choose how each control appears: the fan speed as steps, as a percentage or on a fan of its own, and a switch for each thing your app has no control for. Presets for Apple Home and Google Home give you a starting point: see [Presets](#presets).
25
26
  - **It offers only what your unit can do.** The plugin asks each unit which modes, fan speeds, swing and temperature limits it has, builds its controls from the answer, and checks again after every start.
26
27
  - **It is quick.** Each unit is read every 5 seconds unless you set otherwise, so what you change on the remote control shows up in your app within seconds. Several changes an app makes together go to the unit as one command.
27
- - **One plugin for every kind of adapter.** The classic adapters, the newer BRP084 and the Airbase adapter (BRP15B61) of a ducted unit work side by side, set up the same way.
28
+ - **One plugin for every kind of adapter.** The classic adapters, the newer BRP084 and the Airbase adapter (BRP15B61) of a ducted unit work side by side, set up the same way. No other Matterbridge plugin speaks to all three.
28
29
 
29
30
  ## Requirements
30
31
 
@@ -53,9 +54,9 @@ Open the plugin frontend from the plugin's row on the Matterbridge home page. It
53
54
  2. **Connect.** For each adapter you picked, the plugin checks what it needs and asks only for that:
54
55
  - the **KEY** printed on the adapter's label, for an adapter that only answers registered apps. It is used once to register the Terminal ID and is not stored;
55
56
  - the **child lock code**, the 4-digit code set under Child lock in the Daikin app the adapter was set up with, for an adapter that has one.
56
- 3. **Options.** How the fan speed, the swing and the extra switches appear in Matter, from what the unit can do. Start from a [preset](#presets) or choose each one yourself.
57
+ 3. **Options.** The name the air conditioner gets in Matter, starting from the name of its adapter, and how the fan speed, the swing and the extra switches appear in Matter, from what the unit can do. Start from a [preset](#presets) or choose each one yourself.
57
58
 
58
- Afterwards the same page lists your air conditioners with their status. From there you can add more, change the options of one, reconnect one that stopped answering, or remove one. None of this needs a Matterbridge restart.
59
+ Afterwards the same page lists your air conditioners with their status. From there you can add more, change the options of one, reconnect one that stopped answering, or remove one. None of this needs a Matterbridge restart. Matterbridge's own list of devices shows an air conditioner added or removed here once you reload its page.
59
60
 
60
61
  <table>
61
62
  <tr>
@@ -117,8 +118,8 @@ Matter describes a device as endpoints. Each endpoint has one or more device typ
117
118
  flowchart TD
118
119
  bridge["Matterbridge<br/>Aggregator"]
119
120
  subgraph device["One device in a Matter app"]
120
- ac["<b>Living Room</b><br/>Room Air Conditioner, Bridged Node, Power Source<br/>On/Off, Thermostat<br/>Fan Control when it is here, and Relative Humidity once the unit gives it"]
121
- fan["Fan<br/>Fan Control"]
121
+ ac["<b>Living Room</b><br/>Room Air Conditioner, Bridged Node, Power Source<br/>On/Off, Thermostat<br/>Fan Control unless the fan speed is hidden or on a fan of its own, with Rocking for the swing when it is chosen, and Relative Humidity once the unit gives it"]
122
+ fan["Fan<br/>Fan Control, with Rocking for the swing when it is chosen"]
122
123
  switches["On/Off Plug-in Unit, one for each switch<br/>tagged 1 Vertical Swing, 2 Horizontal Swing and so on<br/>On/Off"]
123
124
  selects["Mode Select, one for the mode and one for the swing<br/>tagged 1 Mode, 2 Swing<br/>Mode Select"]
124
125
  humidity["Humidity Sensor<br/>Relative Humidity"]
@@ -170,6 +171,8 @@ The room temperature and the humidity are always on the air conditioner. You cho
170
171
  | Percentage | A slider from 0 to 100. The plugin rounds it to the nearest speed of the unit and shows the percentage that speed stands for |
171
172
  | Not shown | No fan control. The fan speed either stays as it is, or is set to the speed you pick each time the plugin sends a command |
172
173
 
174
+ Matter also has the fan modes Low, Medium and High, which apps show as buttons or reach by voice. Matterbridge sets a fan mode picked to the middle percentage of its third, 17 %, 50 % or 84 %, which the plugin rounds to the nearest speed as it does any percentage. On a unit with Silent and Level 1 to 5, Low is Silent, Medium Level 2 and High Level 4. With auto as the first step, Low is auto. A unit with two speeds has Low and High alone, and one with a single speed High alone.
175
+
173
176
  Every Matter fan control has an off position below its first step: speed 0, 0 %, or the fan mode Off. An air conditioner has no fan-off of its own, so a Matter app turning the fan to off or 0 sets the first step instead: the slowest speed, or auto when auto is the first step. To let the unit pick the speed, choose auto, wherever the setup puts it: see [Auto fan speed](#auto-fan-speed).
174
177
 
175
178
  The fan speed is a control of the air conditioner itself. For Matter apps that show no fan speed on an air conditioner, or do not show it well, the setup can move it to a fan of its own instead, named `<name> Fan`, as steps or as a percentage. The air conditioner then has no fan speed, so an app does not show two. No preset does this. The fan behaves the same in either place: it shows the speed the unit holds, also while the unit is off, and setting it to 0 sets the first step. A fan of its own is also on and off with the air conditioner, so an app does not show it running while the unit is off, and turning it on or off turns the air conditioner on or off. An app may turn the fan off when it is dragged to 0, such as Apple Home: the air conditioner then turns off and keeps its fan speed.
@@ -189,13 +192,14 @@ A switch or a step is for Matter apps that show no Auto fan mode. A step takes t
189
192
 
190
193
  ### Swing
191
194
 
192
- | Option | In Matter |
193
- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
194
- | Switches | One on/off switch for each axis the unit swings on, named `<name> Vertical Swing` and `<name> Horizontal Swing`. A unit that swings on one axis gets one switch. They appear as outlets, the on/off device type every Matter app supports |
195
- | Mode select | One mode select named `<name> Swing`, with Off, Vertical, Horizontal and 3D for the swing modes the unit has. Few Matter apps show it: see [Mode selects](#mode-selects) |
196
- | Not shown | No swing control. The swing either stays as it is, or is set to the mode you pick each time the plugin sends a command |
195
+ | Option | In Matter |
196
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
197
+ | Native rocking | The rocking of the fan control, as Matter has it: up and down for the vertical swing, left and right for the horizontal one, and both for 3D, on the axes the unit swings on. Not every app shows it, and Apple Home is reported not to handle it well |
198
+ | Switches | One on/off switch for each axis the unit swings on, named `<name> Vertical Swing` and `<name> Horizontal Swing`. A unit that swings on one axis gets one switch. They appear as outlets, the on/off device type every Matter app supports |
199
+ | Mode select | One mode select named `<name> Swing`, with Off, Vertical, Horizontal and 3D for the swing modes the unit has. Few Matter apps show it: see [Mode selects](#mode-selects) |
200
+ | Not shown | No swing control. The swing either stays as it is, or is set to the mode you pick each time the plugin sends a command |
197
201
 
198
- Fixed louver positions are not controlled from Matter.
202
+ The switches and the select are for the Matter apps that show no rocking, or do not handle it well: they take its place, so the fan control has no rocking beside them. A unit whose fan speed is not shown has no fan control, and so no rocking: native rocking falls back to the switches. Fixed louver positions are not controlled from Matter.
199
203
 
200
204
  ### Modes
201
205
 
@@ -229,7 +233,7 @@ Each Matter mode the unit lacks can run one of its modes instead, as you pick, s
229
233
 
230
234
  ### Mode selects
231
235
 
232
- A mode select is the Matter device type that picks one value from a list, as a drop-down does. The setup can add one for the mode, named `<name> Mode`, on a unit with a dry or a fan mode, and one for the swing, named `<name> Swing`, as a choice under [Swing](#swing). Each lists only what the unit has, and is chosen instead of the switches: the mode select under [Modes](#modes), the swing select under [Swing](#swing). The Full Matter support preset adds the swing select, and no preset adds the mode select.
236
+ A mode select is the Matter device type that picks one value from a list, as a drop-down does. The setup can add one for the mode, named `<name> Mode`, on a unit with a dry or a fan mode, and one for the swing, named `<name> Swing`, as a choice under [Swing](#swing). Each lists only what the unit has, and is chosen instead of the switches: the mode select under [Modes](#modes), and the swing select under [Swing](#swing), instead of the rocking of the fan control as well. No preset adds either.
233
237
 
234
238
  | Mode select | Lists | Picking a value |
235
239
  | ----------- | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -251,11 +255,11 @@ Matter has no control for Powerful, Econo and Streamer, so the setup can add a s
251
255
 
252
256
  In the Options step, a preset fills in every choice above for what the unit can do. You can change any of them afterwards. A new air conditioner starts with the Apple Home preset, and one already set up keeps its own choices.
253
257
 
254
- | Preset | Fan speed | Swing | Modes | Auto fan | Special mode switches | Humidity | Outdoor sensor | Parts of the air conditioner |
255
- | ------------------- | ---------- | ------------- | -------------------- | -------- | --------------------- | --------------------------- | -------------- | ---------------------------- |
256
- | Apple Home | Percentage | Not shown | Dry and fan switches | Switch | None | Also on a sensor of its own | No | No |
257
- | Google Home | Steps | Not shown | Dry and fan switches | Switch | None | Also on a sensor of its own | No | No |
258
- | Full Matter support | Steps | A mode select | Native modes only | Native | All | On the air conditioner | Yes | Yes |
258
+ | Preset | Fan speed | Swing | Modes | Auto fan | Special mode switches | Humidity | Outdoor sensor | Parts of the air conditioner |
259
+ | ------------------- | ---------- | -------------- | -------------------- | -------- | --------------------- | --------------------------- | -------------- | ---------------------------- |
260
+ | Apple Home | Percentage | Not shown | Dry and fan switches | Switch | None | Also on a sensor of its own | No | No |
261
+ | Google Home | Steps | Native rocking | Dry and fan switches | Switch | None | Also on a sensor of its own | No | No |
262
+ | Full Matter support | Steps | Native rocking | Native modes only | Native | All | On the air conditioner | Yes | Yes |
259
263
 
260
264
  ### One device or several
261
265
 
@@ -264,8 +268,8 @@ The switches, the mode selects, a fan of its own and a humidity sensor of its ow
264
268
  ```mermaid
265
269
  flowchart TD
266
270
  bridge["Matterbridge<br/>Aggregator"]
267
- ac["<b>Living Room</b><br/>Room Air Conditioner<br/>On/Off, Thermostat<br/>Fan Control when it is here, and Relative Humidity once the unit gives it"]
268
- fan["<b>Living Room Fan</b><br/>Fan<br/>Fan Control"]
271
+ ac["<b>Living Room</b><br/>Room Air Conditioner<br/>On/Off, Thermostat<br/>Fan Control unless the fan speed is hidden or on a fan of its own, with Rocking for the swing when it is chosen, and Relative Humidity once the unit gives it"]
272
+ fan["<b>Living Room Fan</b><br/>Fan<br/>Fan Control, with Rocking for the swing when it is chosen"]
269
273
  switches["<b>Living Room Vertical Swing</b>, and the other switches<br/>On/Off Plug-in Unit, one for each switch<br/>On/Off"]
270
274
  selects["<b>Living Room Mode</b> and <b>Living Room Swing</b><br/>Mode Select, one for each<br/>Mode Select"]
271
275
  humidity["<b>Living Room Humidity</b><br/>Humidity Sensor<br/>Relative Humidity"]
@@ -293,37 +297,41 @@ Changing the choice builds the air conditioner again in Matter. The switches, th
293
297
 
294
298
  Three other Matterbridge plugins expose Daikin units. Which one fits depends first on how your unit is reached: this plugin and two of the others talk to the adapter over the local network, and the fourth goes through the Daikin Onecta cloud.
295
299
 
296
- This plugin is the only one of the four that finds the adapters itself, that speaks to classic, DSIOT (BRP084) and Airbase (BRP15B61) adapters, and that connects to an adapter which wants its KEY or a child lock code. The others have strengths of their own: matterbridge-daikin-device controls the humidity and an air purifier, and matterbridge-daikin-onecta is the one for a unit that only the Onecta cloud reaches.
297
-
298
- | | matterbridge-daikin-local (this plugin) | [matterbridge-daikin-ac](https://github.com/andrasg/matterbridge-daikin-ac) | [matterbridge-daikin-device](https://github.com/lltcggie/matterbridge-daikin-device) | [matterbridge-daikin-onecta](https://github.com/mehmetc/matterbridge-daikin-onecta) |
299
- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
300
- | Connection | Local network, no cloud | Local network, no cloud | Local network, no cloud | Daikin Onecta cloud: needs internet, a Daikin Developer Portal app and a sign-in in a browser |
301
- | Units | Those with a classic (BRP069, BRP072), DSIOT (BRP084) or Airbase (BRP15B61) adapter, from the DAIKIN Mobile Controller, Daikin Airbase and ONECTA apps | The Wi-Fi modules [daikin-controller](https://github.com/Apollon77/daikin-controller) talks to. Not Onecta units | Units that speak DSIOT. Tested on the AN22ZRS air conditioner and the ACK70Z air purifier | Units in the Onecta app: air conditioners and heat pumps |
302
- | Built on | [daikin-local-control](https://github.com/cheziyi/daikin-local-control), a library by the same author that works on its own | [daikin-controller](https://github.com/Apollon77/daikin-controller) | Its own DSIOT code | [daikin-controller-cloud](https://github.com/Apollon77/daikin-controller-cloud) |
303
- | Adding a unit | A search of the network and a guided setup page, or by address. No restart | IP addresses in the plugin settings | IP addresses in the plugin settings, then a restart | Every unit of the account, with a white list and a black list |
304
- | KEY and child lock code | Asked for in the setup page, by the adapters that need them | Not supported: it cannot connect to an adapter that wants its KEY or a child lock code | Not supported: it cannot connect to an adapter with a child lock code. DSIOT adapters have no KEY | Neither applies: it signs in to the Daikin cloud |
305
- | Thermostat modes | Off, Cool, Heat, Auto, Dry and Fan only, and an optional switch for each mode, a mode select, or the modes the unit lacks running others | Off, Cool, Heat, Auto, Dry and Fan only | Off, Cool, Heat, Auto and Fan only. Dry and humidify through a mode select | Off, Cool, Heat, Auto, Dry and Fan only |
306
- | Fan speed | Steps, a percentage or not shown, on the air conditioner or on a fan of its own, and an optional switch for the auto speed | No | Low, Medium, High and Auto, a percentage, or a mode select | A fan device |
307
- | Swing | A switch for each axis, a mode select, or not shown with the mode you fix | No | The airflow direction of each axis, through a mode select | No |
308
- | Powerful, Econo and Streamer | An optional switch for each | No | No | A switch for Powerful |
309
- | Humidity | Shown on the air conditioner, when the unit gives it | No | Target humidity and ventilation as fans, and a humidity sensor | A humidity sensor, on units that report it |
310
- | Outdoor temperature | A sensor you turn on, when the unit gives it | No | Yes | Yes |
311
- | Other devices | None | None | The ACK70Z air purifier, with its humidifier, its water tank and its air quality sensors | None |
312
- | How often a unit is read | Every 5 seconds, or what you set from 2 to 3600 | Every 3 seconds, or what you set from 2 | No setting | Every 10 minutes by day and 30 by night, or what you set. Daikin allows 200 calls a day |
313
- | Node.js | 22.19 or later, 24 and 26 | 24 and 26 | 20, 22 and 24 | 20.19 or later, 22.13 or later, 24 and 26 |
314
- | Documentation | English | English | Japanese | English |
315
- | License | Apache-2.0 | MIT | Apache-2.0 | Apache-2.0 |
300
+ This plugin is the only one of the four that finds the adapters itself, that speaks to classic, DSIOT (BRP084) and Airbase (BRP15B61) adapters, and that connects to an adapter which wants its KEY or a child lock code. It is also the only local one that follows an adapter to a new address, and the only one of the four that reports a unit which stops answering as unreachable. The others have strengths of their own: matterbridge-daikin-device controls the humidity, the ventilation and an air purifier, and matterbridge-daikin-onecta is the one for a unit that only the Onecta cloud reaches.
301
+
302
+ | | matterbridge-daikin-local (this plugin) | [matterbridge-daikin-ac](https://github.com/andrasg/matterbridge-daikin-ac) | [matterbridge-daikin-device](https://github.com/lltcggie/matterbridge-daikin-device) | [matterbridge-daikin-onecta](https://github.com/mehmetc/matterbridge-daikin-onecta) |
303
+ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
304
+ | Connection | Local network, no cloud | Local network, no cloud | Local network, no cloud | Daikin Onecta cloud: needs internet, a Daikin Developer Portal app and a sign-in in a browser |
305
+ | Units | Those with a classic (BRP069, BRP072), DSIOT (BRP084) or Airbase (BRP15B61) adapter, from the DAIKIN Mobile Controller, Daikin Airbase and ONECTA apps | Those with a classic adapter that answers over plain HTTP, which [daikin-controller](https://github.com/Apollon77/daikin-controller) talks to. Not Onecta units | Those with a DSIOT adapter that is a room air conditioner or an air purifier: it turns down any other. Tested on the AN22ZRS air conditioner and the ACK70Z air purifier | Units in the Onecta app: air conditioners and heat pumps |
306
+ | Built on | [daikin-local-control](https://github.com/cheziyi/daikin-local-control), a library by the same author that works on its own | [daikin-controller](https://github.com/Apollon77/daikin-controller) | Its own DSIOT code | [daikin-controller-cloud](https://github.com/Apollon77/daikin-controller-cloud) |
307
+ | Adding a unit | A search of the network and a guided setup page, or by address. No restart | IP addresses in the plugin settings, then a restart | IP addresses in the plugin settings, then a restart | Every unit of the account, with a white list and a black list |
308
+ | KEY and child lock code | Asked for in the setup page, by the adapters that need them | Not supported: it cannot connect to an adapter that wants its KEY or a child lock code | Not supported: it cannot connect to an adapter with a child lock code. DSIOT adapters have no KEY | Neither applies: it signs in to the Daikin cloud |
309
+ | New address or name | Found again by the MAC address of its adapter, so no fixed address is needed. Its name is the one you give it, which a new name of the adapter does not change | The address is changed in the settings. A new name makes a new device in Matter, which is known by its name | The address is changed in the settings, then a restart. A new name makes a new device in Matter, which is known by its name | Neither applies: each unit is known by its cloud ID |
310
+ | A unit that stops answering | Shown as unreachable after two failed reads. One that is off at the start is still added, from what was stored | Not shown. One that does not answer within 90 seconds of the start is left out until the next restart | Not shown. One that does not answer at the start is left out until the next restart | Not shown, even while the cloud reports the unit offline |
311
+ | Thermostat modes | Off, Cool, Heat, Auto, Dry and Fan only, and an optional switch for each mode, a mode select, or the modes the unit lacks running others | Off, Cool, Heat, Auto, Dry and Fan only | Off, Cool, Heat, Auto, Dry and Fan only, and a mode select that also has humidify | Off, Cool, Heat, Auto, Dry and Fan only |
312
+ | Controls | Built from the modes, fan speeds, swing and temperature limits each unit reports | The same for every unit, with fixed temperature limits | Built for its two tested models | Modes and temperature limits from the cloud |
313
+ | Fan speed | Steps, a percentage or not shown, on the air conditioner or on a fan of its own, and an optional switch for the auto speed | No | Low, Medium, High and Auto, a percentage, or a mode select | A fan device |
314
+ | Swing | The rocking of the fan control, a switch for each axis, a mode select, or not shown with the mode you fix | No | The airflow direction of each axis, through a mode select | No |
315
+ | Powerful, Econo and Streamer | An optional switch for each | No | No | A switch for Powerful |
316
+ | Humidity | On the air conditioner, and on a sensor of its own if you add one, when the unit gives it | No | Target humidity and ventilation as fans, and a humidity sensor | A humidity sensor, on units that report it |
317
+ | Outdoor temperature | A sensor you turn on, when the unit gives it | No | On the air conditioner and on a sensor | A sensor you can turn off |
318
+ | Other devices | None | None | The ACK70Z air purifier, with its humidifier, its water tank and its air quality sensors. An optional switch that raises or lowers the setpoint by 0.5 °C | None |
319
+ | How often a unit is read | Every 5 seconds, or what you set from 2 to 3600 | Every 3 seconds, or what you set from 2 | Every 6 seconds. No setting | Every 10 minutes by day and 30 by night, or what you set from 5. Daikin allows 200 calls a day |
320
+ | Node.js | 22.19 or later, 24 and 26 | 24 and 26 | 20, 22 and 24 | 20.19 or later, 22.13 or later, 24 and 26 |
321
+ | Documentation | English | English | Japanese | English |
322
+ | License | Apache-2.0 | MIT | Apache-2.0 | Apache-2.0 |
316
323
 
317
324
  The table is read from the README, the settings and the source of matterbridge-daikin-ac 2.0.0 and the daikin-controller library it uses, matterbridge-daikin-device 1.0.2 and matterbridge-daikin-onecta 0.1.1, in October 2026. None of the three was run for it.
318
325
 
319
326
  ## How devices are stored
320
327
 
321
- The plugin knows each air conditioner by the **MAC address of its adapter**, so neither a new IP address nor a new name makes it lose track of one. The MAC address is also the serial number the air conditioner has in Matter:
328
+ The plugin knows each air conditioner by the **MAC address of its adapter**, so neither a new IP address nor a new name makes it lose track of one. The MAC address is also the serial number the air conditioner has in Matter. A switch, a mode select, a fan or a sensor that is a device of its own has that serial number with a dash and a letter after it, such as `A4:08:EA:CC:91:D4-V` for the vertical swing switch:
322
329
 
323
- - **The address and the name are kept up to date.** The plugin searches the network when it starts, every 5 minutes, and at once when a device stops answering. An adapter that answers from a new address, or under a new name, has both updated. A renamed adapter is built again in Matter under its new name, with the same serial number. A Matter app may take it for a new device, and ask you again for its room and its automations.
324
- - **No two devices share a name**, because the name is what Matter shows. An adapter renamed to the name of another stored device keeps its old name in the plugin, and the setup page does not offer adapters that share a name: give each adapter its own name in the Daikin app it was set up with.
330
+ - **The address is kept up to date.** The plugin searches the network when it starts, every 5 minutes, and at once when a device stops answering. An adapter that answers from a new address has it updated.
331
+ - **Each device has the name you give it in the setup page**, which starts as the name its adapter announces, followed by a number when another device has that name already, such as `Bedroom 2`. A new name of the adapter does not change it. No two devices share a name, because the name is what Matter shows and what its switches and sensors are named after.
332
+ - **A new name builds the device again in Matter**, with the same serial number. A Matter app may take it for a new device, and ask you again for its room and its automations.
325
333
  - **An adapter added by address is followed like any other** when a search can reach it: the plugin reads its MAC address at the address you enter. An adapter on another subnet or VLAN, which no search reaches, keeps the address you entered, so give it a fixed one on your router.
326
- - **An adapter that has no name** is named by you in the setup page. The plugin takes the adapter's own name as soon as it has one.
334
+ - **An adapter that has no name** is named by you in the setup page.
327
335
  - **An adapter that reports no MAC address cannot be added**, because the plugin would have nothing to follow it by.
328
336
 
329
337
  What each unit can do is read when it is added, and checked again after each start of the plugin and each time you open its options in the setup page. If it changed, for example after an update of the unit's firmware or of this plugin, the air conditioner is built again in Matter and a setting the unit no longer takes is reset.
@@ -1,4 +1,4 @@
1
- async function C(e,t,n){try{let[s,r]=e.split(" "),a={method:s};t!==void 0&&(a.headers={"Content-Type":"application/json"},a.body=JSON.stringify(t));let l=await fetch(new URL(`api/${r}${n===void 0?"":`?${n}`}`,document.baseURI),a);if(l.status===204)return{ok:!0};if(l.status===503)return{ok:!1,error:"The plugin is not running. Start it in Matterbridge, then reload this page."};let c=await l.json();return"ok"in c?c:{ok:!1,error:c.error??`The plugin answered with status ${l.status}`}}catch{return{ok:!1,error:"Matterbridge did not answer. Check that it is running, then try again."}}}function T(e){let{fanControl:t,fanSpeedWhenHidden:n,swingControl:s,swingModeWhenHidden:r,modeControl:a,modeSwitches:l,modeReplacements:c,fanAutoControl:d,hasSeparateFan:m,specialModeSwitches:y,hasOutdoorTemperatureSensor:u,hasSeparateHumiditySensor:k,isComposed:w}=e;return{fanControl:t,fanSpeedWhenHidden:n,swingControl:s,swingModeWhenHidden:r,modeControl:a,modeSwitches:[...l],modeReplacements:{...c},fanAutoControl:d,hasSeparateFan:m,specialModeSwitches:[...y],hasOutdoorTemperatureSensor:u,hasSeparateHumiditySensor:k,isComposed:w}}var we={fanControl:"steps",fanSpeedWhenHidden:"keep",swingControl:"switches",swingModeWhenHidden:"keep",modeControl:"native",modeSwitches:[],modeReplacements:{},fanAutoControl:"native",hasSeparateFan:!1,specialModeSwitches:[],hasOutdoorTemperatureSensor:!1,hasSeparateHumiditySensor:!1,isComposed:!0};function X(e){return{adapter:e,name:e.name??"",isNew:!0,...T(we)}}function _(e){let{capabilities:t,controls:n,name:s,macAddress:r,host:a,protocol:l,requiresRegistration:c,usesHttps:d,requiresLocalPassword:m}=e;return{adapter:{host:a,protocol:l,name:s,macAddress:r,requiresRegistration:c,usesHttps:d,requiresLocalPassword:m},name:s,isNew:!1,capabilities:t,controls:n,...T(e)}}var ee={fanSteps:[],hasFanAuto:!1,hasSwing:!1,switchableModes:[],lackingModes:[],specialModes:[]};function V(e,t,n,s){if(!s.switchableModes.includes(e)||!s.lackingModes.includes(t))return!1;let r=s.switchableModes.filter(l=>l!==e).map(l=>n[l]);if(r.includes(t))return!1;if(t!=="auto")return!0;let a=new Set([...s.switchableModes,...r]);return a.has("cool")&&a.has("heat")}function H(e,t){let n={};for(let s of t.switchableModes){let r=e[s];r!==void 0&&V(s,r,e,t)&&(n[s]=r)}return n}var I={apple:{title:"Apple Home",text:"Fan speed as a percentage, the humidity on a sensor of its own too, and a switch for auto fan and for each of dry and fan, each a device of its own. The swing is not shown and stays as it is."},google:{title:"Google Home",text:"Fan speed as steps, the humidity on a sensor of its own too, and a switch for auto fan and for each of dry and fan, each a device of its own. The swing is not shown and stays as it is."},matter:{title:"Full Matter support",text:"For apps that show every Matter control: fan speed as steps with its auto mode, the swing as a mode select, a switch for each special mode and the outdoor temperature, all as one device."}};function L(e,t){let n=e==="matter",s=n&&t.hasSwing?"select":"hidden",r=n?[]:t.switchableModes.filter(a=>a==="dehumidify"||a==="fan");return{fanControl:t.fanSteps.length===0?"hidden":e==="apple"?"percent":"steps",fanSpeedWhenHidden:"keep",swingControl:s,swingModeWhenHidden:"keep",modeControl:r.length>0?"switches":"native",modeSwitches:r,modeReplacements:{},fanAutoControl:!n&&t.hasFanAuto?"switch":"native",hasSeparateFan:!1,specialModeSwitches:n?[...t.specialModes]:[],hasOutdoorTemperatureSensor:n,hasSeparateHumiditySensor:!n,isComposed:n}}function te(e,t,n){let s=T(e);n.fanSteps.length===0&&Object.assign(s,{fanControl:"hidden",fanSpeedWhenHidden:"keep"}),s.fanControl==="hidden"&&(s.hasSeparateFan=!1);let r=s.fanAutoControl==="firstStep"||s.fanAutoControl==="lastStep",a=s.fanControl==="hidden"&&s.fanSpeedWhenHidden!=="keep";return(!n.hasFanAuto||r&&s.fanControl==="hidden"||a)&&(s.fanAutoControl="native"),n.hasSwing||Object.assign(s,{swingControl:"hidden",swingModeWhenHidden:"keep"}),s.modeSwitches=s.modeControl==="switches"?n.switchableModes.filter(c=>s.modeSwitches.includes(c)):[],s.modeReplacements=H(s.modeReplacements,n),{native:!0,select:n.switchableModes.includes("dehumidify")||n.switchableModes.includes("fan"),switches:s.modeSwitches.length>0}[s.modeControl]||(s.modeControl="native"),s.specialModeSwitches=n.specialModes.filter(c=>s.specialModeSwitches.includes(c)),JSON.stringify(s)===JSON.stringify(L(t,n))}var i={screen:"loading",setup:void 0,found:[],selected:new Set,queue:[],saved:[],handled:[],isBusy:!1,busyText:"",error:"",confirmingRemoval:""};function v(){return i.queue[0]}function A(e){return e.name===""?e.adapter.host:e.name}function z(e){return(i.setup?.devices??[]).some(t=>t.macAddress===e.macAddress)}var J;function oe(e){J=e}function p(){let e=document.getElementById("app");if(e===null||J===void 0)return;let t=`${i.screen}:${v()?.adapter.host??""}`,n=e.dataset.form===t,s=document.activeElement instanceof HTMLElement?document.activeElement.id:"",r=new Map;for(let a of e.querySelectorAll("input[type=text], input[type=password]"))a.id!==""&&r.set(a.id,a.value);if(e.replaceChildren(...J[i.screen]().filter(a=>a!==!1&&a!==null&&a!==void 0)),e.dataset.form=t,!!n){for(let[a,l]of r){let c=document.getElementById(a);c instanceof HTMLInputElement&&(c.value=l)}s!==""&&document.getElementById(s)?.focus()}}async function F(e,t){i.isBusy=!0,i.busyText=e,i.error="",p();try{return await t()}finally{i.isBusy=!1,p()}}async function W(){let e=await C("GET state");if(!e.ok){i.error=e.error,i.screen="home",p();return}if(i.setup=e.state,e.state.devices.length===0){await N();return}i.screen="home",p()}async function q(){let e=await C("GET state");e.ok&&(i.setup=e.state)}function x(){i.queue=[],i.saved=[],i.handled=[],i.error="",i.screen="home",q().then(p),p()}async function N(){i.screen="find";let e=await F("Searching your network. This takes about three seconds\u2026",async()=>C("POST discover"));if(!e.ok){i.error=`The search did not run: ${e.error}`,p();return}await q();let t=i.found.filter(n=>!e.devices.some(s=>s.host===n.host)&&i.selected.has(n.host)).map(n=>({...n,isConfigured:z(n)}));i.found=[...e.devices,...t];for(let n of e.devices)!n.isConfigured&&!n.hasDuplicateName&&i.selected.add(n.host);p()}async function ne(e){let t=await F(`Looking for an adapter at ${e}\u2026`,async()=>C("POST identify",{host:e}));if(!t.ok){i.error=t.error,p();return}let n=z(t.device),s=t.device.requiresRegistration===!0;i.found=[...i.found.filter(r=>r.host!==t.device.host),{...t.device,isConfigured:n,hasDuplicateName:!1,needsRegistration:s}],n||i.selected.add(t.device.host),p()}function B(e){i.queue=e,i.saved=[],i.handled=[],Q()}async function Q(){let e=v();if(e===void 0){i.screen=i.saved.length>0?"done":"home",await q(),p();return}i.screen="connect",i.error="",e.probe=void 0,p(),await P(e)}async function P(e,t){let s={device:{...e.adapter,name:e.name===""?void 0:e.name},localPassword:e.localPassword,key:t},r=t===void 0?`Checking ${A(e)}\u2026`:`Registering with ${A(e)}\u2026`,a=await F(r,async()=>C(t===void 0?"POST probe":"POST register",s));if(!a.ok){i.error=a.error,p();return}if(e.probe=a.result,e.adapter=a.result.device,a.result.status==="ready"){let l=e.controls===void 0;e.capabilities=a.result.capabilities,e.controls=a.result.controls,e.isNew&&l&&e.controls!==void 0&&Object.assign(e,L("apple",e.controls));let c=a.result.device.name??"";c!==""&&(e.name=c),e.name!==""&&(i.screen="options")}p()}function se(){let e=i.queue.shift();e!==void 0&&i.handled.push({label:A(e),isSaved:!1}),Q()}async function ie(e){let{adapter:t,name:n,localPassword:s}=e,r={...t,name:n,localPassword:s,...T(e)},a=await F(`Saving ${n}\u2026`,async()=>C("POST device",{device:r}));if(!a.ok){i.error=a.error,p();return}i.setup=a.state,i.saved.push(n),i.handled.push({label:n,isSaved:!0}),i.queue.shift(),await Q()}async function ae(e){let t=await F(`Removing ${e.name}\u2026`,async()=>C("DELETE device",void 0,`macAddress=${encodeURIComponent(e.macAddress)}`));i.confirmingRemoval="",t.ok||(i.error=t.error),await q(),p()}function o(e,t={},...n){let s=document.createElement(e);for(let[r,a]of Object.entries(t))a===void 0||a===!1||(r==="class"?s.className=String(a):r==="html"?s.innerHTML=String(a):r.startsWith("on")&&typeof a=="function"?s.addEventListener(r.slice(2),a):r in s?s[r]=a:s.setAttribute(r,String(a)));for(let r of n)r!==!1&&r!==null&&r!==void 0&&s.append(r);return s}function h(e,t,n="quiet",s=!1){return o("button",{type:"button",class:`button ${n}`,onclick:t,disabled:s||i.isBusy},e)}function S(){return i.isBusy?o("p",{class:"notice working",role:"status"},o("span",{class:"spinner"}),i.busyText):i.error!==""?o("p",{class:"notice problem",role:"alert"},i.error):null}function U(){let e=v();if(e===void 0||!e.isNew||i.handled.length+i.queue.length<2)return null;let t=i.screen==="connect"?"Connecting":"Choosing options";return o("ol",{class:"units","aria-label":"Air conditioners in this setup"},...i.handled.map(n=>o("li",{class:n.isSaved?"done":"skipped"},o("strong",{},n.label),o("span",{class:"meta"},n.isSaved?"Added":"Skipped"))),...i.queue.map((n,s)=>o("li",{class:s===0?"current":"ahead","aria-current":s===0?"true":void 0},o("strong",{},A(n)),o("span",{class:"meta"},s===0?t:"Waiting"))))}function K(e,t){return o("header",{class:"unit-header"},o("h1",{},A(e)),o("p",{class:"meta"},t))}function $(){if(i.queue.length>0&&!i.queue.some(s=>s.isNew))return null;let e=["Find","Connect","Options"],n=["find","connect","options"].indexOf(i.screen);return o("ol",{class:"steps"},...e.map((s,r)=>{let a="ahead";return r<n?a="done":r===n&&(a="current"),o("li",{class:a,"aria-current":r===n?"step":void 0},s)}))}function ge(e){let t=o("input",{type:"text",id:"device-name",maxLength:32,autocomplete:"off"}),n=()=>{let s=t.value.trim();if(s!==""){if(i.setup?.devices.some(r=>r.name===s)){i.error=`"${s}" is already the name of another air conditioner. Pick a different one.`,p();return}e.name=s,i.error="",i.screen="options",p()}};return o("div",{class:"field"},o("label",{for:"device-name"},"Name this air conditioner"),o("p",{class:"help"},"Its adapter has no name of its own. This is the name it gets in Matter, up to 32 characters. Name the adapter in its Daikin app later and the plugin takes that name instead."),o("div",{class:"inline-form"},t,h("Continue",n,"primary")))}function ye(e,t){let n=o("input",{type:"password",id:"lock-code",inputMode:"numeric",autocomplete:"off",maxLength:64});return o("div",{class:"field"},o("label",{for:"lock-code"},"Child lock code"),o("p",{class:"help"},"The 4-digit code set under Child lock in the Daikin app the adapter was set up with. It is not printed on the adapter."),t?o("p",{class:"problem-text"},"The adapter did not accept that code."):null,o("div",{class:"inline-form"},n,h("Check the code",()=>{n.value!==""&&(e.localPassword=n.value,P(e))},"primary")))}function ve(e,t){let n=o("input",{type:"text",id:"adapter-key",autocomplete:"off",spellcheck:!1,maxLength:64});return o("div",{class:"field"},o("label",{for:"adapter-key"},"KEY on the adapter"),o("p",{class:"help"},"This adapter only answers apps it has registered. The KEY is printed on its label, next to the SSID, and in the operation manual. It is used once and not stored."),t?o("p",{class:"problem-text"},"The adapter did not accept that KEY."):null,o("div",{class:"inline-form"},n,h("Register",()=>{n.value.trim()!==""&&P(e,n.value.trim())},"primary")))}function Se(e){let t=e.probe?.status;return t==="ready"&&e.name===""?ge(e):t==="localPasswordRequired"||t==="localPasswordRejected"?ye(e,t==="localPasswordRejected"):t==="registrationRequired"||t==="registrationRejected"?ve(e,t==="registrationRejected"):t==="unreachable"?o("p",{class:"notice problem",role:"alert"},`${e.name} did not answer at ${e.adapter.host}. Check that it has power and is on the network, then try again.`):t==="failed"?o("p",{class:"notice problem",role:"alert"},`${e.name} answered with an error: ${e.probe?.message??"unknown"}`):null}function re(){let e=v();if(e===void 0)return[S()];let t=e.probe?.status==="unreachable"||e.probe?.status==="failed"||i.error!==""&&e.name!=="";return[$(),U(),K(e,`Connecting to its adapter at ${e.adapter.host}.`),S(),i.isBusy?null:Se(e),o("div",{class:"footer"},t?h("Try again",()=>{P(e)}):null,h(e.isNew&&i.queue.length>1?"Skip this one":"Cancel",e.isNew&&i.queue.length>1?se:x))]}function ce(){let e=i.saved;return[o("header",{},o("h1",{},e.length===1?`${e[0]} is set up`:`${e.length} air conditioners are set up`)),o("p",{class:"lead"},"They now appear in the Matter apps paired with Matterbridge. If Matterbridge is not paired yet, pair it from its home page."),o("div",{class:"footer"},h("Done",x,"primary"))]}function be(e){let t=!e.isConfigured&&!e.hasDuplicateName,n=[];e.isConfigured&&n.push("Already set up."),e.hasDuplicateName&&n.push("Another adapter has the same name. Give each its own name in its Daikin app, then search again."),e.name===void 0&&n.push("It has not told its name yet. If it has none, you will name it after connecting."),t&&e.needsRegistration?n.push("Asks for the KEY printed on its label."):t&&e.requiresRegistration&&n.push("Already registered with this plugin, so it will not ask for its KEY."),t&&e.requiresLocalPassword&&n.push("Asks for its child lock code.");let s=o("input",{type:"checkbox",id:`found-${e.host}`,checked:t&&i.selected.has(e.host),disabled:!t,onchange:()=>{s.checked?i.selected.add(e.host):i.selected.delete(e.host),p()}});return o("li",{class:t?"found":"found unavailable"},o("label",{for:`found-${e.host}`},s,o("span",{},o("strong",{},e.name??"Unnamed adapter"),o("span",{class:"meta"},` ${e.host}`),...n.map(r=>o("span",{class:"meta note"},r)))))}function le(){let e=i.found.filter(r=>i.selected.has(r.host)&&!r.isConfigured&&!r.hasDuplicateName),t=o("input",{type:"text",id:"host",placeholder:"192.168.1.50",spellcheck:!1,autocomplete:"off"}),n=()=>{t.value.trim()!==""&&ne(t.value.trim())};t.addEventListener("keydown",r=>{r.key==="Enter"&&n()});let s=e.length===1?"Set up 1 air conditioner":`Set up ${e.length} air conditioners`;return[$(),o("header",{},o("h1",{},"Find your air conditioners")),S(),i.found.length>0?o("ul",{class:"found-list"},...i.found.map(be)):null,!i.isBusy&&i.found.length===0?o("p",{class:"empty"},"No adapter answered. A search only reaches adapters on the same network segment as Matterbridge: add the others by address below."):null,o("details",{class:"manual",open:!i.isBusy&&i.found.length===0},o("summary",{},"Can't see your air conditioner?"),o("p",{class:"help"},"Enter the address of its adapter. The plugin reads the name of the adapter there and follows it to a new address like any other, as long as a search can reach it. An adapter on another subnet or VLAN keeps this address."),o("div",{class:"inline-form"},o("label",{for:"host",class:"visually-hidden"},"Adapter address"),t,h("Look it up",n))),o("div",{class:"footer"},h("Search again",()=>{N()}),h("Cancel",x),h(s,()=>B(e.map(X)),"primary",e.length===0))]}var Y={auto:"auto mode",cool:"cool mode",heat:"heat mode",dehumidify:"dry mode",fan:"fan mode"};function Me(e){let t=e.controls===void 0||e.controls.fanSteps.length>0,n=e.controls===void 0||e.controls.hasSwing,s=e.hasSeparateFan?" on a fan of its own":"",r={native:"",switch:"",firstStep:" with auto first",lastStep:" with auto last"}[e.fanAutoControl],a=e.fanControl==="hidden"?"fan speed not shown":`fan speed as ${e.fanControl==="steps"?"steps":"a percentage"}${r}${s}`,l={switches:"swing as switches",select:"swing as a mode select",hidden:"swing not shown"}[e.swingControl],c=[t?a:"",n?l:""].filter(w=>w!=="").join(", "),d=e.modeControl==="switches"?e.modeSwitches.map(w=>Y[w]):[],m=Object.keys(Y).flatMap(w=>{let M=e.modeReplacements[w];return M===void 0?[]:[`${Y[w]} as ${Y[M].replace(" mode","")}`]}),y=[...d,e.fanAutoControl==="switch"?"auto fan":"",...e.specialModeSwitches].filter(w=>w!==""),u=[y.length===0?"":`a switch for ${y.join(", ")}`,e.modeControl==="select"?"a mode select":"",m.join(" and ")].filter(w=>w!=="").join(" and "),k=e.isComposed?", all as one device":"";return c===""?`${u===""?"power, mode and temperature":u}${k}`:`${u===""?c:`${c}, and ${u}`}${k}`}function Ce(e){let t={online:"Online",offline:"Not answering",stopped:"Not started"}[e.status],n=i.confirmingRemoval===e.macAddress;return o("li",{class:"device"},o("div",{class:"device-main"},o("h3",{},e.name),o("p",{class:"meta"},o("span",{class:`status ${e.status}`},t),` at ${e.host}. In Matter: ${Me(e)}.`),e.status!=="online"&&e.error?o("p",{class:"meta problem-text"},e.error):null),n?o("div",{class:"actions"},o("span",{class:"meta"},"Remove it from Matter too?"),h("Remove",()=>{ae(e)},"danger"),h("Keep",()=>{i.confirmingRemoval="",p()})):o("div",{class:"actions"},h(e.status==="online"?"Options":"Reconnect",()=>B([_(e)])),h("Remove",()=>{i.confirmingRemoval=e.macAddress,p()})))}function de(){let e=i.setup?.devices??[];return[o("header",{},o("h1",{},"Daikin air conditioners"),i.setup?h("Add air conditioners",()=>{N()},"primary"):null),S(),e.length===0&&i.setup?o("p",{class:"empty"},"No air conditioner is set up yet. Add one to control it from Matter."):o("ul",{class:"devices"},...e.map(Ce)),i.setup?null:h("Try again",()=>{W()},"primary")]}var G={auto:"Auto",silent:"Silent",level1:"Level 1",level2:"Level 2",level3:"Level 3",level4:"Level 4",level5:"Level 5"},Z={off:"No swing",vertical:"Up and down",horizontal:"Left and right",both:"3D swing"},R={auto:"Auto",cool:"Cool",heat:"Heat",dehumidify:"Dry",fan:"Fan"},pe={powerful:{title:"Powerful",text:"Runs the unit at full power for a while."},econo:{title:"Econo",text:"Limits how much power the unit draws."},streamer:{title:"Streamer",text:"Runs the air purifying of the unit."}},E={steps:'<svg viewBox="0 0 48 28" aria-hidden="true"><rect x="2" y="20" width="8" height="6"/><rect x="14" y="14" width="8" height="12"/><rect x="26" y="8" width="8" height="18"/><rect x="38" y="2" width="8" height="24"/></svg>',percent:'<svg viewBox="0 0 48 28" aria-hidden="true"><path d="M2 26 L46 2 L46 26 Z"/></svg>',hidden:'<svg viewBox="0 0 48 28" aria-hidden="true"><path class="stroke" d="M6 14 H42" stroke-dasharray="3 5"/></svg>',switches:'<svg viewBox="0 0 48 28" aria-hidden="true"><path class="stroke" d="M12 4 V24 M7 9 L12 4 L17 9 M7 19 L12 24 L17 19"/><path class="stroke" d="M26 14 H46 M31 9 L26 14 L31 19 M41 9 L46 14 L41 19"/></svg>',select:'<svg viewBox="0 0 48 28" aria-hidden="true"><rect class="stroke" x="3" y="5" width="42" height="18" rx="4"/><path class="stroke" d="M31 12 L35 16 L39 12"/></svg>'},he="Few apps show a mode select: Home Assistant does, Apple Home does not.";function j(e,t,n){return e.isComposed?n?`It appears as a part of "${e.name}", tagged "${t}"`:`It appears as a part of "${e.name}"`:`It appears as "${e.name} ${t}"`}function f(e,t){Object.assign(e,t),p()}function D(e,t,n,s,r,a,l){let c=`${e}-${t}`,d=o("input",{type:"radio",name:e,id:c,checked:t===n,onchange:()=>l(t)});return o("label",{class:"choice pictured",for:c},d,o("span",{class:"glyph",html:a}),o("span",{},o("strong",{},s),o("span",{class:"meta"},r)))}function b(e,t,n,s,r,a){let l=`${e}-${t}`,c=o("input",{type:"radio",name:e,id:l,checked:t===n,onchange:()=>a(t)});return o("label",{class:"choice",for:l},c,o("span",{},o("strong",{},s),o("span",{class:"meta"},r)))}function O(e,t,n,s,r){let a=o("input",{type:"checkbox",id:e,checked:t,onchange:()=>r(a.checked)});return o("label",{class:"choice",for:e},a,o("span",{},o("strong",{},n),o("span",{class:"meta"},s)))}function xe(e,t,n,s,r,a){return o("div",{class:"chips",role:"group","aria-label":t},...n.map(l=>{let c=`${e}-${l}`,d=o("input",{type:"checkbox",id:c,checked:s.includes(l),onchange:()=>a(n.filter(m=>m===l?d.checked:s.includes(m)))});return o("label",{class:"chip",for:c},d,r[l])}))}function ke(e,t){return o("section",{class:"presets"},o("h2",{},"Start from a preset"),o("div",{class:"preset-list"},...Object.keys(I).map(n=>o("button",{type:"button",class:"preset","aria-pressed":String(te(e,n,t)),onclick:()=>f(e,L(n,t))},o("strong",{},I[n].title),o("span",{class:"meta"},I[n].text)))),o("p",{class:"help"},"A preset fills in the choices below for what this unit can do. Change any of them afterwards."))}function Ae(e){let t=e.map(n=>G[n]);return t.length===1?t[0]:`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function Te(e,t,n){if(!t.hasFanAuto||e.fanControl==="hidden"&&e.fanSpeedWhenHidden!=="keep")return null;let s=m=>f(e,{fanAutoControl:m}),r=e.fanControl==="hidden",a=`${j(e,"Auto Fan",!0)}. On sets the fan to auto, off puts it back at the speed it last ran at.`,l=G[t.fanSteps[0]],c=G[t.fanSteps[t.fanSteps.length-1]],d=r?[b("fan-auto","native",n,"Not shown in Matter","Without a fan speed in Matter, auto has no place there either.",s),b("fan-auto","switch",n,"A switch",a,s)]:[b("fan-auto","native",n,"Native fan mode only","Auto is a mode of the fan speed, beside its speeds, as Matter has it.",s),b("fan-auto","switch",n,"A switch",`${a} Auto stays a fan mode as well.`,s),b("fan-auto","firstStep",n,"The first step",`Auto comes below ${l}: step 1, or the bottom of the slider.`,s),b("fan-auto","lastStep",n,"The last step",`Auto comes above ${c}: the top step, or 100 %.`,s)];return o("div",{class:"field"},o("h3",{id:"fan-auto-title"},"Auto fan speed"),r?null:o("p",{class:"help"},"Matter has auto as a fan mode, which not every app shows. A switch makes it reachable there too, and a step takes its place."),o("div",{class:"choices",role:"radiogroup","aria-labelledby":"fan-auto-title"},...d))}function $e(e,t){let n=e.capabilities?.fanSpeeds??[];if(t.fanSteps.length===0)return o("section",{},o("h2",{},"Fan speed"),o("p",{class:"help"},"This unit does not let apps set its fan speed, so there is nothing to choose."));let r=e.fanControl==="hidden",a=t.hasFanAuto&&!r&&(e.fanAutoControl==="firstStep"||e.fanAutoControl==="lastStep"),l=t.hasFanAuto&&e.fanAutoControl==="switch",c=t.fanSteps;a&&(c=e.fanAutoControl==="firstStep"?["auto",...t.fanSteps]:[...t.fanSteps,"auto"]);let m=t.hasFanAuto&&!a?" Auto is not among them: it is a fan mode of its own.":"",y=`${c.length} ${c.length===1?"speed":"speeds"}, ${a?"in order":"slowest first"}: ${Ae(c)}.${m}`;return o("section",{},o("h2",{},"Fan speed"),o("div",{class:"choices"},D("fan","steps",e.fanControl,"Steps",y,E.steps,u=>f(e,{fanControl:u})),D("fan","percent",e.fanControl,"Percentage",`A slider from 0 to 100, which the plugin rounds to the nearest of ${y}`,E.percent,u=>f(e,{fanControl:u})),D("fan","hidden",e.fanControl,"Not shown in Matter","No fan control. Pick below what the plugin does with the fan speed instead.",E.hidden,u=>f(e,{fanControl:u}))),e.fanControl==="hidden"?o("div",{class:"field"},o("label",{for:"fan-fixed"},"When the plugin sends a command, the fan speed"),o("select",{id:"fan-fixed",onchange:u=>f(e,{fanSpeedWhenHidden:u.target.value})},o("option",{value:"keep",selected:e.fanSpeedWhenHidden==="keep"},"stays as it is"),...n.map(u=>o("option",{value:u,selected:e.fanSpeedWhenHidden===u},`is set to ${G[u]}`)))):null,e.fanControl==="hidden"?null:O("separate-fan",e.hasSeparateFan,"Show the fan as a device of its own",`${j(e,"Fan",!1)}, and the air conditioner has no fan speed of its own. For apps that show no fan speed on an air conditioner, or do not show it well. It always shows the speed the unit holds, also while the unit is off.`,u=>f(e,{hasSeparateFan:u})),Te(e,t,r&&!l?"native":e.fanAutoControl))}function Re(e){let t=e.capabilities?.swingModes??[];if(t.length===0)return o("section",{},o("h2",{},"Swing"),o("p",{class:"help"},"This unit does not let apps move its louvers, so there is nothing to choose."));let n=t.includes("vertical"),s=t.includes("horizontal"),r="One switch, for the up and down swing.";return n&&s?r="Two switches: one for the up and down swing, one for left and right.":s&&(r="One switch, for the left and right swing."),o("section",{},o("h2",{},"Swing"),o("div",{class:"choices"},D("swing","switches",e.swingControl,"Switches",r,E.switches,a=>f(e,{swingControl:a})),D("swing","select",e.swingControl,"A mode select",`${j(e,"Swing",!0)}, and picks one of: ${t.map(a=>a==="both"?Z[a]:Z[a].toLowerCase()).join(", ")}. ${he}`,E.select,a=>f(e,{swingControl:a})),D("swing","hidden",e.swingControl,"Not shown in Matter","No swing control. Pick below what the plugin does with the swing instead.",E.hidden,a=>f(e,{swingControl:a}))),e.swingControl==="hidden"?o("div",{class:"field"},o("label",{for:"swing-fixed"},"When the plugin sends a command, the swing"),o("select",{id:"swing-fixed",onchange:a=>f(e,{swingModeWhenHidden:a.target.value})},o("option",{value:"keep",selected:e.swingModeWhenHidden==="keep"},"stays as it is"),...t.map(a=>o("option",{value:a,selected:e.swingModeWhenHidden===a},`is set to: ${Z[a]}`)))):null)}function Ee(e,t){let n=H(e.modeReplacements,t);return o("div",{class:"replacements"},...t.lackingModes.flatMap(s=>{let r=`mode-replacement-${s}`,a=t.switchableModes.find(d=>n[d]===s),l=Object.fromEntries(Object.entries(n).filter(([,d])=>d!==s)),c=d=>{let m=d.target.value,y={...l};m!==""&&(y[m]=s),f(e,{modeReplacements:H(y,t)})};return[o("label",{for:r},R[s]),o("select",{id:r,onchange:c},o("option",{value:"",selected:a===void 0},"is not offered"),...t.switchableModes.map(d=>o("option",{value:d,selected:a===d,disabled:l[d]!==void 0||!V(d,s,l,t)},`runs ${R[d].toLowerCase()}`)))]}))}function De(e,t){let{switchableModes:n,lackingModes:s}=t;if(n.length===0)return null;let r=n.filter(g=>e.modeSwitches.includes(g)),a=n.filter(g=>g==="dehumidify"||g==="fan"),l=a.length>0,c=e.modeControl==="select"&&!l?"native":e.modeControl,d=g=>{g==="switches"&&r.length===0?f(e,{modeControl:g,modeSwitches:l?a:[...n]}):f(e,{modeControl:g})},m=n.includes("cool")?"cool":"heat",y=a.map(g=>R[g].toLowerCase()).join(" and "),u=l?`Off turns the unit off, or from ${y} puts it back in ${m}.`:"Off turns the unit off.",k=`${R[r.length>0?r[0]:n[0]]} Mode`,w=e.isComposed?`Each appears as a part of "${e.name}", tagged with its mode, such as "${k}".`:`Each appears as "${e.name} ${k}", and so on.`,M=s.map(g=>R[g].toLowerCase()),me=M.length===1?M[0]:`${M.slice(0,-1).join(", ")} or ${M[M.length-1]}`;return o("section",{},o("h2",{},"Modes"),o("p",{class:"help"},"Every mode of the unit is a mode of the air conditioner in Matter, but some apps, such as Apple Home and Google Home, only offer off, cool, heat and auto."),o("div",{class:"choices",role:"radiogroup","aria-label":"Modes"},b("mode-control","native",c,"Native modes only","The modes of the unit are those of the air conditioner, as Matter has them, and nothing more is added.",d),l?b("mode-control","select",c,"A mode select",`${j(e,"Mode",!0)}, with Off and every mode of the unit, as the air conditioner has them. Picking a mode turns the unit on in it. ${he}`,d):null,b("mode-control","switches",c,"Switches",`A switch for each mode picked below. On turns the unit on in that mode. ${u}`,d),c==="switches"?o("div",{class:"sub"},xe("mode-switch","Modes that get a switch",n,r,R,g=>f(e,{modeSwitches:g})),o("p",{class:"help"},w)):null),s.length>0?o("div",{class:"field"},o("h3",{},"Modes the unit lacks"),o("p",{class:"help"},`This unit has no ${me}. Each can run one of its modes instead, such as heat running dry on a unit that only cools: an app then reaches that mode from the modes it offers, and nothing is added to Matter. The air conditioner shows the mode picked while the unit is in it, with its setpoint. Auto is offered once the air conditioner both cools and heats, counting these.`),Ee(e,t)):null)}function He(e,t){return t.specialModes.length===0?null:o("section",{},o("h2",{},"Special modes"),o("p",{class:"help"},"Matter has no control for these, so each can get a switch of its own. A switch only takes effect in the modes this unit offers that special mode in."),o("div",{class:"choices"},...t.specialModes.map(n=>O(`special-${n}`,e.specialModeSwitches.includes(n),`Add a switch for ${pe[n].title}`,pe[n].text,s=>f(e,{specialModeSwitches:t.specialModes.filter(r=>r===n?s:e.specialModeSwitches.includes(r))})))))}function Le(e){return o("section",{},o("h2",{},"Humidity and outdoor temperature"),o("p",{class:"help"},"No adapter says which readings its unit has, so each of these takes effect once the unit gives that reading. The room temperature and the humidity are always on the air conditioner."),o("div",{class:"choices"},O("separate-humidity",e.hasSeparateHumiditySensor,"Also show the humidity on a sensor of its own",`${j(e,"Humidity",!1)}, and the air conditioner keeps its humidity. For apps that show no humidity on an air conditioner, which Apple Home is reported to be.`,t=>f(e,{hasSeparateHumiditySensor:t})),O("outdoor-sensor",e.hasOutdoorTemperatureSensor,"Add a sensor for the outdoor temperature",`It appears as "${e.name} Outdoor Temperature". It is a device of its own, which you can put in another room, such as outside. Until you do, a Matter app may show the outdoor temperature as that of the room it put the sensor in. Some units give no outdoor temperature while they are idle: the sensor then shows no value.`,t=>f(e,{hasOutdoorTemperatureSensor:t}))))}function Fe(e){return o("section",{},o("h2",{},"One device or several"),o("p",{class:"help"},"The switches, a fan of its own and a humidity sensor of its own can be parts of the air conditioner in Matter, or devices of their own beside it. The outdoor temperature sensor is always a device of its own, so that you can put it in another room than the air conditioner."),o("div",{class:"choices"},O("composed",e.isComposed,"Make them parts of the air conditioner",`Your Matter app has one device, "${e.name}", and they move between rooms with it. A part has no name of its own in Matter, so an app may show the switches as numbered outlets, and an app that shows no parts shows the air conditioner alone. Turned off, each is a device of its own with its own name, which your app puts in a room by itself.`,t=>f(e,{isComposed:t}))))}function ue(){let e=v();if(e===void 0)return[S()];let t=e.controls??ee;return[$(),U(),K(e,`Options for the air conditioner at ${e.adapter.host}. Power, mode and temperature always appear in Matter: choose how the rest appears.`),ke(e,t),$e(e,t),Re(e),De(e,t),He(e,t),Le(e),Fe(e),e.isNew?null:o("p",{class:"help"},"Changing any of these rebuilds this air conditioner in Matter. Your Matter app may take a moment to show the change."),S(),o("div",{class:"footer"},h("Cancel",x),h(e.isNew?`Add ${e.name}`:"Save options",()=>{ie(e)},"primary"))]}function fe(){try{if(window.parent===window)return;let e=getComputedStyle(window.parent.document.body);for(let t of["--primary-color","--div-bg-color","--div-text-color","--main-bg-color","--main-label-color","--div-border-color","--main-light-color"]){let n=e.getPropertyValue(t).trim();n!==""&&document.documentElement.style.setProperty(`--host${t.slice(1)}`,n)}document.documentElement.style.setProperty("--host-font",e.fontFamily)}catch{}}oe({loading:()=>[o("p",{class:"notice working",role:"status"},o("span",{class:"spinner"}),"Loading\u2026")],home:de,find:le,connect:re,options:ue,done:ce});fe();p();W();
1
+ async function k(e,t,o){try{let[s,a]=e.split(" "),r={method:s};t!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(t));let c=await fetch(new URL(`api/${a}${o===void 0?"":`?${o}`}`,document.baseURI),r);if(c.status===204)return{ok:!0};if(c.status===503)return{ok:!1,error:"The plugin is not running. Start it in Matterbridge, then reload this page."};let l=await c.json();return"ok"in l?l:{ok:!1,error:l.error??`The plugin answered with status ${c.status}`}}catch{return{ok:!1,error:"Matterbridge did not answer. Check that it is running, then try again."}}}var i={screen:"loading",setup:void 0,found:[],selected:new Set,queue:[],saved:[],handled:[],isBusy:!1,busyText:"",error:"",info:"",confirmingRemoval:""};function y(){return i.queue[0]}function A(e){return e.name===""?e.adapter.host:e.name}function G(e){return(i.setup?.devices??[]).some(t=>t.macAddress===e.macAddress)}function R(e){let{fanControl:t,fanSpeedWhenHidden:o,swingControl:s,swingModeWhenHidden:a,modeControl:r,modeSwitches:c,modeReplacements:l,fanAutoControl:d,hasSeparateFan:p,specialModeSwitches:g,hasOutdoorTemperatureSensor:u,hasSeparateHumiditySensor:C,isComposed:w}=e;return{fanControl:t,fanSpeedWhenHidden:o,swingControl:s,swingModeWhenHidden:a,modeControl:r,modeSwitches:[...c],modeReplacements:{...l},fanAutoControl:d,hasSeparateFan:p,specialModeSwitches:[...g],hasOutdoorTemperatureSensor:u,hasSeparateHumiditySensor:C,isComposed:w}}var ye={fanControl:"steps",fanSpeedWhenHidden:"keep",swingControl:"switches",swingModeWhenHidden:"keep",modeControl:"native",modeSwitches:[],modeReplacements:{},fanAutoControl:"native",hasSeparateFan:!1,specialModeSwitches:[],hasOutdoorTemperatureSensor:!1,hasSeparateHumiditySensor:!1,isComposed:!0},Se=32;function z(e,t){if(e===""||!t.has(e))return e;for(let o=2;;o++){let s=` ${o}`,a=`${e.slice(0,Se-s.length).trimEnd()}${s}`;if(!t.has(a))return a}}function ee(e){let t=(i.setup?.devices??[]).filter(s=>s.macAddress!==e.adapter.macAddress).map(s=>s.name),o=i.queue.filter(s=>s!==e).map(s=>s.name);return new Set([...t,...o].filter(s=>s!==""))}function te(e){let t=new Set((i.setup?.devices??[]).map(o=>o.name));return e.map(o=>{let s=z(o.name??"",t);return s!==""&&t.add(s),{adapter:o,name:s,isNew:!0,...R(ye)}})}function ne(e){let{capabilities:t,controls:o,name:s,macAddress:a,host:r,protocol:c,requiresRegistration:l,usesHttps:d,requiresLocalPassword:p}=e;return{adapter:{host:r,protocol:c,macAddress:a,requiresRegistration:l,usesHttps:d,requiresLocalPassword:p},name:s,isNew:!1,capabilities:t,controls:o,...R(e)}}var oe={fanSteps:[],hasFanAuto:!1,hasSwing:!1,switchableModes:[],lackingModes:[],specialModes:[]};function Q(e,t,o,s){if(!s.switchableModes.includes(e)||!s.lackingModes.includes(t))return!1;let a=s.switchableModes.filter(c=>c!==e).map(c=>o[c]);if(a.includes(t))return!1;if(t!=="auto")return!0;let r=new Set([...s.switchableModes,...a]);return r.has("cool")&&r.has("heat")}function H(e,t){let o={};for(let s of t.switchableModes){let a=e[s];a!==void 0&&Q(s,a,e,t)&&(o[s]=a)}return o}var q={apple:{title:"Apple Home",text:"Fan speed as a percentage, the humidity on a sensor of its own too, and a switch for auto fan and for each of dry and fan, each a device of its own. The swing is not shown and stays as it is."},google:{title:"Google Home",text:"Fan speed as steps, the humidity on a sensor of its own too, and a switch for auto fan and for each of dry and fan, each a device of its own. The swing is the rocking of the fan."},matter:{title:"Full Matter support",text:"For apps that show every Matter control: fan speed as steps with its auto mode, the swing as the rocking of the fan, a switch for each special mode and the outdoor temperature, all as one device."}};function L(e,t){let o=e==="matter",s=t.hasSwing&&e!=="apple"?"native":"hidden",a=o?[]:t.switchableModes.filter(r=>r==="dehumidify"||r==="fan");return{fanControl:t.fanSteps.length===0?"hidden":e==="apple"?"percent":"steps",fanSpeedWhenHidden:"keep",swingControl:s,swingModeWhenHidden:"keep",modeControl:a.length>0?"switches":"native",modeSwitches:a,modeReplacements:{},fanAutoControl:!o&&t.hasFanAuto?"switch":"native",hasSeparateFan:!1,specialModeSwitches:o?[...t.specialModes]:[],hasOutdoorTemperatureSensor:o,hasSeparateHumiditySensor:!o,isComposed:o}}function se(e,t,o){let s=R(e);o.fanSteps.length===0&&Object.assign(s,{fanControl:"hidden",fanSpeedWhenHidden:"keep"}),s.fanControl==="hidden"&&(s.hasSeparateFan=!1);let a=s.fanAutoControl==="firstStep"||s.fanAutoControl==="lastStep",r=s.fanControl==="hidden"&&s.fanSpeedWhenHidden!=="keep";return(!o.hasFanAuto||a&&s.fanControl==="hidden"||r)&&(s.fanAutoControl="native"),o.hasSwing||Object.assign(s,{swingControl:"hidden",swingModeWhenHidden:"keep"}),s.fanControl==="hidden"&&s.swingControl==="switches"&&(s.swingControl="native"),s.modeSwitches=s.modeControl==="switches"?o.switchableModes.filter(l=>s.modeSwitches.includes(l)):[],s.modeReplacements=H(s.modeReplacements,o),{native:!0,select:o.switchableModes.includes("dehumidify")||o.switchableModes.includes("fan"),switches:s.modeSwitches.length>0}[s.modeControl]||(s.modeControl="native"),s.specialModeSwitches=o.specialModes.filter(l=>s.specialModeSwitches.includes(l)),JSON.stringify(s)===JSON.stringify(L(t,o))}var J;function ie(e){J=e}function h(){let e=document.getElementById("app");if(e===null||J===void 0)return;let t=`${i.screen}:${y()?.adapter.host??""}`,o=e.dataset.form===t,s=document.activeElement,a=s instanceof HTMLElement?s.id:"",r=s instanceof HTMLInputElement&&(s.type==="text"||s.type==="password")?{start:s.selectionStart,end:s.selectionEnd}:void 0,c=new Map;for(let d of e.querySelectorAll("input[type=text], input[type=password]"))d.id!==""&&c.set(d.id,d.value);if(e.replaceChildren(...J[i.screen]().filter(d=>d!==!1&&d!==null&&d!==void 0)),e.dataset.form=t,!o)return;for(let[d,p]of c){let g=document.getElementById(d);g instanceof HTMLInputElement&&(g.value=p)}if(a==="")return;let l=document.getElementById(a);l?.focus(),r!==void 0&&l instanceof HTMLInputElement&&l.setSelectionRange(r.start,r.end)}async function N(e,t){i.isBusy=!0,i.busyText=e,i.error="",i.info="",h();try{return await t()}finally{i.isBusy=!1,h()}}async function I(){let e=await k("GET state");if(!e.ok){i.error=e.error,i.screen="home",h();return}if(i.setup=e.state,e.state.devices.length===0){await F();return}i.screen="home",h()}async function W(){let e=await k("GET state");e.ok&&(i.setup=e.state)}function x(){i.queue=[],i.saved=[],i.handled=[],i.error="",i.info="",i.screen="home",W().then(h),h()}async function F(){i.screen="find";let e=await N("Searching your network. This takes about three seconds\u2026",async()=>k("POST discover"));if(!e.ok){i.error=`The search did not run: ${e.error}`,h();return}await W();let t=i.found.filter(o=>!e.devices.some(s=>s.host===o.host)&&i.selected.has(o.host)).map(o=>({...o,isConfigured:G(o)}));i.found=[...e.devices,...t];for(let o of e.devices)o.isConfigured||i.selected.add(o.host);h()}async function ae(e){let t=await N(`Looking for an adapter at ${e}\u2026`,async()=>k("POST identify",{host:e}));if(!t.ok){i.error=t.error,h();return}let o=G(t.device),s=t.device.requiresRegistration===!0;i.found=[...i.found.filter(a=>a.host!==t.device.host),{...t.device,isConfigured:o,needsRegistration:s}],o||i.selected.add(t.device.host),h()}function B(e){i.queue=e,i.saved=[],i.handled=[],Z()}async function Z(){let e=y();if(e===void 0){i.screen=i.saved.length>0?"done":"home",await W(),h();return}i.screen="connect",i.error="",i.info="",e.probe=void 0,h(),await P(e)}async function P(e,t){let o={device:e.adapter,localPassword:e.localPassword,key:t},s=t===void 0?`Checking ${A(e)}\u2026`:`Registering with ${A(e)}\u2026`,a=await N(s,async()=>k(t===void 0?"POST probe":"POST register",o));if(!a.ok){i.error=a.error,h();return}if(e.probe=a.result,e.adapter=a.result.device,a.result.status==="ready"){let r=e.controls===void 0;e.capabilities=a.result.capabilities,e.controls=a.result.controls,e.isNew&&r&&e.controls!==void 0&&Object.assign(e,L("apple",e.controls));let c=a.result.device.name??"";e.name===""&&c!==""&&(e.name=z(c,ee(e))),i.screen="options"}h()}function re(){let e=i.queue.shift();e!==void 0&&i.handled.push({label:A(e),isSaved:!1}),Z()}async function ce(e){let t=e.name.trim(),o=be(e,t);if(o!==""){i.error=o,h();return}let{adapter:s,localPassword:a}=e,r={...s,name:t,localPassword:a,...R(e)},c=await N(`Saving ${t}\u2026`,async()=>k("POST device",{device:r}));if(!c.ok){i.error=c.error,h();return}i.setup=c.state,i.saved.push(t),i.handled.push({label:t,isSaved:!0}),i.queue.shift(),await Z()}function be(e,t){return t===""?"Give the air conditioner a name: it is the name it gets in Matter.":(i.setup?.devices??[]).some(s=>s.name===t&&s.macAddress!==e.adapter.macAddress)?`"${t}" is already the name of another air conditioner. Pick a different one.`:""}var X="Matterbridge's own list of devices shows the change once you reload its page.";async function le(e){let t=await N(`Removing ${e.name}\u2026`,async()=>k("DELETE device",void 0,`macAddress=${encodeURIComponent(e.macAddress)}`));i.confirmingRemoval="",t.ok?i.info=`${e.name} is removed. ${X}`:i.error=t.error,await W(),h()}function n(e,t={},...o){let s=document.createElement(e);for(let[a,r]of Object.entries(t))r===void 0||r===!1||(a==="class"?s.className=String(r):a==="html"?s.innerHTML=String(r):a.startsWith("on")&&typeof r=="function"?s.addEventListener(a.slice(2),r):a in s?s[a]=r:s.setAttribute(a,String(r)));for(let a of o)a!==!1&&a!==null&&a!==void 0&&s.append(a);return s}function f(e,t,o="quiet",s=!1){return n("button",{type:"button",class:`button ${o}`,onclick:t,disabled:s||i.isBusy},e)}function S(){return i.isBusy?n("p",{class:"notice working",role:"status"},n("span",{class:"spinner"}),i.busyText):i.error!==""?n("p",{class:"notice problem",role:"alert"},i.error):i.info!==""?n("p",{class:"notice",role:"status"},i.info):null}function U(){let e=y();if(e===void 0||!e.isNew||i.handled.length+i.queue.length<2)return null;let t=i.screen==="connect"?"Connecting":"Choosing options";return n("ol",{class:"units","aria-label":"Air conditioners in this setup"},...i.handled.map(o=>n("li",{class:o.isSaved?"done":"skipped"},n("strong",{},o.label),n("span",{class:"meta"},o.isSaved?"Added":"Skipped"))),...i.queue.map((o,s)=>n("li",{class:s===0?"current":"ahead","aria-current":s===0?"true":void 0},n("strong",{},A(o)),n("span",{class:"meta"},s===0?t:"Waiting"))))}function K(e,t){return n("header",{class:"unit-header"},n("h1",{},A(e)),n("p",{class:"meta"},t))}function E(){if(i.queue.length>0&&!i.queue.some(s=>s.isNew))return null;let e=["Find","Connect","Options"],o=["find","connect","options"].indexOf(i.screen);return n("ol",{class:"steps"},...e.map((s,a)=>{let r="ahead";return a<o?r="done":a===o&&(r="current"),n("li",{class:r,"aria-current":a===o?"step":void 0},s)}))}function Me(e,t){let o=n("input",{type:"password",id:"lock-code",inputMode:"numeric",autocomplete:"off",maxLength:64});return n("div",{class:"field"},n("label",{for:"lock-code"},"Child lock code"),n("p",{class:"help"},"The 4-digit code set under Child lock in the Daikin app the adapter was set up with. It is not printed on the adapter."),t?n("p",{class:"problem-text"},"The adapter did not accept that code."):null,n("div",{class:"inline-form"},o,f("Check the code",()=>{o.value!==""&&(e.localPassword=o.value,P(e))},"primary")))}function ke(e,t){let o=n("input",{type:"text",id:"adapter-key",autocomplete:"off",spellcheck:!1,maxLength:64});return n("div",{class:"field"},n("label",{for:"adapter-key"},"KEY on the adapter"),n("p",{class:"help"},"This adapter only answers apps it has registered. The KEY is printed on its label, next to the SSID, and in the operation manual. It is used once and not stored."),t?n("p",{class:"problem-text"},"The adapter did not accept that KEY."):null,n("div",{class:"inline-form"},o,f("Register",()=>{o.value.trim()!==""&&P(e,o.value.trim())},"primary")))}function xe(e){let t=e.probe?.status;return t==="localPasswordRequired"||t==="localPasswordRejected"?Me(e,t==="localPasswordRejected"):t==="registrationRequired"||t==="registrationRejected"?ke(e,t==="registrationRejected"):t==="unreachable"?n("p",{class:"notice problem",role:"alert"},`${e.name} did not answer at ${e.adapter.host}. Check that it has power and is on the network, then try again.`):t==="failed"?n("p",{class:"notice problem",role:"alert"},`${e.name} answered with an error: ${e.probe?.message??"unknown"}`):null}function de(){let e=y();if(e===void 0)return[S()];let t=e.probe?.status==="unreachable"||e.probe?.status==="failed"||i.error!=="";return[E(),U(),K(e,`Connecting to its adapter at ${e.adapter.host}.`),S(),i.isBusy?null:xe(e),n("div",{class:"footer"},t?f("Try again",()=>{P(e)}):null,f(e.isNew&&i.queue.length>1?"Skip this one":"Cancel",e.isNew&&i.queue.length>1?re:x))]}function pe(){let e=i.saved;return[n("header",{},n("h1",{},e.length===1?`${e[0]} is set up`:`${e.length} air conditioners are set up`)),n("p",{class:"lead"},"They now appear in the Matter apps paired with Matterbridge. If Matterbridge is not paired yet, pair it from its home page."),n("p",{class:"help"},X),n("div",{class:"footer"},f("Done",x,"primary"))]}function Ce(e){let t=!e.isConfigured,o=[];e.isConfigured&&o.push("Already set up."),e.name===void 0&&o.push("It has not told its name yet: you will name it in its options."),t&&e.needsRegistration?o.push("Asks for the KEY printed on its label."):t&&e.requiresRegistration&&o.push("Already registered with this plugin, so it will not ask for its KEY."),t&&e.requiresLocalPassword&&o.push("Asks for its child lock code.");let s=n("input",{type:"checkbox",id:`found-${e.host}`,checked:t&&i.selected.has(e.host),disabled:!t,onchange:()=>{s.checked?i.selected.add(e.host):i.selected.delete(e.host),h()}});return n("li",{class:t?"found":"found unavailable"},n("label",{for:`found-${e.host}`},s,n("span",{},n("strong",{},e.name??"Unnamed adapter"),n("span",{class:"meta"},` ${e.host}`),...o.map(a=>n("span",{class:"meta note"},a)))))}function he(){let e=i.found.filter(a=>i.selected.has(a.host)&&!a.isConfigured),t=n("input",{type:"text",id:"host",placeholder:"192.168.1.50",spellcheck:!1,autocomplete:"off"}),o=()=>{t.value.trim()!==""&&ae(t.value.trim())};t.addEventListener("keydown",a=>{a.key==="Enter"&&o()});let s=e.length===1?"Set up 1 air conditioner":`Set up ${e.length} air conditioners`;return[E(),n("header",{},n("h1",{},"Find your air conditioners")),S(),i.found.length>0?n("ul",{class:"found-list"},...i.found.map(Ce)):null,!i.isBusy&&i.found.length===0?n("p",{class:"empty"},"No adapter answered. A search only reaches adapters on the same network segment as Matterbridge: add the others by address below."):null,n("details",{class:"manual",open:!i.isBusy&&i.found.length===0},n("summary",{},"Can't see your air conditioner?"),n("p",{class:"help"},"Enter the address of its adapter. The plugin reads the name of the adapter there and follows it to a new address like any other, as long as a search can reach it. An adapter on another subnet or VLAN keeps this address."),n("div",{class:"inline-form"},n("label",{for:"host",class:"visually-hidden"},"Adapter address"),t,f("Look it up",o))),n("div",{class:"footer"},f("Search again",()=>{F()}),f("Cancel",x),f(s,()=>B(te(e)),"primary",e.length===0))]}var Y={auto:"auto mode",cool:"cool mode",heat:"heat mode",dehumidify:"dry mode",fan:"fan mode"};function Ae(e){let t=e.controls===void 0||e.controls.fanSteps.length>0,o=e.controls===void 0||e.controls.hasSwing,s=e.hasSeparateFan?" on a fan of its own":"",a={native:"",switch:"",firstStep:" with auto first",lastStep:" with auto last"}[e.fanAutoControl],r=e.fanControl==="hidden"?"fan speed not shown":`fan speed as ${e.fanControl==="steps"?"steps":"a percentage"}${a}${s}`,c={native:"swing as native rocking",switches:"swing as switches",select:"swing as a mode select",hidden:"swing not shown"}[e.swingControl],l=[t?r:"",o?c:""].filter(w=>w!=="").join(", "),d=e.modeControl==="switches"?e.modeSwitches.map(w=>Y[w]):[],p=Object.keys(Y).flatMap(w=>{let M=e.modeReplacements[w];return M===void 0?[]:[`${Y[w]} as ${Y[M].replace(" mode","")}`]}),g=[...d,e.fanAutoControl==="switch"?"auto fan":"",...e.specialModeSwitches].filter(w=>w!==""),u=[g.length===0?"":`a switch for ${g.join(", ")}`,e.modeControl==="select"?"a mode select":"",p.join(" and ")].filter(w=>w!=="").join(" and "),C=e.isComposed?", all as one device":"";return l===""?`${u===""?"power, mode and temperature":u}${C}`:`${u===""?l:`${l}, and ${u}`}${C}`}function $e(e){let t={online:"Online",offline:"Not answering",stopped:"Not started"}[e.status],o=i.confirmingRemoval===e.macAddress;return n("li",{class:"device"},n("div",{class:"device-main"},n("h3",{},e.name),n("p",{class:"meta"},n("span",{class:`status ${e.status}`},t),` at ${e.host}. In Matter: ${Ae(e)}.`),e.status!=="online"&&e.error?n("p",{class:"meta problem-text"},e.error):null),o?n("div",{class:"actions"},n("span",{class:"meta"},"Remove it from Matter too?"),f("Remove",()=>{le(e)},"danger"),f("Keep",()=>{i.confirmingRemoval="",h()})):n("div",{class:"actions"},f(e.status==="online"?"Options":"Reconnect",()=>B([ne(e)])),f("Remove",()=>{i.confirmingRemoval=e.macAddress,h()})))}function ue(){let e=i.setup?.devices??[];return[n("header",{},n("h1",{},"Daikin air conditioners"),i.setup?f("Add air conditioners",()=>{F()},"primary"):null),S(),e.length===0&&i.setup?n("p",{class:"empty"},"No air conditioner is set up yet. Add one to control it from Matter."):n("ul",{class:"devices"},...e.map($e)),i.setup?null:f("Try again",()=>{I()},"primary")]}var V={auto:"Auto",silent:"Silent",level1:"Level 1",level2:"Level 2",level3:"Level 3",level4:"Level 4",level5:"Level 5"},_={off:"No swing",vertical:"Up and down",horizontal:"Left and right",both:"3D swing"},D={auto:"Auto",cool:"Cool",heat:"Heat",dehumidify:"Dry",fan:"Fan"},fe={powerful:{title:"Powerful",text:"Runs the unit at full power for a while."},econo:{title:"Econo",text:"Limits how much power the unit draws."},streamer:{title:"Streamer",text:"Runs the air purifying of the unit."}},$={steps:'<svg viewBox="0 0 48 28" aria-hidden="true"><rect x="2" y="20" width="8" height="6"/><rect x="14" y="14" width="8" height="12"/><rect x="26" y="8" width="8" height="18"/><rect x="38" y="2" width="8" height="24"/></svg>',percent:'<svg viewBox="0 0 48 28" aria-hidden="true"><path d="M2 26 L46 2 L46 26 Z"/></svg>',hidden:'<svg viewBox="0 0 48 28" aria-hidden="true"><path class="stroke" d="M6 14 H42" stroke-dasharray="3 5"/></svg>',switches:'<svg viewBox="0 0 48 28" aria-hidden="true"><path class="stroke" d="M12 4 V24 M7 9 L12 4 L17 9 M7 19 L12 24 L17 19"/><path class="stroke" d="M26 14 H46 M31 9 L26 14 L31 19 M41 9 L46 14 L41 19"/></svg>',select:'<svg viewBox="0 0 48 28" aria-hidden="true"><rect class="stroke" x="3" y="5" width="42" height="18" rx="4"/><path class="stroke" d="M31 12 L35 16 L39 12"/></svg>',rocking:'<svg viewBox="0 0 48 28" aria-hidden="true"><path class="stroke" d="M8 20 Q24 0 40 20"/><path class="stroke" d="M8 13 V20 H15 M40 13 V20 H33"/></svg>'},me="Few apps show a mode select: Home Assistant does, Apple Home does not.";function j(e,t,o){return e.isComposed?o?`It appears as a part of "${e.name}", tagged "${t}"`:`It appears as a part of "${e.name}"`:`It appears as "${e.name} ${t}"`}function m(e,t){Object.assign(e,t),h()}function T(e,t,o,s,a,r,c){let l=`${e}-${t}`,d=n("input",{type:"radio",name:e,id:l,checked:t===o,onchange:()=>c(t)});return n("label",{class:"choice pictured",for:l},d,n("span",{class:"glyph",html:r}),n("span",{},n("strong",{},s),n("span",{class:"meta"},a)))}function b(e,t,o,s,a,r){let c=`${e}-${t}`,l=n("input",{type:"radio",name:e,id:c,checked:t===o,onchange:()=>r(t)});return n("label",{class:"choice",for:c},l,n("span",{},n("strong",{},s),n("span",{class:"meta"},a)))}function O(e,t,o,s,a){let r=n("input",{type:"checkbox",id:e,checked:t,onchange:()=>a(r.checked)});return n("label",{class:"choice",for:e},r,n("span",{},n("strong",{},o),n("span",{class:"meta"},s)))}function Te(e,t,o,s,a,r){return n("div",{class:"chips",role:"group","aria-label":t},...o.map(c=>{let l=`${e}-${c}`,d=n("input",{type:"checkbox",id:l,checked:s.includes(c),onchange:()=>r(o.filter(p=>p===c?d.checked:s.includes(p)))});return n("label",{class:"chip",for:l},d,a[c])}))}function Re(e){let t=e.adapter.name,o=`at ${e.adapter.host}`;return t===void 0||t===""?`the air conditioner ${o}`:`the air conditioner named "${t}" in its Daikin app, ${o}`}function Ee(e){let t=n("input",{type:"text",id:"device-name",value:e.name,maxLength:32,autocomplete:"off",spellcheck:!1});t.addEventListener("input",a=>{e.name=t.value.trim(),a.isComposing||h()});let o=e.adapter.name,s=o===void 0||o===""?"Its adapter has no name of its own.":`Its adapter is named "${o}" in its Daikin app, which other adapters can share.`;return n("section",{},n("h2",{},n("label",{for:"device-name"},"Name in Matter")),n("p",{class:"help"},`${s} The name here is what your Matter apps show, up to 32 characters, and no two air conditioners of this plugin share one. A new name of the adapter does not change it.`),n("div",{class:"inline-form"},t))}function De(e,t){return n("section",{class:"presets"},n("h2",{},"Start from a preset"),n("div",{class:"preset-list"},...Object.keys(q).map(o=>n("button",{type:"button",class:"preset","aria-pressed":String(se(e,o,t)),onclick:()=>m(e,L(o,t))},n("strong",{},q[o].title),n("span",{class:"meta"},q[o].text)))),n("p",{class:"help"},"A preset fills in the choices below for what this unit can do. Change any of them afterwards."))}function He(e){let t=e.map(o=>V[o]);return t.length===1?t[0]:`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function Le(e,t,o){if(!t.hasFanAuto||e.fanControl==="hidden"&&e.fanSpeedWhenHidden!=="keep")return null;let s=p=>m(e,{fanAutoControl:p}),a=e.fanControl==="hidden",r=`${j(e,"Auto Fan",!0)}. On sets the fan to auto, off puts it back at the speed it last ran at.`,c=V[t.fanSteps[0]],l=V[t.fanSteps[t.fanSteps.length-1]],d=a?[b("fan-auto","native",o,"Not shown in Matter","Without a fan speed in Matter, auto has no place there either.",s),b("fan-auto","switch",o,"A switch",r,s)]:[b("fan-auto","native",o,"Native fan mode only","Auto is a mode of the fan speed, beside its speeds, as Matter has it.",s),b("fan-auto","switch",o,"A switch",`${r} Auto stays a fan mode as well.`,s),b("fan-auto","firstStep",o,"The first step",`Auto comes below ${c}: step 1, or the bottom of the slider.`,s),b("fan-auto","lastStep",o,"The last step",`Auto comes above ${l}: the top step, or 100 %.`,s)];return n("div",{class:"field"},n("h3",{id:"fan-auto-title"},"Auto fan speed"),a?null:n("p",{class:"help"},"Matter has auto as a fan mode, which not every app shows. A switch makes it reachable there too, and a step takes its place."),n("div",{class:"choices",role:"radiogroup","aria-labelledby":"fan-auto-title"},...d))}function Ne(e,t){let o=e.capabilities?.fanSpeeds??[];if(t.fanSteps.length===0)return n("section",{},n("h2",{},"Fan speed"),n("p",{class:"help"},"This unit does not let apps set its fan speed, so there is nothing to choose."));let a=e.fanControl==="hidden",r=t.hasFanAuto&&!a&&(e.fanAutoControl==="firstStep"||e.fanAutoControl==="lastStep"),c=t.hasFanAuto&&e.fanAutoControl==="switch",l=t.fanSteps;r&&(l=e.fanAutoControl==="firstStep"?["auto",...t.fanSteps]:[...t.fanSteps,"auto"]);let p=t.hasFanAuto&&!r?" Auto is not among them: it is a fan mode of its own.":"",g=`${l.length} ${l.length===1?"speed":"speeds"}, ${r?"in order":"slowest first"}: ${He(l)}.${p}`;return n("section",{},n("h2",{},"Fan speed"),n("div",{class:"choices"},T("fan","steps",e.fanControl,"Steps",g,$.steps,u=>m(e,{fanControl:u})),T("fan","percent",e.fanControl,"Percentage",`A slider from 0 to 100, which the plugin rounds to the nearest of ${g}`,$.percent,u=>m(e,{fanControl:u})),T("fan","hidden",e.fanControl,"Not shown in Matter","No fan control. Pick below what the plugin does with the fan speed instead.",$.hidden,u=>m(e,{fanControl:u}))),e.fanControl==="hidden"?n("div",{class:"field"},n("label",{for:"fan-fixed"},"When the plugin sends a command, the fan speed"),n("select",{id:"fan-fixed",onchange:u=>m(e,{fanSpeedWhenHidden:u.target.value})},n("option",{value:"keep",selected:e.fanSpeedWhenHidden==="keep"},"stays as it is"),...o.map(u=>n("option",{value:u,selected:e.fanSpeedWhenHidden===u},`is set to ${V[u]}`)))):null,e.fanControl==="hidden"?null:O("separate-fan",e.hasSeparateFan,"Show the fan as a device of its own",`${j(e,"Fan",!1)}, and the air conditioner has no fan speed of its own. For apps that show no fan speed on an air conditioner, or do not show it well. It always shows the speed the unit holds, also while the unit is off.`,u=>m(e,{hasSeparateFan:u})),Le(e,t,a&&!c?"native":e.fanAutoControl))}function Fe(e,t){let o=e.capabilities?.swingModes??[];if(o.length===0)return n("section",{},n("h2",{},"Swing"),n("p",{class:"help"},"This unit does not let apps move its louvers, so there is nothing to choose."));let s=o.includes("vertical"),a=o.includes("horizontal"),r=e.fanControl!=="hidden"&&t.fanSteps.length>0,c=e.swingControl==="native"&&!r?"switches":e.swingControl,l=r?" The fan control then has no rocking.":"",d="One switch, for the up and down swing.";return s&&a?d="Two switches: one for the up and down swing, one for left and right.":a&&(d="One switch, for the left and right swing."),n("section",{},n("h2",{},"Swing"),n("div",{class:"choices"},r?T("swing","native",c,"Native rocking","The rocking of the fan control, as Matter has it: up and down for the vertical swing, left and right for the horizontal. Not every app shows it, and Apple Home is reported not to handle it well.",$.rocking,p=>m(e,{swingControl:p})):null,T("swing","switches",c,"Switches",`${d}${l}`,$.switches,p=>m(e,{swingControl:p})),T("swing","select",c,"A mode select",`${j(e,"Swing",!0)}, and picks one of: ${o.map(p=>p==="both"?_[p]:_[p].toLowerCase()).join(", ")}.${l} ${me}`,$.select,p=>m(e,{swingControl:p})),T("swing","hidden",c,"Not shown in Matter","No swing control. Pick below what the plugin does with the swing instead.",$.hidden,p=>m(e,{swingControl:p}))),e.swingControl==="hidden"?n("div",{class:"field"},n("label",{for:"swing-fixed"},"When the plugin sends a command, the swing"),n("select",{id:"swing-fixed",onchange:p=>m(e,{swingModeWhenHidden:p.target.value})},n("option",{value:"keep",selected:e.swingModeWhenHidden==="keep"},"stays as it is"),...o.map(p=>n("option",{value:p,selected:e.swingModeWhenHidden===p},`is set to: ${_[p]}`)))):null)}function Pe(e,t){let o=H(e.modeReplacements,t);return n("div",{class:"replacements"},...t.lackingModes.flatMap(s=>{let a=`mode-replacement-${s}`,r=t.switchableModes.find(d=>o[d]===s),c=Object.fromEntries(Object.entries(o).filter(([,d])=>d!==s)),l=d=>{let p=d.target.value,g={...c};p!==""&&(g[p]=s),m(e,{modeReplacements:H(g,t)})};return[n("label",{for:a},D[s]),n("select",{id:a,onchange:l},n("option",{value:"",selected:r===void 0},"is not offered"),...t.switchableModes.map(d=>n("option",{value:d,selected:r===d,disabled:c[d]!==void 0||!Q(d,s,c,t)},`runs ${D[d].toLowerCase()}`)))]}))}function Oe(e,t){let{switchableModes:o,lackingModes:s}=t;if(o.length===0)return null;let a=o.filter(v=>e.modeSwitches.includes(v)),r=o.filter(v=>v==="dehumidify"||v==="fan"),c=r.length>0,l=e.modeControl==="select"&&!c?"native":e.modeControl,d=v=>{v==="switches"&&a.length===0?m(e,{modeControl:v,modeSwitches:c?r:[...o]}):m(e,{modeControl:v})},p=o.includes("cool")?"cool":"heat",g=r.map(v=>D[v].toLowerCase()).join(" and "),u=c?`Off turns the unit off, or from ${g} puts it back in ${p}.`:"Off turns the unit off.",C=`${D[a.length>0?a[0]:o[0]]} Mode`,w=e.isComposed?`Each appears as a part of "${e.name}", tagged with its mode, such as "${C}".`:`Each appears as "${e.name} ${C}", and so on.`,M=s.map(v=>D[v].toLowerCase()),ve=M.length===1?M[0]:`${M.slice(0,-1).join(", ")} or ${M[M.length-1]}`;return n("section",{},n("h2",{},"Modes"),n("p",{class:"help"},"Every mode of the unit is a mode of the air conditioner in Matter, but some apps, such as Apple Home and Google Home, only offer off, cool, heat and auto."),n("div",{class:"choices",role:"radiogroup","aria-label":"Modes"},b("mode-control","native",l,"Native modes only","The modes of the unit are those of the air conditioner, as Matter has them, and nothing more is added.",d),c?b("mode-control","select",l,"A mode select",`${j(e,"Mode",!0)}, with Off and every mode of the unit, as the air conditioner has them. Picking a mode turns the unit on in it. ${me}`,d):null,b("mode-control","switches",l,"Switches",`A switch for each mode picked below. On turns the unit on in that mode. ${u}`,d),l==="switches"?n("div",{class:"sub"},Te("mode-switch","Modes that get a switch",o,a,D,v=>m(e,{modeSwitches:v})),n("p",{class:"help"},w)):null),s.length>0?n("div",{class:"field"},n("h3",{},"Modes the unit lacks"),n("p",{class:"help"},`This unit has no ${ve}. Each can run one of its modes instead, such as heat running dry on a unit that only cools: an app then reaches that mode from the modes it offers, and nothing is added to Matter. The air conditioner shows the mode picked while the unit is in it, with its setpoint. Auto is offered once the air conditioner both cools and heats, counting these.`),Pe(e,t)):null)}function je(e,t){return t.specialModes.length===0?null:n("section",{},n("h2",{},"Special modes"),n("p",{class:"help"},"Matter has no control for these, so each can get a switch of its own. A switch only takes effect in the modes this unit offers that special mode in."),n("div",{class:"choices"},...t.specialModes.map(o=>O(`special-${o}`,e.specialModeSwitches.includes(o),`Add a switch for ${fe[o].title}`,fe[o].text,s=>m(e,{specialModeSwitches:t.specialModes.filter(a=>a===o?s:e.specialModeSwitches.includes(a))})))))}function qe(e){return n("section",{},n("h2",{},"Humidity and outdoor temperature"),n("p",{class:"help"},"No adapter says which readings its unit has, so each of these takes effect once the unit gives that reading. The room temperature and the humidity are always on the air conditioner."),n("div",{class:"choices"},O("separate-humidity",e.hasSeparateHumiditySensor,"Also show the humidity on a sensor of its own",`${j(e,"Humidity",!1)}, and the air conditioner keeps its humidity. For apps that show no humidity on an air conditioner, which Apple Home is reported to be.`,t=>m(e,{hasSeparateHumiditySensor:t})),O("outdoor-sensor",e.hasOutdoorTemperatureSensor,"Add a sensor for the outdoor temperature",`It appears as "${e.name} Outdoor Temperature". It is a device of its own, which you can put in another room, such as outside. Until you do, a Matter app may show the outdoor temperature as that of the room it put the sensor in. Some units give no outdoor temperature while they are idle: the sensor then shows no value.`,t=>m(e,{hasOutdoorTemperatureSensor:t}))))}function Ie(e){return n("section",{},n("h2",{},"One device or several"),n("p",{class:"help"},"The switches, a fan of its own and a humidity sensor of its own can be parts of the air conditioner in Matter, or devices of their own beside it. The outdoor temperature sensor is always a device of its own, so that you can put it in another room than the air conditioner."),n("div",{class:"choices"},O("composed",e.isComposed,"Make them parts of the air conditioner",`Your Matter app has one device, "${e.name}", and they move between rooms with it. A part has no name of its own in Matter, so an app may show the switches as numbered outlets, and an app that shows no parts shows the air conditioner alone. Turned off, each is a device of its own with its own name, which your app puts in a room by itself.`,t=>m(e,{isComposed:t}))))}function ge(){let e=y();if(e===void 0)return[S()];let t=e.controls??oe;return[E(),U(),K(e,`Options for ${Re(e)}. Power, mode and temperature always appear in Matter: choose how the rest appears.`),Ee(e),De(e,t),Ne(e,t),Fe(e,t),Oe(e,t),je(e,t),qe(e),Ie(e),e.isNew?null:n("p",{class:"help"},"Changing any of these rebuilds this air conditioner in Matter. Your Matter app may take a moment to show the change."),S(),n("div",{class:"footer"},f("Cancel",x),f(e.isNew?`Add ${e.name}`:"Save options",()=>{ce(e)},"primary"))]}function we(){try{if(window.parent===window)return;let e=getComputedStyle(window.parent.document.body);for(let t of["--primary-color","--div-bg-color","--div-text-color","--main-bg-color","--main-label-color","--div-border-color","--main-light-color"]){let o=e.getPropertyValue(t).trim();o!==""&&document.documentElement.style.setProperty(`--host${t.slice(1)}`,o)}document.documentElement.style.setProperty("--host-font",e.fontFamily)}catch{}}ie({loading:()=>[n("p",{class:"notice working",role:"status"},n("span",{class:"spinner"}),"Loading\u2026")],home:ue,find:he,connect:de,options:ge,done:pe});we();h();I();
2
2
  /**
3
3
  * @file apps/frontend/src/api.ts
4
4
  * @description What the plugin's API sends and takes, and the call to it: see src/setup/setupApi.ts in the plugin.
@@ -6,20 +6,20 @@ async function C(e,t,n){try{let[s,r]=e.split(" "),a={method:s};t!==void 0&&(a.he
6
6
  * @license Apache-2.0
7
7
  */
8
8
  /**
9
- * @file apps/frontend/src/exposure.ts
10
- * @description How a device appears in Matter: the choices a draft starts with.
9
+ * @file apps/frontend/src/state.ts
10
+ * @description What the setup page knows at any moment, and what it reads from that.
11
11
  * @author Calvin Che
12
12
  * @license Apache-2.0
13
13
  */
14
14
  /**
15
- * @file apps/frontend/src/presets.ts
16
- * @description The presets of the Options step: each fills in the choices of how a device appears in Matter.
15
+ * @file apps/frontend/src/exposure.ts
16
+ * @description How a device appears in Matter: the choices a draft starts with.
17
17
  * @author Calvin Che
18
18
  * @license Apache-2.0
19
19
  */
20
20
  /**
21
- * @file apps/frontend/src/state.ts
22
- * @description What the setup page knows at any moment, and what it reads from that.
21
+ * @file apps/frontend/src/presets.ts
22
+ * @description The presets of the Options step: each fills in the choices of how a device appears in Matter.
23
23
  * @author Calvin Che
24
24
  * @license Apache-2.0
25
25
  */