iobroker.iot 4.0.3 → 4.1.2

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 (251) hide show
  1. package/README.md +5 -517
  2. package/admin/assets/index-6Itc0U48.js +681 -0
  3. package/admin/index_m.html +1 -1
  4. package/admin/rules/assets/{hostInit-hos3Txsy.js → hostInit-Dxp6BaAc.js} +2 -2
  5. package/admin/rules/assets/index-208Qrr3S.js +1152 -0
  6. package/admin/rules/assets/{index-CbxmbJvB.js → index-Bvn52imU.js} +1 -1
  7. package/admin/rules/assets/preload-helper-BDBacUwf.js +1 -0
  8. package/admin/rules/assets/{virtualExposes-BNZJTatg.js → virtualExposes-O8-92o9I.js} +1 -1
  9. package/admin/rules/customRuleBlocks.js +2 -2
  10. package/admin/rules/i18n/de.json +8 -8
  11. package/admin/rules/i18n/es.json +8 -8
  12. package/admin/rules/i18n/fr.json +8 -8
  13. package/admin/rules/i18n/it.json +8 -8
  14. package/admin/rules/i18n/nl.json +8 -8
  15. package/admin/rules/i18n/pl.json +8 -8
  16. package/admin/rules/i18n/pt.json +8 -8
  17. package/admin/rules/i18n/ru.json +8 -8
  18. package/admin/rules/i18n/uk.json +8 -8
  19. package/admin/rules/i18n/zh-cn.json +8 -8
  20. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.js +6 -0
  21. package/build/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.js.map +1 -0
  22. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.js +2 -7
  23. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.js.map +1 -0
  24. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js +6 -5
  25. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js.map +1 -0
  26. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js +3 -2
  27. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js.map +1 -0
  28. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js +4 -3
  29. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js.map +1 -0
  30. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js +3 -2
  31. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js.map +1 -0
  32. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js +3 -2
  33. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js.map +1 -0
  34. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js +4 -3
  35. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js.map +1 -0
  36. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js +3 -2
  37. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js.map +1 -0
  38. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js +3 -2
  39. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js.map +1 -0
  40. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js +6 -5
  41. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js.map +1 -0
  42. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js +5 -4
  43. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js.map +1 -0
  44. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js +3 -2
  45. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js.map +1 -0
  46. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js +5 -4
  47. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js.map +1 -0
  48. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js +1 -1
  49. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js.map +1 -1
  50. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js +20 -18
  51. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js.map +1 -0
  52. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js +2 -7
  53. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js.map +1 -0
  54. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js +9 -0
  55. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js.map +1 -0
  56. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/LockState.js +20 -0
  57. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/LockState.js.map +1 -0
  58. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js +17 -3
  59. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js.map +1 -0
  60. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/PowerState.js +6 -0
  61. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/PowerState.js.map +1 -0
  62. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js +3 -3
  63. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js.map +1 -0
  64. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js +0 -3
  65. package/build/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js.map +1 -0
  66. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js +5 -7
  67. package/build/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js.map +1 -0
  68. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/AirCondition.js +65 -71
  69. package/build/lib/AlexaSmartHomeV3/Controls/AirCondition.js.map +1 -0
  70. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/ContactSensor.js +5 -1
  71. package/build/lib/AlexaSmartHomeV3/Controls/ContactSensor.js.map +1 -0
  72. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Control.js +13 -29
  73. package/build/lib/AlexaSmartHomeV3/Controls/Control.js.map +1 -0
  74. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Ct.js +66 -73
  75. package/build/lib/AlexaSmartHomeV3/Controls/Ct.js.map +1 -0
  76. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Dimmer.js +32 -39
  77. package/build/lib/AlexaSmartHomeV3/Controls/Dimmer.js.map +1 -0
  78. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Gate.js +5 -7
  79. package/build/lib/AlexaSmartHomeV3/Controls/Gate.js.map +1 -0
  80. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Hue.js +91 -89
  81. package/build/lib/AlexaSmartHomeV3/Controls/Hue.js.map +1 -0
  82. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Light.js +10 -14
  83. package/build/lib/AlexaSmartHomeV3/Controls/Light.js.map +1 -0
  84. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Lock.js +6 -8
  85. package/build/lib/AlexaSmartHomeV3/Controls/Lock.js.map +1 -0
  86. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Motion.js +5 -1
  87. package/build/lib/AlexaSmartHomeV3/Controls/Motion.js.map +1 -0
  88. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js +0 -10
  89. package/build/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js.map +1 -0
  90. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Socket.js +5 -7
  91. package/build/lib/AlexaSmartHomeV3/Controls/Socket.js.map +1 -0
  92. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Temperature.js +5 -7
  93. package/build/lib/AlexaSmartHomeV3/Controls/Temperature.js.map +1 -0
  94. package/build/lib/AlexaSmartHomeV3/Controls/Thermostat.js +82 -0
  95. package/build/lib/AlexaSmartHomeV3/Controls/Thermostat.js.map +1 -0
  96. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js +5 -7
  97. package/build/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js.map +1 -0
  98. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Volume.js +29 -36
  99. package/build/lib/AlexaSmartHomeV3/Controls/Volume.js.map +1 -0
  100. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/index.js +6 -6
  101. package/build/lib/AlexaSmartHomeV3/Controls/index.js.map +1 -0
  102. package/{build-backend → build}/lib/AlexaSmartHomeV3/DeviceManager.js +16 -10
  103. package/build/lib/AlexaSmartHomeV3/DeviceManager.js.map +1 -0
  104. package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/AdapterProvider.js +4 -1
  105. package/build/lib/AlexaSmartHomeV3/Helpers/AdapterProvider.js.map +1 -0
  106. package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/FileHelper.js +1 -3
  107. package/build/lib/AlexaSmartHomeV3/Helpers/FileHelper.js.map +1 -0
  108. package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js +23 -16
  109. package/build/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js.map +1 -0
  110. package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/Utils.js +0 -1
  111. package/build/lib/AlexaSmartHomeV3/Helpers/Utils.js.map +1 -0
  112. package/{build-backend → build}/lib/alexaSmartHomeV3.js +3 -3
  113. package/build/lib/alexaSmartHomeV3.js.map +1 -0
  114. package/{build-backend → build}/main.js +29 -9
  115. package/build/main.js.map +1 -0
  116. package/io-package.json +30 -29
  117. package/package.json +13 -13
  118. package/admin/assets/index-BjEWVyqN.js +0 -681
  119. package/admin/rules/assets/index-_Y2FN5EZ.js +0 -1152
  120. package/admin/rules/assets/preload-helper-Dp1pzeXC.js +0 -1
  121. package/build-backend/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.js.map +0 -1
  122. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.js.map +0 -1
  123. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js.map +0 -1
  124. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js.map +0 -1
  125. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js.map +0 -1
  126. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js.map +0 -1
  127. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js.map +0 -1
  128. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js.map +0 -1
  129. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js.map +0 -1
  130. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js.map +0 -1
  131. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js.map +0 -1
  132. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js.map +0 -1
  133. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js.map +0 -1
  134. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js.map +0 -1
  135. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js.map +0 -1
  136. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js.map +0 -1
  137. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js.map +0 -1
  138. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/LockState.js.map +0 -1
  139. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js.map +0 -1
  140. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/PowerState.js.map +0 -1
  141. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js.map +0 -1
  142. package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js.map +0 -1
  143. package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js.map +0 -1
  144. package/build-backend/lib/AlexaSmartHomeV3/Controls/AirCondition.js.map +0 -1
  145. package/build-backend/lib/AlexaSmartHomeV3/Controls/ContactSensor.js.map +0 -1
  146. package/build-backend/lib/AlexaSmartHomeV3/Controls/Control.js.map +0 -1
  147. package/build-backend/lib/AlexaSmartHomeV3/Controls/Ct.js.map +0 -1
  148. package/build-backend/lib/AlexaSmartHomeV3/Controls/Dimmer.js.map +0 -1
  149. package/build-backend/lib/AlexaSmartHomeV3/Controls/Gate.js.map +0 -1
  150. package/build-backend/lib/AlexaSmartHomeV3/Controls/Hue.js.map +0 -1
  151. package/build-backend/lib/AlexaSmartHomeV3/Controls/Light.js.map +0 -1
  152. package/build-backend/lib/AlexaSmartHomeV3/Controls/Lock.js.map +0 -1
  153. package/build-backend/lib/AlexaSmartHomeV3/Controls/Motion.js.map +0 -1
  154. package/build-backend/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js.map +0 -1
  155. package/build-backend/lib/AlexaSmartHomeV3/Controls/Socket.js.map +0 -1
  156. package/build-backend/lib/AlexaSmartHomeV3/Controls/Temperature.js.map +0 -1
  157. package/build-backend/lib/AlexaSmartHomeV3/Controls/Thermostat.js +0 -85
  158. package/build-backend/lib/AlexaSmartHomeV3/Controls/Thermostat.js.map +0 -1
  159. package/build-backend/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js.map +0 -1
  160. package/build-backend/lib/AlexaSmartHomeV3/Controls/Volume.js.map +0 -1
  161. package/build-backend/lib/AlexaSmartHomeV3/Controls/index.js.map +0 -1
  162. package/build-backend/lib/AlexaSmartHomeV3/DeviceManager.js.map +0 -1
  163. package/build-backend/lib/AlexaSmartHomeV3/Helpers/AdapterProvider.js.map +0 -1
  164. package/build-backend/lib/AlexaSmartHomeV3/Helpers/FileHelper.js.map +0 -1
  165. package/build-backend/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js.map +0 -1
  166. package/build-backend/lib/AlexaSmartHomeV3/Helpers/Utils.js.map +0 -1
  167. package/build-backend/lib/alexaSmartHomeV3.js.map +0 -1
  168. package/build-backend/main.js.map +0 -1
  169. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js +0 -0
  170. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js.map +0 -0
  171. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js +0 -0
  172. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js.map +0 -0
  173. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/ChangeReport.js +0 -0
  174. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/ChangeReport.js.map +0 -0
  175. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js +0 -0
  176. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js.map +0 -0
  177. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/ReportState.js +0 -0
  178. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/ReportState.js.map +0 -0
  179. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/index.js +0 -0
  180. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/index.js.map +0 -0
  181. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js +0 -0
  182. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js.map +0 -0
  183. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js +0 -0
  184. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js.map +0 -0
  185. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js +0 -0
  186. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js.map +0 -0
  187. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js +0 -0
  188. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js.map +0 -0
  189. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js +0 -0
  190. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js.map +0 -0
  191. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/ColorTemperatureInKelvin.js +0 -0
  192. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/ColorTemperatureInKelvin.js.map +0 -0
  193. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js +0 -0
  194. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js.map +0 -0
  195. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js +0 -0
  196. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js.map +0 -0
  197. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js +0 -0
  198. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js.map +0 -0
  199. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js +0 -0
  200. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js.map +0 -0
  201. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js +0 -0
  202. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js.map +0 -0
  203. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/index.js +0 -0
  204. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/index.js.map +0 -0
  205. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Blind.js +0 -0
  206. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Blind.js.map +0 -0
  207. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Door.js +0 -0
  208. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Door.js.map +0 -0
  209. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Slider.js +0 -0
  210. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Slider.js.map +0 -0
  211. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js +0 -0
  212. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js.map +0 -0
  213. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Window.js +0 -0
  214. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Window.js.map +0 -0
  215. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Device.js +0 -0
  216. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Device.js.map +0 -0
  217. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js +0 -0
  218. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js.map +0 -0
  219. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js +0 -0
  220. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js.map +0 -0
  221. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js +0 -0
  222. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js.map +0 -0
  223. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/IotProxy.js +0 -0
  224. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/IotProxy.js.map +0 -0
  225. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/Logger.js +0 -0
  226. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/Logger.js.map +0 -0
  227. /package/{build-backend → build}/lib/Utils.js +0 -0
  228. /package/{build-backend → build}/lib/Utils.js.map +0 -0
  229. /package/{build-backend → build}/lib/adminCommonSocket.js +0 -0
  230. /package/{build-backend → build}/lib/adminCommonSocket.js.map +0 -0
  231. /package/{build-backend → build}/lib/alexaCustom.js +0 -0
  232. /package/{build-backend → build}/lib/alexaCustom.js.map +0 -0
  233. /package/{build-backend → build}/lib/alexaSmartHomeV2.js +0 -0
  234. /package/{build-backend → build}/lib/alisa.js +0 -0
  235. /package/{build-backend → build}/lib/devices.js +0 -0
  236. /package/{build-backend → build}/lib/devices.js.map +0 -0
  237. /package/{build-backend → build}/lib/functions.js +0 -0
  238. /package/{build-backend → build}/lib/functions.js.map +0 -0
  239. /package/{build-backend → build}/lib/googleHome.js +0 -0
  240. /package/{build-backend → build}/lib/notifications.js +0 -0
  241. /package/{build-backend → build}/lib/notifications.js.map +0 -0
  242. /package/{build-backend → build}/lib/remote.js +0 -0
  243. /package/{build-backend → build}/lib/remote.js.map +0 -0
  244. /package/{build-backend → build}/lib/rooms.js +0 -0
  245. /package/{build-backend → build}/lib/rooms.js.map +0 -0
  246. /package/{build-backend → build}/lib/texts.js +0 -0
  247. /package/{build-backend → build}/lib/texts.js.map +0 -0
  248. /package/{build-backend → build}/lib/translate.js +0 -0
  249. /package/{build-backend → build}/lib/translate.js.map +0 -0
  250. /package/{build-backend → build}/lib/visuApp.js +0 -0
  251. /package/{build-backend → build}/lib/visuApp.js.map +0 -0
