daikin-local-control 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/DESIGN.md +52 -0
  2. package/LICENSE +21 -674
  3. package/README.md +45 -3
  4. package/UNSUPPORTED.md +10 -1
  5. package/dist/clients/classic.d.ts +22 -4
  6. package/dist/clients/classic.d.ts.map +1 -1
  7. package/dist/clients/classic.js +55 -8
  8. package/dist/clients/classic.js.map +1 -1
  9. package/dist/clients/client.d.ts +11 -2
  10. package/dist/clients/client.d.ts.map +1 -1
  11. package/dist/clients/dsiot.d.ts +10 -3
  12. package/dist/clients/dsiot.d.ts.map +1 -1
  13. package/dist/clients/dsiot.js +40 -5
  14. package/dist/clients/dsiot.js.map +1 -1
  15. package/dist/clients/setStateCache.d.ts +15 -0
  16. package/dist/clients/setStateCache.d.ts.map +1 -0
  17. package/dist/clients/setStateCache.js +26 -0
  18. package/dist/clients/setStateCache.js.map +1 -0
  19. package/dist/codecs/classic/capabilities.d.ts.map +1 -1
  20. package/dist/codecs/classic/capabilities.js +28 -1
  21. package/dist/codecs/classic/capabilities.js.map +1 -1
  22. package/dist/codecs/classic/extendedControl.d.ts +14 -1
  23. package/dist/codecs/classic/extendedControl.d.ts.map +1 -1
  24. package/dist/codecs/classic/extendedControl.js +39 -4
  25. package/dist/codecs/classic/extendedControl.js.map +1 -1
  26. package/dist/codecs/classic/keyValue.d.ts +3 -0
  27. package/dist/codecs/classic/keyValue.d.ts.map +1 -1
  28. package/dist/codecs/classic/keyValue.js +10 -0
  29. package/dist/codecs/classic/keyValue.js.map +1 -1
  30. package/dist/codecs/classic/state.d.ts +3 -2
  31. package/dist/codecs/classic/state.d.ts.map +1 -1
  32. package/dist/codecs/classic/state.js +14 -1
  33. package/dist/codecs/classic/state.js.map +1 -1
  34. package/dist/codecs/device.d.ts +10 -1
  35. package/dist/codecs/device.d.ts.map +1 -1
  36. package/dist/codecs/device.js +25 -10
  37. package/dist/codecs/device.js.map +1 -1
  38. package/dist/codecs/dsiot/capabilities.d.ts +4 -2
  39. package/dist/codecs/dsiot/capabilities.d.ts.map +1 -1
  40. package/dist/codecs/dsiot/capabilities.js +20 -4
  41. package/dist/codecs/dsiot/capabilities.js.map +1 -1
  42. package/dist/codecs/dsiot/device.d.ts +5 -0
  43. package/dist/codecs/dsiot/device.d.ts.map +1 -0
  44. package/dist/codecs/dsiot/device.js +14 -0
  45. package/dist/codecs/dsiot/device.js.map +1 -0
  46. package/dist/codecs/dsiot/multireq.d.ts +6 -4
  47. package/dist/codecs/dsiot/multireq.d.ts.map +1 -1
  48. package/dist/codecs/dsiot/multireq.js +9 -4
  49. package/dist/codecs/dsiot/multireq.js.map +1 -1
  50. package/dist/codecs/dsiot/state.d.ts +6 -2
  51. package/dist/codecs/dsiot/state.d.ts.map +1 -1
  52. package/dist/codecs/dsiot/state.js +12 -2
  53. package/dist/codecs/dsiot/state.js.map +1 -1
  54. package/dist/factory.d.ts +7 -0
  55. package/dist/factory.d.ts.map +1 -1
  56. package/dist/factory.js +2 -2
  57. package/dist/factory.js.map +1 -1
  58. package/dist/index.d.ts +1 -0
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +1 -0
  61. package/dist/index.js.map +1 -1
  62. package/dist/models/capabilities.d.ts +5 -1
  63. package/dist/models/capabilities.d.ts.map +1 -1
  64. package/dist/models/device.d.ts +12 -1
  65. package/dist/models/device.d.ts.map +1 -1
  66. package/dist/models/extendedControl.d.ts +2 -3
  67. package/dist/models/extendedControl.d.ts.map +1 -1
  68. package/dist/models/extendedControl.js +0 -1
  69. package/dist/models/extendedControl.js.map +1 -1
  70. package/dist/models/state.d.ts +15 -4
  71. package/dist/models/state.d.ts.map +1 -1
  72. package/dist/models/state.js +1 -0
  73. package/dist/models/state.js.map +1 -1
  74. package/package.json +2 -2
  75. package/src/clients/classic.ts +76 -10
  76. package/src/clients/client.ts +13 -1
  77. package/src/clients/dsiot.ts +52 -9
  78. package/src/clients/setStateCache.ts +28 -0
  79. package/src/codecs/classic/capabilities.ts +39 -0
  80. package/src/codecs/classic/extendedControl.ts +56 -5
  81. package/src/codecs/classic/keyValue.ts +10 -0
  82. package/src/codecs/classic/state.ts +30 -12
  83. package/src/codecs/device.ts +35 -10
  84. package/src/codecs/dsiot/capabilities.ts +27 -2
  85. package/src/codecs/dsiot/device.ts +20 -0
  86. package/src/codecs/dsiot/multireq.ts +9 -4
  87. package/src/codecs/dsiot/state.ts +16 -1
  88. package/src/factory.ts +17 -2
  89. package/src/index.ts +1 -0
  90. package/src/models/capabilities.ts +5 -0
  91. package/src/models/device.ts +13 -1
  92. package/src/models/extendedControl.ts +2 -5
  93. package/src/models/state.ts +18 -4