@@ -18,39 +18,33 @@ class Hue extends AdjustableControl_1.default {
18
18
  _brightnessCapability;
19
19
  _brightness;
20
20
  _colorTemperatureCapability;
21
- get categories() {
22
- return ['LIGHT'];
23
- }
24
- adjustableProperties() {
25
- return [Properties_1.default.ColorTemperatureInKelvin];
26
- }
27
- initCapabilities() {
21
+ constructor(detectedControl) {
22
+ super(detectedControl);
28
23
  const map = this.statesMap;
29
- const result = [new Capabilities_1.default.ColorController()];
24
+ this._supported = [new Capabilities_1.default.ColorController(this.composeInitObjectColor())];
30
25
  // if the state DIMMER or BRIGHTNESS configured
31
26
  if (this.states[map.dimmer] || this.states[map.brightness]) {
32
- this._brightnessCapability = new Capabilities_1.default.BrightnessController();
27
+ this._brightnessCapability = new Capabilities_1.default.BrightnessController(this.composeInitObjectBrightness());
33
28
  this._brightness = this._brightnessCapability.brightness;
34
- result.push(this._brightnessCapability);
29
+ this._supported.push(this._brightnessCapability);
35
30
  }
36
31
  // if the state TEMPERATURE configured
37
32
  if (this.states[map.temperature]) {
38
- this._colorTemperatureCapability = new Capabilities_1.default.ColorTemperatureController();
39
- result.push(this._colorTemperatureCapability);
33
+ this._colorTemperatureCapability = new Capabilities_1.default.ColorTemperatureController(this.composeInitObjectColorTemperature());
34
+ this._supported.push(this._colorTemperatureCapability);
40
35
  }
41
36
  // if the state ON, DIMMER or BRIGHTNESS configured
42
37
  if (this.states[map.on] || this._brightness) {
43
- this._powerControllerCapability = new Capabilities_1.default.PowerController();
38
+ this._powerControllerCapability = new Capabilities_1.default.PowerController(this.composeInitObjectPowerState());
44
39
  this._powerState = this._powerControllerCapability.powerState;
45
- result.push(this._powerControllerCapability);
46
- }
47
- for (const property of result.flatMap(item => item.properties)) {
48
- const initObj = this.composeInitObject(property);
49
- if (initObj) {
50
- property.init(initObj);
51
- }
40
+ this._supported.push(this._powerControllerCapability);
52
41
  }
53
- return result;
42
+ }
43
+ get categories() {
44
+ return ['LIGHT'];
45
+ }
46
+ adjustableProperties() {
47
+ return [Properties_1.default.ColorTemperatureInKelvin];
54
48
  }
55
49
  async getOrRetrieveCurrentValue(property) {
56
50
  const map = this.statesMap;
@@ -95,15 +89,23 @@ class Hue extends AdjustableControl_1.default {
95
89
  byOn === null || byOn === undefined || isNaN(byOn)
96
90
  ? range.max
97
91
  : parseFloat(byOn);
98
- await AdapterProvider_1.default.setState(this._brightness.setId, byOn);
99
- this._brightness.currentValue = byOn;
100
- this._powerState.currentValue = true;
92
+ if (this._brightness) {
93
+ await AdapterProvider_1.default.setState(this._brightness.setId, byOn);
94
+ this._brightness.currentValue = byOn;
95
+ }
96
+ if (this._powerState) {
97
+ this._powerState.currentValue = true;
98
+ }
101
99
  }
102
100
  else {
103
- // set brightness to 0 on power OFF
104
- await AdapterProvider_1.default.setState(this._brightness.setId, 0);
105
- this._brightness.currentValue = 0;
106
- this._powerState.currentValue = false;
101
+ if (this._brightness) {
102
+ // set brightness to 0 on power OFF
103
+ await AdapterProvider_1.default.setState(this._brightness.setId, 0);
104
+ this._brightness.currentValue = 0;
105
+ }
106
+ if (this._powerState) {
107
+ this._powerState.currentValue = false;
108
+ }
107
109
  }
108
110
  }
109
111
  }
@@ -140,68 +142,68 @@ class Hue extends AdjustableControl_1.default {
140
142
  await this.setState(property, value);
141
143
  return value;
142
144
  }
143
- composeInitObject(property) {
145
+ composeInitObjectPowerState() {
144
146
  const map = this.statesMap;
145
- if (property.propertyName === Properties_1.default.PowerState.propertyName) {
146
- return {
147
- setState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness],
148
- getState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness],
149
- alexaSetter: function (alexaValue) {
150
- return alexaValue === PowerState_1.default.ON;
151
- },
152
- alexaGetter: function (value) {
153
- return value ? PowerState_1.default.ON : PowerState_1.default.OFF;
154
- },
155
- };
156
- }
157
- if (property.propertyName === Brightness_1.default.propertyName) {
158
- return {
159
- setState: this.states[map.dimmer] || this.states[map.brightness],
160
- getState: this.states[map.dimmer] || this.states[map.brightness],
161
- alexaSetter: function (alexaValue) {
162
- return ((0, Utils_1.denormalize_0_100)(alexaValue, this.valuesRangeMin, this.valuesRangeMax) ?? 0);
163
- },
164
- alexaGetter: function (value) {
165
- return (0, Utils_1.normalize_0_100)(value, this.valuesRangeMin, this.valuesRangeMax);
166
- },
167
- };
168
- }
169
- if (property.propertyName === Properties_1.default.Color.propertyName) {
170
- return {
171
- hal: {
172
- hue: this.states[map.hue].id,
173
- saturation: this.states[map.saturation]?.id,
174
- brightness: (this.states[map.dimmer] || this.states[map.brightness])?.id,
175
- },
176
- };
177
- }
178
- if (property.propertyName === Properties_1.default.ColorTemperatureInKelvin.propertyName) {
179
- return {
180
- setState: this.states[map.temperature],
181
- getState: this.states[map.temperature],
182
- alexaSetter: function (alexaValue) {
183
- if (alexaValue === 1) {
184
- // increase directive
185
- const closest = (0, Utils_1.closestFromList)(this.currentValue || this.colorTemperatureTable[0], this.colorTemperatureTable);
186
- let index = this.colorTemperatureTable.indexOf(closest) + 1;
187
- index =
188
- index >= this.colorTemperatureTable.length ? this.colorTemperatureTable.length - 1 : index;
189
- return this.colorTemperatureTable[index];
190
- }
191
- if (alexaValue === -1) {
192
- // decrease directive
193
- const closest = (0, Utils_1.closestFromList)(this.currentValue || this.colorTemperatureTable[0], this.colorTemperatureTable);
194
- let index = this.colorTemperatureTable.indexOf(closest) - 1;
195
- index = index < 0 ? 0 : index;
196
- return this.colorTemperatureTable[index];
197
- }
198
- return alexaValue;
199
- },
200
- alexaGetter: function (value) {
201
- return value;
202
- },
203
- };
204
- }
147
+ return {
148
+ setState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness],
149
+ getState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness],
150
+ alexaSetter: function (alexaValue) {
151
+ return alexaValue === PowerState_1.default.ON;
152
+ },
153
+ alexaGetter: function (value) {
154
+ return value ? PowerState_1.default.ON : PowerState_1.default.OFF;
155
+ },
156
+ };
157
+ }
158
+ composeInitObjectBrightness() {
159
+ const map = this.statesMap;
160
+ return {
161
+ setState: this.states[map.dimmer] || this.states[map.brightness],
162
+ getState: this.states[map.dimmer] || this.states[map.brightness],
163
+ alexaSetter: function (alexaValue) {
164
+ return ((0, Utils_1.denormalize_0_100)(alexaValue, this.valuesRangeMin, this.valuesRangeMax) ?? 0);
165
+ },
166
+ alexaGetter: function (value) {
167
+ return (0, Utils_1.normalize_0_100)(value, this.valuesRangeMin, this.valuesRangeMax);
168
+ },
169
+ };
170
+ }
171
+ composeInitObjectColor() {
172
+ const map = this.statesMap;
173
+ return {
174
+ hal: {
175
+ hue: this.states[map.hue].id,
176
+ saturation: this.states[map.saturation]?.id,
177
+ brightness: (this.states[map.dimmer] || this.states[map.brightness])?.id,
178
+ },
179
+ };
180
+ }
181
+ composeInitObjectColorTemperature() {
182
+ const map = this.statesMap;
183
+ return {
184
+ setState: this.states[map.temperature],
185
+ getState: this.states[map.temperature],
186
+ alexaSetter: function (alexaValue) {
187
+ if (alexaValue === 1) {
188
+ // increase directive
189
+ const closest = (0, Utils_1.closestFromList)(this.currentValue || this.colorTemperatureTable[0], this.colorTemperatureTable);
190
+ let index = this.colorTemperatureTable.indexOf(closest) + 1;
191
+ index = index >= this.colorTemperatureTable.length ? this.colorTemperatureTable.length - 1 : index;
192
+ return this.colorTemperatureTable[index];
193
+ }
194
+ if (alexaValue === -1) {
195
+ // decrease directive
196
+ const closest = (0, Utils_1.closestFromList)(this.currentValue || this.colorTemperatureTable[0], this.colorTemperatureTable);
197
+ let index = this.colorTemperatureTable.indexOf(closest) - 1;
198
+ index = index < 0 ? 0 : index;
199
+ return this.colorTemperatureTable[index];
200
+ }
201
+ return alexaValue;
202
+ },
203
+ alexaGetter: function (value) {
204
+ return value;
205
+ },
206
+ };
205
207
  }