package/DESIGN.md CHANGED
@@ -23,6 +23,36 @@ one that landed changes nothing. `reboot()` passes `{ retry: false }`, as should
23
23
  any caller of `command()`, `multireqGet()` or `multireqUpdate()` whose request
24
24
  is not safe to repeat.
25
25
 
26
+ ## The read before a write
27
+
28
+ `setState` takes only the fields to change, but a write carries more than
29
+ those. So `setState` first reads what the unit holds, and builds the write from
30
+ that reply:
31
+
32
+ | Adapter | A write carries | The reply supplies |
33
+ | --- | --- | --- |
34
+ | Classic | Every control field the unit takes, on each `set_control_info`: `pow`, `mode`, `stemp`, `shum`, `f_rate` and the direction fields. Whether the adapter takes a request without one of them is not known, so none is left out. | Each field the control leaves out. On a mode change, the values the adapter remembers for the target mode: `dt3`, `dh3`, `dfr3` and `dfd3` for cool. |
35
+ | DSIOT | The power, the power transition and the mode on each write, then only the leaves the control changes | The power the unit holds, which decides the transition. The mode, when the control sets none. The `md` of the louver and humidity leaves, which a position and a percentage are encoded from. |
36
+
37
+ With `maxStateAgeForSetStateInMs` set, `setState` skips that read while the
38
+ client's `SetStateCache` holds a reply to `getState` or `getStateAndSensors`
39
+ younger than that. A caller that polls sets it to its poll interval, and a
40
+ write then costs one request where it cost two. No read is answered from the
41
+ cache: `getState` asks the unit every time.
42
+
43
+ The default is 0, because a write built from an old reply undoes a change made
44
+ on the remote control since that reply. Someone switches the unit to heat on
45
+ the remote, the caller sets 23 °C from a reply read before that, and the write
46
+ puts the unit back in cool.
47
+
48
+ Every write through the client clears the cache, `command()` with parameters
49
+ and `multireqUpdate()` included, so the `setState` after a write reads first.
50
+
51
+ Rejected: `setState` taking a whole `DaikinState` from the caller in place of
52
+ the read. A `DaikinState` holds the current mode's values alone: it has neither
53
+ the values a classic adapter remembers for the other modes nor the `md` of a
54
+ DSIOT leaf, so the client would still need the reply.
55
+
26
56
  ## Capabilities
27
57
 
28
58
  `DaikinCapabilities` lists what a unit accepts in the vocabulary of `DaikinState`:
@@ -96,3 +126,25 @@ Rejected: positions as the numbers 0 to 25, typed `number`, with
96
126
  - A caller learned of a mistyped number only when the call ran.
97
127
  - The `Error` was the one failure of `setState` that was not a
98
128
  `DaikinError`.
129
+
130
+ ## Special modes
131
+
132
+ `DaikinState.specialModes` lists the special modes that are on, and `getState`
133
+ reads it on both protocols. `DaikinControl` leaves it out, so `setState` is
134
+ never handed a field it cannot write: UNSUPPORTED.md says what is not known.
135
+
136
+ Rejected: a `getSpecialModes` on `ClassicDaikinClient`, beside `setSpecialMode`.
137
+
138
+ - A classic adapter reports the modes in `adv`, in the `get_control_info` reply
139
+ `getState` already reads, so the method sent a second request for a reply the
140
+ caller had.
141
+ - A DSIOT adapter reports them in its `dgc_status` trees, and a method on
142
+ `ClassicDaikinClient` gave a caller no way to read those.
143
+
144
+ `DaikinCapabilities.specialModes` lists the special modes a unit takes mode by
145
+ mode, as `targetHumidities` does.
146
+
147
+ Rejected: one list for the whole unit.
148
+
149
+ - Econo is not known to be taken in fan mode, so the one list offered it in a
150
+ mode where UNSUPPORTED.md lists it as unknown.