206
208
  }
207
209
  exports.default = Hue;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hue.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Hue.ts"],"names":[],"mappings":";;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AI,KAAK,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;oBAC5D,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;oBAC9B,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAC7C,CAAC;gBAED,OAAO,UAAoB,CAAC;YAChC,CAAC;YACD,WAAW,EAAE,UAET,KAAsC;gBAEtC,OAAO,KAAe,CAAC;YAC3B,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AAjPD,sBAiPC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport type PowerController from '../Alexa/Capabilities/PowerController';\nimport type BrightnessController from '../Alexa/Capabilities/BrightnessController';\nimport type ColorTemperatureController from '../Alexa/Capabilities/ColorTemperatureController';\nimport { configuredRangeOrDefault, denormalize_0_100, normalize_0_100, closestFromList } from '../Helpers/Utils';\nimport Properties from '../Alexa/Properties';\nimport PowerState from '../Alexa/Properties/PowerState';\nimport Brightness from '../Alexa/Properties/Brightness';\nimport AdapterProvider from '../Helpers/AdapterProvider';\nimport AdjustableControl from './AdjustableControl';\nimport type { Base as PropertiesBase, ControlStateInitObject } from '../Alexa/Properties/Base';\nimport type { AlexaV3Category, AlexaV3DirectiveValue, AlexaV3Request, IotExternalPatternControl } from '../types';\nimport Color from '../Alexa/Properties/Color';\nimport ColorTemperatureInKelvin from '../Alexa/Properties/ColorTemperatureInKelvin';\n\nexport default class Hue extends AdjustableControl {\n private readonly _powerControllerCapability: PowerController | undefined;\n private readonly _powerState: PowerState | undefined;\n private readonly _brightnessCapability: BrightnessController | undefined;\n private readonly _brightness: Brightness | undefined;\n private readonly _colorTemperatureCapability: ColorTemperatureController | undefined;\n\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n const map = this.statesMap;\n this._supported = [new Capabilities.ColorController(this.composeInitObjectColor())];\n\n // if the state DIMMER or BRIGHTNESS configured\n if (this.states[map.dimmer] || this.states[map.brightness]) {\n this._brightnessCapability = new Capabilities.BrightnessController(this.composeInitObjectBrightness());\n this._brightness = this._brightnessCapability.brightness;\n this._supported.push(this._brightnessCapability);\n }\n\n // if the state TEMPERATURE configured\n if (this.states[map.temperature]) {\n this._colorTemperatureCapability = new Capabilities.ColorTemperatureController(\n this.composeInitObjectColorTemperature(),\n );\n this._supported.push(this._colorTemperatureCapability);\n }\n\n // if the state ON, DIMMER or BRIGHTNESS configured\n if (this.states[map.on] || this._brightness) {\n this._powerControllerCapability = new Capabilities.PowerController(this.composeInitObjectPowerState());\n this._powerState = this._powerControllerCapability.powerState;\n this._supported.push(this._powerControllerCapability);\n }\n }\n\n get categories(): AlexaV3Category[] {\n return ['LIGHT'];\n }\n\n adjustableProperties(): (typeof PropertiesBase)[] {\n return [Properties.ColorTemperatureInKelvin];\n }\n\n async getOrRetrieveCurrentValue(property: Color): Promise<ioBroker.StateValue> {\n const map = this.statesMap;\n\n if (property.currentValue === undefined) {\n property.currentValue = await AdapterProvider.getState(property.getId);\n // convert the non-zero brightness to power = true\n if (property.propertyName === Properties.PowerState.propertyName && !this.states[map.on]) {\n property.currentValue = property.currentValue !== 0;\n }\n\n if (property.propertyName === Properties.Color.propertyName) {\n // @ts-expect-error special case for Color property\n property.currentValue = {\n hue: property.currentValue,\n saturation: property.hal.saturation,\n brightness: property.hal.brightness,\n };\n }\n }\n\n if (property.currentValue === undefined) {\n throw new Error(`unable to retrieve ${property.getId}`);\n }\n\n return property.currentValue;\n }\n\n async setState(property: PropertiesBase, value: ioBroker.StateValue | undefined): Promise<void> {\n const map = this.statesMap;\n\n if (property.propertyName === PowerState.propertyName) {\n if (this.states[map.on]) {\n await AdapterProvider.setState(property.setId, value ?? false);\n property.currentValue = value;\n } else {\n if (value) {\n // set brightness\n // set byOn to the configured value or range.max otherwise\n const range = configuredRangeOrDefault(this.states[map.dimmer] || this.states[map.brightness]!);\n const smartName = (this.states[map.dimmer] || this.states[map.brightness])?.smartName;\n let byOn: string | number | undefined | null;\n if (smartName && typeof smartName === 'object') {\n byOn = smartName.byON;\n }\n byOn =\n byOn === null || byOn === undefined || isNaN(byOn as number)\n ? (range.max as number)\n : parseFloat(byOn as string);\n if (this._brightness) {\n await AdapterProvider.setState(this._brightness.setId, byOn);\n this._brightness.currentValue = byOn;\n }\n if (this._powerState) {\n this._powerState.currentValue = true;\n }\n } else {\n if (this._brightness) {\n // set brightness to 0 on power OFF\n await AdapterProvider.setState(this._brightness.setId, 0);\n this._brightness.currentValue = 0;\n }\n if (this._powerState) {\n this._powerState.currentValue = false;\n }\n }\n }\n } else if (property.propertyName === Brightness.propertyName) {\n await AdapterProvider.setState(property.setId, value ?? 0);\n property.currentValue = value;\n } else if (property.propertyName === Color.propertyName) {\n const colorProperty = property as Color;\n const hueValue = value as unknown as { hue: number; saturation: number };\n await AdapterProvider.setState(colorProperty.hal.hue, hueValue.hue);\n if (colorProperty.hal.saturation) {\n await AdapterProvider.setState(colorProperty.hal.saturation, hueValue.saturation);\n }\n\n // do not set brightness\n\n // https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-colorcontroller.html\n // Important: For the best user experience, when you make a color change, maintain the current brightness setting of the endpoint.\n // For example, if a light bulb is currently set to white at 0.5 brightness, and a user requests a color change to red,\n // the SetColor directive specifies hue = 0, saturation = 1, and brightness = 1. Here, set the hue to 0, the saturation to 1,\n // and ignore the brightness value of 1 in the directive. Instead, maintain the current brightness value of 0.5.\n\n property.currentValue = value;\n } else if (property.propertyName === ColorTemperatureInKelvin.propertyName) {\n await AdapterProvider.setState(property.setId, value ?? 2200);\n property.currentValue = value;\n }\n }\n\n async adjustValue(event: AlexaV3Request, property: PropertiesBase): Promise<AlexaV3DirectiveValue> {\n // extract Alexa delta value from event\n const delta = property.alexaDirectiveValue(event);\n\n // convert delta to iobroker value\n const value = property.value(delta);\n\n // set iobroker state\n await this.setState(property, value);\n\n return value as AlexaV3DirectiveValue;\n }\n\n private composeInitObjectPowerState(): ControlStateInitObject {\n const map = this.statesMap;\n return {\n setState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness]!,\n getState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness]!,\n alexaSetter: function (this: PropertiesBase, alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue {\n return alexaValue === PowerState.ON;\n },\n alexaGetter: function (\n this: PropertiesBase,\n value: ioBroker.StateValue | undefined,\n ): AlexaV3DirectiveValue {\n return value ? PowerState.ON : PowerState.OFF;\n },\n };\n }\n\n private composeInitObjectBrightness(): ControlStateInitObject {\n const map = this.statesMap;\n return {\n setState: this.states[map.dimmer] || this.states[map.brightness]!,\n getState: this.states[map.dimmer] || this.states[map.brightness]!,\n alexaSetter: function (this: PropertiesBase, alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue {\n return (\n denormalize_0_100(\n alexaValue as number,\n this.valuesRangeMin as number,\n this.valuesRangeMax as number,\n ) ?? 0\n );\n },\n alexaGetter: function (\n this: PropertiesBase,\n value: ioBroker.StateValue | undefined,\n ): AlexaV3DirectiveValue {\n return normalize_0_100(value as number, this.valuesRangeMin as number, this.valuesRangeMax as number);\n },\n };\n }\n\n private composeInitObjectColor(): ControlStateInitObject {\n const map = this.statesMap;\n return {\n hal: {\n hue: this.states[map.hue]!.id,\n saturation: this.states[map.saturation]?.id,\n brightness: (this.states[map.dimmer] || this.states[map.brightness])?.id,\n },\n };\n }\n\n private composeInitObjectColorTemperature(): ControlStateInitObject {\n const map = this.statesMap;\n\n return {\n setState: this.states[map.temperature]!,\n getState: this.states[map.temperature]!,\n alexaSetter: function (\n this: ColorTemperatureInKelvin,\n alexaValue: AlexaV3DirectiveValue,\n ): ioBroker.StateValue {\n if (alexaValue === 1) {\n // increase directive\n const closest = closestFromList(\n (this.currentValue as number) || this.colorTemperatureTable[0],\n this.colorTemperatureTable,\n );\n let index = this.colorTemperatureTable.indexOf(closest) + 1;\n index = index >= this.colorTemperatureTable.length ? this.colorTemperatureTable.length - 1 : index;\n return this.colorTemperatureTable[index];\n }\n if (alexaValue === -1) {\n // decrease directive\n const closest = closestFromList(\n (this.currentValue as number) || this.colorTemperatureTable[0],\n this.colorTemperatureTable,\n );\n let index = this.colorTemperatureTable.indexOf(closest) - 1;\n index = index < 0 ? 0 : index;\n return this.colorTemperatureTable[index];\n }\n\n return alexaValue as number;\n },\n alexaGetter: function (\n this: PropertiesBase,\n value: ioBroker.StateValue | undefined,\n ): AlexaV3DirectiveValue {\n return value as number;\n },\n };\n }\n}\n"]}
@@ -6,23 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Capabilities_1 = __importDefault(require("../Alexa/Capabilities"));
7
7
  const Control_1 = __importDefault(require("./Control"));
8
8
  class Light extends Control_1.default {
9
+ constructor(detectedControl) {
10
+ super(detectedControl);
11
+ // We support dimmer as enforced capability to allow setting group commands to dim to 0% and to 100%
12
+ // Init enforced capabilities
13
+ const brightnessController = new Capabilities_1.default.BrightnessController(this.brightnessInitObject());
14
+ this._enforced = [brightnessController];
15
+ // Init capabilities
16
+ const powerController = new Capabilities_1.default.PowerController(this.powerStateInitObject());
17
+ this._supported = [powerController];
18
+ }
9
19
  get categories() {
10
20
  return ['LIGHT'];
11
21
  }
12
- initCapabilities() {
13
- const result = [new Capabilities_1.default.PowerController()];
14
- for (const property of result.flatMap(item => item.properties)) {
15
- property.init(this.powerStateInitObject());
16
- }
17
- return result;
18
- }
19
- initEnforcedCapabilities() {
20
- const result = [new Capabilities_1.default.BrightnessController()];
21
- for (const property of result.flatMap(item => item.properties)) {
22
- property.init(this.brightnessInitObject());
23
- }
24
- return result;
25
- }
26
22
  get statesMap() {
27
23
  return {
28
24
  set: 'SET',
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Light.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Light.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AACjD,wDAAgC;AAQhC,MAAqB,KAAM,SAAQ,iBAAO;IACtC,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QAEvB,oGAAoG;QACpG,6BAA6B;QAC7B,MAAM,oBAAoB,GAAG,IAAI,sBAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAChG,IAAI,CAAC,SAAS,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAExC,oBAAoB;QACpB,MAAM,eAAe,GAAG,IAAI,sBAAY,CAAC,eAAe,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,UAAU,GAAG,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED,IAAI,SAAS;QAIT,OAAO;YACH,GAAG,EAAE,KAAK;YACV,MAAM,EAAE,WAAW;SACtB,CAAC;IACN,CAAC;IAEO,oBAAoB;QAMxB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAE3B,OAAO;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAE;YAC/B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAE;YAClC,WAAW,EAAE,UAAU,UAAiC;gBACpD,OAAQ,UAAqB,GAAG,CAAC,CAAC;YACtC,CAAC;YACD,WAAW,EAAE,UAAU,KAAsC;gBACzD,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AA/CD,wBA+CC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport Control from './Control';\nimport type {\n AlexaV3Category,\n AlexaV3DirectiveValue,\n IotExternalDetectorState,\n IotExternalPatternControl,\n} from '../types';\n\nexport default class Light extends Control {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n // We support dimmer as enforced capability to allow setting group commands to dim to 0% and to 100%\n // Init enforced capabilities\n const brightnessController = new Capabilities.BrightnessController(this.brightnessInitObject());\n this._enforced = [brightnessController];\n\n // Init capabilities\n const powerController = new Capabilities.PowerController(this.powerStateInitObject());\n this._supported = [powerController];\n }\n\n get categories(): AlexaV3Category[] {\n return ['LIGHT'];\n }\n\n get statesMap(): {\n set: string;\n actual: string;\n } {\n return {\n set: 'SET',\n actual: 'ON_ACTUAL',\n };\n }\n\n private brightnessInitObject(): {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n } {\n const map = this.statesMap;\n\n return {\n setState: this.states[map.set]!,\n getState: this.states[map.actual]!,\n alexaSetter: function (alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue | undefined {\n return (alexaValue as number) > 0;\n },\n alexaGetter: function (value: ioBroker.StateValue | undefined): AlexaV3DirectiveValue {\n return value ? 100 : 0;\n },\n };\n }\n}\n"]}
@@ -7,16 +7,14 @@ const Capabilities_1 = __importDefault(require("../Alexa/Capabilities"));
7
7
  const Properties_1 = __importDefault(require("../Alexa/Properties"));
8
8
  const Control_1 = __importDefault(require("./Control"));
9
9
  class Lock extends Control_1.default {
10
+ constructor(detectedControl) {
11
+ super(detectedControl);
12
+ const lockController = new Capabilities_1.default.LockController(this.lockStateInitObject());
13
+ this._supported = [lockController];
14
+ }
10
15
  get categories() {
11
16
  return ['SMARTLOCK'];
12
17
  }
13
- initCapabilities() {
14
- const result = [new Capabilities_1.default.LockController()];
15
- for (const property of result.flatMap(item => item.properties)) {
16
- property.init(this.lockStateInitObject());
17
- }
18
- return result;
19
- }
20
18
  lockStateInitObject() {
21
19
  const map = this.statesMap;
22
20
  return {
@@ -26,7 +24,7 @@ class Lock extends Control_1.default {
26
24
  return alexaValue === Properties_1.default.LockState.UNLOCK;
27
25
  },
28
26
  alexaGetter: function (value) {
29
- return value ? Properties_1.default.LockState.UNLOCKED : Properties_1.default.LockState.LOCKED;
27
+ return value ? Properties_1.default.LockState.LOCKED : Properties_1.default.LockState.UNLOCKED;
30
28
  },
31
29
  };
32
30
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Lock.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Lock.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AACjD,qEAA6C;AAC7C,wDAAgC;AAQhC,MAAqB,IAAK,SAAQ,iBAAO;IACrC,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QAEvB,MAAM,cAAc,GAAG,IAAI,sBAAY,CAAC,cAAc,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,UAAU,GAAG,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;IAEO,mBAAmB;QAMvB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAC3B,OAAO;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAE;YAC/B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAE;YAClC,WAAW,EAAE,UAAU,UAAU;gBAC7B,OAAO,UAAU,KAAK,oBAAU,CAAC,SAAS,CAAC,MAAM,CAAC;YACtD,CAAC;YACD,WAAW,EAAE,UAAU,KAAK;gBACxB,OAAO,KAAK,CAAC,CAAC,CAAC,oBAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAU,CAAC,SAAS,CAAC,QAAQ,CAAC;YAC/E,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AA9BD,uBA8BC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport Properties from '../Alexa/Properties';\nimport Control from './Control';\nimport type {\n AlexaV3Category,\n AlexaV3DirectiveValue,\n IotExternalDetectorState,\n IotExternalPatternControl,\n} from '../types';\n\nexport default class Lock extends Control {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n const lockController = new Capabilities.LockController(this.lockStateInitObject());\n this._supported = [lockController];\n }\n\n get categories(): AlexaV3Category[] {\n return ['SMARTLOCK'];\n }\n\n private lockStateInitObject(): {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n } {\n const map = this.statesMap;\n return {\n setState: this.states[map.set]!,\n getState: this.states[map.actual]!,\n alexaSetter: function (alexaValue) {\n return alexaValue === Properties.LockState.UNLOCK;\n },\n alexaGetter: function (value) {\n return value ? Properties.LockState.LOCKED : Properties.LockState.UNLOCKED;\n },\n };\n }\n}\n"]}
@@ -6,8 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const MotionSensor_1 = __importDefault(require("../Alexa/Capabilities/MotionSensor"));
7
7
  const ReadOnlyDetector_1 = __importDefault(require("./ReadOnlyDetector"));
8
8
  class Motion extends ReadOnlyDetector_1.default {
9
+ constructor(detectedControl) {
10
+ super(detectedControl);
11
+ this._supported = [this.capability];
12
+ }
9
13
  get capability() {
10
- return new MotionSensor_1.default();
14
+ return new MotionSensor_1.default(this.detectedStateInitObject());
11
15
  }
12
16
  get categories() {
13
17
  return ['MOTION_SENSOR'];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Motion.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Motion.ts"],"names":[],"mappings":";;;;;AACA,sFAA8D;AAC9D,0EAAkD;AAGlD,MAAqB,MAAO,SAAQ,0BAAgB;IAChD,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,sBAAY,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7B,CAAC;CACJ;AAbD,yBAaC","sourcesContent":["import type { AlexaV3Category, IotExternalPatternControl } from '../types';\nimport MotionSensor from '../Alexa/Capabilities/MotionSensor';\nimport ReadOnlyDetector from './ReadOnlyDetector';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\n\nexport default class Motion extends ReadOnlyDetector {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n this._supported = [this.capability];\n }\n\n get capability(): CapabilitiesBase {\n return new MotionSensor(this.detectedStateInitObject());\n }\n\n get categories(): AlexaV3Category[] {\n return ['MOTION_SENSOR'];\n }\n}\n"]}
@@ -6,16 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const AlexaResponse_1 = __importDefault(require("../Alexa/AlexaResponse"));
7
7
  const Control_1 = __importDefault(require("./Control"));
8
8
  class ReadOnlyDetector extends Control_1.default {
9
- get capability() {
10
- return undefined;
11
- }
12
- initCapabilities() {
13
- const result = [this.capability];
14
- for (const property of result.flatMap(item => item.properties)) {
15
- property.init(this.detectedStateInitObject());
16
- }
17
- return result;
18
- }
19
9
  async handle(event) {
20
10
  this.log.error(`Setting value is not supported by ${this.name} control`);
21
11
  // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadOnlyDetector.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.ts"],"names":[],"mappings":";;;;;AAAA,2EAAmD;AACnD,wDAAgC;AAIhC,MAA8B,gBAAiB,SAAQ,iBAAO;IAG1D,KAAK,CAAC,MAAM,CAAC,KAAqB;QAC9B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,qCAAqC,IAAI,CAAC,IAAI,UAAU,CAAC,CAAC;QAEzE,2EAA2E;QAC3E,OAAO,OAAO,CAAC,MAAM,CACjB,uBAAa,CAAC,8BAA8B,CACxC,IAAI,CAAC,IAAI,EACT,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAChC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAChC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,CACxC,CAAC,GAAG,EAAE,CACV,CAAC;IACN,CAAC;CACJ;AAhBD,mCAgBC","sourcesContent":["import AlexaResponse from '../Alexa/AlexaResponse';\nimport Control from './Control';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\nimport type { AlexaV3Request } from '../types';\n\nexport default abstract class ReadOnlyDetector extends Control {\n abstract get capability(): CapabilitiesBase;\n\n async handle(event: AlexaV3Request): Promise<AlexaResponse> {\n this.log.error(`Setting value is not supported by ${this.name} control`);\n\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n return Promise.reject(\n AlexaResponse.directiveNotSupportedByControl(\n this.name,\n event.directive.header.namespace,\n event.directive.header.messageId,\n event.directive.header.payloadVersion,\n ).get(),\n );\n }\n}\n"]}
@@ -6,16 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const PowerController_1 = __importDefault(require("../Alexa/Capabilities/PowerController"));
7
7
  const Control_1 = __importDefault(require("./Control"));
8
8
  class Socket extends Control_1.default {
9
+ constructor(detectedControl) {
10
+ super(detectedControl);
11
+ const powerController = new PowerController_1.default(this.powerStateInitObject());
12
+ this._supported = [powerController];
13
+ }
9
14
  get categories() {
10
15
  return ['SMARTPLUG'];
11
16
  }
12
- initCapabilities() {
13
- const result = [new PowerController_1.default()];
14
- for (const property of result.flatMap(item => item.properties)) {
15
- property.init(this.powerStateInitObject());
16
- }
17
- return result;
18
- }
19
17
  }
20
18
  exports.default = Socket;
21
19
  //# sourceMappingURL=Socket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Socket.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Socket.ts"],"names":[],"mappings":";;;;;AACA,4FAAoE;AACpE,wDAAgC;AAEhC,MAAqB,MAAO,SAAQ,iBAAO;IACvC,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QAEvB,MAAM,eAAe,GAAG,IAAI,yBAAe,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,UAAU,GAAG,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;CACJ;AAXD,yBAWC","sourcesContent":["import type { AlexaV3Category, IotExternalPatternControl } from '../types';\nimport PowerController from '../Alexa/Capabilities/PowerController';\nimport Control from './Control';\n\nexport default class Socket extends Control {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n const powerController = new PowerController(this.powerStateInitObject());\n this._supported = [powerController];\n }\n\n get categories(): AlexaV3Category[] {\n return ['SMARTPLUG'];\n }\n}\n"]}
@@ -6,16 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const TemperatureSensor_1 = __importDefault(require("../Alexa/Capabilities/TemperatureSensor"));
7
7
  const Control_1 = __importDefault(require("./Control"));
8
8
  class Temperature extends Control_1.default {
9
+ constructor(detectedControl) {
10
+ super(detectedControl);
11
+ const temperatureSensor = new TemperatureSensor_1.default(this.blankInitObject());
12
+ this._supported = [temperatureSensor];
13
+ }
9
14
  get categories() {
10
15
  return ['TEMPERATURE_SENSOR'];
11
16
  }
12
- initCapabilities() {
13
- const result = [new TemperatureSensor_1.default()];
14
- for (const property of result.flatMap(item => item.properties)) {
15
- property.init(this.blankInitObject());
16
- }
17
- return result;
18
- }
19
17
  }
20
18
  exports.default = Temperature;
21
19
  //# sourceMappingURL=Temperature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Temperature.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Temperature.ts"],"names":[],"mappings":";;;;;AACA,gGAAwE;AACxE,wDAAgC;AAEhC,MAAqB,WAAY,SAAQ,iBAAO;IAC5C,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QAEvB,MAAM,iBAAiB,GAAG,IAAI,2BAAiB,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QACxE,IAAI,CAAC,UAAU,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClC,CAAC;CACJ;AAXD,8BAWC","sourcesContent":["import type { AlexaV3Category, IotExternalPatternControl } from '../types';\nimport TemperatureSensor from '../Alexa/Capabilities/TemperatureSensor';\nimport Control from './Control';\n\nexport default class Temperature extends Control {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n const temperatureSensor = new TemperatureSensor(this.blankInitObject());\n this._supported = [temperatureSensor];\n }\n\n get categories(): AlexaV3Category[] {\n return ['TEMPERATURE_SENSOR'];\n }\n}\n"]}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const TemperatureSensor_1 = __importDefault(require("../Alexa/Capabilities/TemperatureSensor"));
7
+ const ThermostatController_1 = __importDefault(require("../Alexa/Capabilities/ThermostatController"));
8
+ const PowerController_1 = __importDefault(require("../Alexa/Capabilities/PowerController"));
9
+ const AdjustableControl_1 = __importDefault(require("./AdjustableControl"));
10
+ const Utils_1 = require("../Helpers/Utils");
11
+ const ThermostatMode_1 = __importDefault(require("../Alexa/Properties/ThermostatMode"));
12
+ const TargetSetpoint_1 = __importDefault(require("../Alexa/Properties/TargetSetpoint"));
13
+ const PowerState_1 = __importDefault(require("../Alexa/Properties/PowerState"));
14
+ class Thermostat extends AdjustableControl_1.default {
15
+ constructor(detectedControl) {
16
+ super(detectedControl);
17
+ this._supported = [
18
+ new TemperatureSensor_1.default(this.composeInitObjectTemperature()),
19
+ new ThermostatController_1.default(this.composeInitObjectThermostatMode(), this.composeInitObjectTargetSetpoint()),
20
+ ];
21
+ const map = this.statesMap;
22
+ // if the state POWER is present, then we can switch it ON/OFF
23
+ if (this.states[map.power]) {
24
+ this._supported.push(new PowerController_1.default(this.composeInitObjectPowerState()));
25
+ }
26
+ }
27
+ get categories() {
28
+ return ['THERMOSTAT', 'TEMPERATURE_SENSOR'];
29
+ }
30
+ adjustableProperties() {
31
+ return [TargetSetpoint_1.default];
32
+ }
33
+ composeInitObjectPowerState() {
34
+ const map = this.statesMap;
35
+ return {
36
+ setState: this.states[map.power] || this.states[map.set],
37
+ getState: this.states[map.power] || this.states[map.set],
38
+ alexaSetter: function (alexaValue) {
39
+ return alexaValue === PowerState_1.default.ON;
40
+ },
41
+ alexaGetter: function (value) {
42
+ return value ? PowerState_1.default.ON : PowerState_1.default.OFF;
43
+ },
44
+ };
45
+ }
46
+ composeInitObjectTemperature() {
47
+ const map = this.statesMap;
48
+ return {
49
+ setState: this.states[map.set],
50
+ getState: this.states[map.actual] || this.states[map.set],
51
+ };
52
+ }
53
+ composeInitObjectTargetSetpoint() {
54
+ const map = this.statesMap;
55
+ return {
56
+ setState: this.states[map.set],
57
+ getState: this.states[map.actual] || this.states[map.set],
58
+ alexaSetter: function (alexaValue) {
59
+ return (0, Utils_1.ensureValueInRange)(alexaValue, this.valuesRangeMin, this.valuesRangeMax);
60
+ },
61
+ alexaGetter: function (value) {
62
+ return value;
63
+ },
64
+ };
65
+ }
66
+ composeInitObjectThermostatMode() {
67
+ const map = this.statesMap;
68
+ return {
69
+ setState: this.states[map.mode] || { id: undefined },
70
+ getState: this.states[map.mode] || { id: undefined },
71
+ alexaSetter: function (_alexaValue) {
72
+ return 0;
73
+ },
74
+ alexaGetter: function (_value) {
75
+ return ThermostatMode_1.default.AUTO;
76
+ },
77
+ supportedModes: [ThermostatMode_1.default.AUTO],
78
+ };
79
+ }
80
+ }
81
+ exports.default = Thermostat;
82
+ //# sourceMappingURL=Thermostat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Thermostat.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Thermostat.ts"],"names":[],"mappings":";;;;;AAMA,gGAAwE;AACxE,sGAA8E;AAC9E,4FAAoE;AACpE,4EAAoD;AACpD,4CAAsD;AACtD,wFAAgE;AAChE,wFAAgE;AAChE,gFAAwD;AAGxD,MAAqB,UAAW,SAAQ,2BAAiB;IACrD,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG;YACd,IAAI,2BAAiB,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC;YAC1D,IAAI,8BAAoB,CAAC,IAAI,CAAC,+BAA+B,EAAE,EAAE,IAAI,CAAC,+BAA+B,EAAE,CAAC;SAC3G,CAAC;QACF,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAE3B,8DAA8D;QAC9D,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,yBAAe,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,CAAC,CAAC;QAClF,CAAC;IACL,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;IAChD,CAAC;IAED,oBAAoB;QAChB,OAAO,CAAC,wBAAc,CAAC,CAAC;IAC5B,CAAC;IAEO,2BAA2B;QAM/B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAE3B,OAAO;YACH,QAAQ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D,OAAO,KAAe,CAAC;YAC3B,CAAC;SACJ,CAAC;IACN,CAAC;IAEO,+BAA+B;QAOnC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAC3B,OAAO;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAK,EAAE,EAAE,EAAE,SAAS,EAA0C;YAC7F,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAK,EAAE,EAAE,EAAE,SAAS,EAA0C;YAC7F,WAAW,EAAE,UAAgC,WAAkC;gBAC3E,OAAO,CAAC,CAAC;YACb,CAAC;YACD,WAAW,EAAE,UAAU,MAAuC;gBAC1D,OAAO,wBAAc,CAAC,IAAI,CAAC;YAC/B,CAAC;YACD,cAAc,EAAE,CAAC,wBAAc,CAAC,IAAI,CAAC;SACxC,CAAC;IACN,CAAC;CACJ;AAnGD,6BAmGC","sourcesContent":["import type {\n AlexaV3Category,\n AlexaV3DirectiveValue,\n IotExternalDetectorState,\n IotExternalPatternControl,\n} from '../types';\nimport TemperatureSensor from '../Alexa/Capabilities/TemperatureSensor';\nimport ThermostatController from '../Alexa/Capabilities/ThermostatController';\nimport PowerController from '../Alexa/Capabilities/PowerController';\nimport AdjustableControl from './AdjustableControl';\nimport { ensureValueInRange } from '../Helpers/Utils';\nimport ThermostatMode from '../Alexa/Properties/ThermostatMode';\nimport TargetSetpoint from '../Alexa/Properties/TargetSetpoint';\nimport PowerState from '../Alexa/Properties/PowerState';\nimport type { Base as PropertiesBase } from '../Alexa/Properties/Base';\n\nexport default class Thermostat extends AdjustableControl {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n this._supported = [\n new TemperatureSensor(this.composeInitObjectTemperature()),\n new ThermostatController(this.composeInitObjectThermostatMode(), this.composeInitObjectTargetSetpoint()),\n ];\n const map = this.statesMap;\n\n // if the state POWER is present, then we can switch it ON/OFF\n if (this.states[map.power]) {\n this._supported.push(new PowerController(this.composeInitObjectPowerState()));\n }\n }\n\n get categories(): AlexaV3Category[] {\n return ['THERMOSTAT', 'TEMPERATURE_SENSOR'];\n }\n\n adjustableProperties(): (typeof PropertiesBase)[] {\n return [TargetSetpoint];\n }\n\n private composeInitObjectPowerState(): {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n } {\n const map = this.statesMap;\n\n return {\n setState: this.states[map.power] || this.states[map.set]!,\n getState: this.states[map.power] || this.states[map.set]!,\n alexaSetter: function (this: PropertiesBase, alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue {\n return alexaValue === PowerState.ON;\n },\n alexaGetter: function (value) {\n return value ? PowerState.ON : PowerState.OFF;\n },\n };\n }\n\n private composeInitObjectTemperature(): {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n } {\n const map = this.statesMap;\n return {\n setState: this.states[map.set]!,\n getState: this.states[map.actual] || this.states[map.set]!,\n };\n }\n\n private composeInitObjectTargetSetpoint(): {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n } {\n const map = this.statesMap;\n return {\n setState: this.states[map.set]!,\n getState: this.states[map.actual] || this.states[map.set]!,\n alexaSetter: function (this: PropertiesBase, alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue {\n return ensureValueInRange(\n alexaValue as number,\n this.valuesRangeMin as number,\n this.valuesRangeMax as number,\n );\n },\n alexaGetter: function (value: ioBroker.StateValue | undefined): AlexaV3DirectiveValue {\n return value as number;\n },\n };\n }\n\n private composeInitObjectThermostatMode(): {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n supportedModes?: string[];\n } {\n const map = this.statesMap;\n return {\n setState: this.states[map.mode] || ({ id: undefined } as unknown as IotExternalDetectorState),\n getState: this.states[map.mode] || ({ id: undefined } as unknown as IotExternalDetectorState),\n alexaSetter: function (this: PropertiesBase, _alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue {\n return 0;\n },\n alexaGetter: function (_value: ioBroker.StateValue | undefined): AlexaV3DirectiveValue {\n return ThermostatMode.AUTO;\n },\n supportedModes: [ThermostatMode.AUTO],\n };\n }\n}\n"]}
@@ -6,16 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Capabilities_1 = __importDefault(require("../Alexa/Capabilities"));
7
7
  const Control_1 = __importDefault(require("./Control"));
8
8
  class VacuumCleaner extends Control_1.default {
9
+ constructor(detectedControl) {
10
+ super(detectedControl);
11
+ const powerController = new Capabilities_1.default.PowerController(this.powerStateInitObject());
12
+ this._supported = [powerController];
13
+ }
9
14
  get categories() {
10
15
  return ['VACUUM_CLEANER'];
11
16
  }
12
- initCapabilities() {
13
- const result = [new Capabilities_1.default.PowerController()];
14
- for (const property of result.flatMap(item => item.properties)) {
15
- property.init(this.powerStateInitObject());
16
- }
17
- return result;
18
- }
19
17
  get statesMap() {
20
18
  return {
21
19
  set: 'POWER',
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VacuumCleaner.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.ts"],"names":[],"mappings":";;;;;AACA,yEAAiD;AACjD,wDAAgC;AAEhC,MAAqB,aAAc,SAAQ,iBAAO;IAC9C,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QAEvB,MAAM,eAAe,GAAG,IAAI,sBAAY,CAAC,eAAe,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,UAAU,GAAG,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,SAAS;QAIT,OAAO;YACH,GAAG,EAAE,OAAO;YACZ,MAAM,EAAE,SAAS;SACpB,CAAC;IACN,CAAC;CACJ;AArBD,gCAqBC","sourcesContent":["import type { AlexaV3Category, IotExternalPatternControl } from '../types';\nimport Capabilities from '../Alexa/Capabilities';\nimport Control from './Control';\n\nexport default class VacuumCleaner extends Control {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n const powerController = new Capabilities.PowerController(this.powerStateInitObject());\n this._supported = [powerController];\n }\n\n get categories(): AlexaV3Category[] {\n return ['VACUUM_CLEANER'];\n }\n\n get statesMap(): {\n set: string;\n actual?: string;\n } {\n return {\n set: 'POWER',\n actual: undefined,\n };\n }\n}\n"]}