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
@@ -1 +0,0 @@
1
- const y="modulepreload",w=function(f,a){return new URL(f,a).href},E={},g=function(a,u,d){let h=Promise.resolve();if(u&&u.length>0){let s=function(e){return Promise.all(e.map(r=>Promise.resolve(r).then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",reason:l}))))};const t=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),v=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));h=s(u.map(e=>{if(e=w(e,d),e in E)return;E[e]=!0;const r=e.endsWith(".css"),l=r?'[rel="stylesheet"]':"";if(!!d)for(let i=t.length-1;i>=0;i--){const c=t[i];if(c.href===e&&(!r||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${e}"]${l}`))return;const n=document.createElement("link");if(n.rel=r?"stylesheet":y,r||(n.as="script"),n.crossOrigin="",n.href=e,v&&n.setAttribute("nonce",v),document.head.appendChild(n),r)return new Promise((i,c)=>{n.addEventListener("load",i),n.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${e}`)))})}))}function m(s){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=s,window.dispatchEvent(t),!t.defaultPrevented)throw s}return h.then(s=>{for(const t of s||[])t.status==="rejected"&&m(t.reason);return a().catch(m)})};export{g as _};
@@ -1 +0,0 @@
1
- {"version":3,"file":"AlexaResponse.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAoC;AACpC,wDAA0C;AAc1C;;GAEG;AACH,MAAqB,aAAa;IACvB,OAAO,CAEZ;IAEK,UAAU,GAAG,GAAG,CAAC;IAER,KAAK,CAAoB;IAEzC,MAAM,CAAC,iBAAiB,GAAyB,eAAe,CAAC;IAEjE,MAAM,CAAC,eAAe,CAAC,QAAuB;QAC1C,OAAO,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,K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AAI,CAAC,QAAQ,EAAE,SAAS,CAAC;YAC9D,aAAa,EAAE,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC;YACxE,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;YAChE,mBAAmB,EAAE,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC;SACvF,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACrB,OAAO,QAAQ,CAAC,QAAQ,CAAC;QAC7B,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;YAC1B,OAAO,QAAQ,CAAC,aAAa,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,QAAQ,CAAC,SAAS,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,mBAAmB,EAAE,CAAC;YAChC,OAAO,QAAQ,CAAC,mBAAmB,CAAC;QACxC,CAAC;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,GAAG;QACC,OAAO,IAAI,CAAC;IAChB,CAAC;;AAvTL,gCAwTC","sourcesContent":["import { v4 as uuidv4 } from 'uuid';\nimport * as Utils from '../Helpers/Utils';\nimport type {\n AlexaV3Capability,\n AlexaV3ContextProperty,\n AlexaV3Directive,\n AlexaV3DirectiveType,\n AlexaV3DiscoverAppliance,\n AlexaV3EndpointID,\n AlexaV3Namespace,\n AlexaV3Payload,\n AlexaV3ReportedState,\n AlexaV3Request,\n} from '../types';\n\n/**\n * Helper class to generate an AlexaResponse.\n */\nexport default class AlexaResponse {\n public context?: {\n properties: AlexaV3ReportedState[];\n };\n\n public iobVersion = '1';\n\n public readonly event?: AlexaV3Directive;\n\n static ErrorResponseName: AlexaV3DirectiveType = 'ErrorResponse';\n\n static isErrorResponse(response: AlexaResponse): boolean {\n return response?.event?.header?.name === AlexaResponse.ErrorResponseName;\n }\n\n static errorResponse(messageId: string, payload: any): AlexaResponse {\n return new AlexaResponse({\n name: AlexaResponse.ErrorResponseName,\n payload,\n messageId,\n });\n }\n\n static endpointUnreachable(messageId: string): AlexaResponse {\n return AlexaResponse.errorResponse(messageId, {\n type: 'ENDPOINT_UNREACHABLE',\n message: 'Unable to reach endpoint.',\n });\n }\n\n static directiveNotSupportedByControl(\n controlName: string,\n namespace: AlexaV3Namespace,\n messageId: string,\n payloadVersion: string,\n ): AlexaResponse {\n return AlexaResponse.errorResponse(messageId, {\n type: 'INTERNAL_ERROR',\n message: `Control ${controlName} doesn't support the ${namespace} with payloadVersion ${payloadVersion}`,\n });\n }\n\n static directiveNotSupportedByDevice(\n deviceName: string,\n namespace: AlexaV3Namespace,\n messageId: string,\n payloadVersion: string,\n ): AlexaResponse {\n return AlexaResponse.errorResponse(messageId, {\n type: 'INTERNAL_ERROR',\n message: `Device ${deviceName} doesn't support the ${namespace} with payloadVersion ${payloadVersion}`,\n });\n }\n\n static nonExistingEndpoint(messageId: string, endpointId: AlexaV3EndpointID | undefined): AlexaResponse {\n return AlexaResponse.errorResponse(messageId, {\n type: 'INTERNAL_ERROR',\n message: `No endpoint with id ${endpointId} found`,\n });\n }\n\n /**\n * Composes Alexa respond on a successfully processed Alexa directive to change the capability's value of a device\n */\n static handled(event: AlexaV3Request, propertyName: string, value: any, propertyInstance?: string): AlexaResponse {\n const response = new AlexaResponse({\n correlationToken: event?.directive?.header?.correlationToken,\n token: event?.directive?.endpoint?.scope?.token,\n endpointId: event?.directive?.endpoint?.endpointId,\n messageId: event?.directive?.header?.messageId,\n });\n\n response.addContextProperty({\n namespace: event?.directive?.header?.namespace,\n name: propertyName,\n instance: propertyInstance,\n value,\n });\n\n return response;\n }\n\n /**\n * Constructor for an Alexa Response.\n *\n * @param opts Contains initialization options for the response\n */\n constructor(opts?: {\n context?: {\n properties: AlexaV3ReportedState[];\n };\n namespace?: AlexaV3Namespace;\n name?: AlexaV3DirectiveType;\n messageId?: string;\n correlationToken?: string;\n payloadVersion?: '3';\n token?: string;\n endpointId?: string;\n payload?: AlexaV3Payload;\n changeCauseType?: 'APP_INTERACTION' | 'PHYSICAL_INTERACTION' | 'VOICE_INTERACTION';\n event?: AlexaV3Directive;\n }) {\n opts ||= {};\n\n if (opts.context !== undefined) {\n this.context = Utils.defaultIfNullOrEmpty(opts.context, undefined);\n }\n\n if (opts.event !== undefined) {\n this.event = Utils.defaultIfNullOrEmpty(opts.event, undefined);\n } else {\n this.event = {\n header: {\n namespace: Utils.defaultIfNullOrEmpty<AlexaV3Namespace>(opts.namespace, 'Alexa'),\n name: Utils.defaultIfNullOrEmpty<AlexaV3DirectiveType>(opts.name, 'Response'),\n messageId: Utils.defaultIfNullOrEmpty(opts.messageId, uuidv4()),\n correlationToken: Utils.defaultIfNullOrEmpty(opts.correlationToken, undefined),\n payloadVersion: Utils.defaultIfNullOrEmpty<'3'>(opts.payloadVersion, '3'),\n },\n endpoint: {\n scope: {\n type: 'BearerToken',\n token: Utils.defaultIfNullOrEmpty(opts.token, 'INVALID'),\n },\n endpointId: Utils.defaultIfNullOrEmpty(opts.endpointId, 'INVALID'),\n },\n payload: Utils.defaultIfNullOrEmpty(opts.payload, {}),\n };\n\n if (opts.changeCauseType) {\n this.event.payload.change = {\n cause: {\n type: opts.changeCauseType,\n },\n properties: [],\n };\n }\n }\n\n if (!this.event) {\n throw new Error('Event is not defined');\n }\n\n // No endpoint in an AcceptGrant or Discover request\n if (this.event.header.name === 'AcceptGrant.Response' || this.event.header.name === 'Discover.Response') {\n delete this.event.endpoint;\n }\n }\n\n addContext(): void {\n this.context ||= { properties: [] };\n }\n\n /**\n * Add a property to the context.\n *\n * @param opts Contains options for the property.\n */\n addContextProperty(opts: {\n namespace?: AlexaV3Namespace;\n instance?: string;\n name?: string;\n value?: any;\n timeOfSample?: string;\n uncertaintyInMilliseconds?: number;\n }): void {\n this.addContext();\n\n const property = {\n namespace: Utils.defaultIfNullOrEmpty(opts.namespace, 'Alexa.EndpointHealth'),\n instance: Utils.defaultIfNullOrEmpty(opts.instance, undefined),\n name: Utils.defaultIfNullOrEmpty(opts.name, 'connectivity'),\n value: Utils.defaultIfNullOrEmpty(opts.value, { value: 'OK' }),\n timeOfSample: Utils.defaultIfNullOrEmpty(opts.timeOfSample, new Date().toISOString()),\n uncertaintyInMilliseconds: Utils.defaultIfNullOrEmpty(opts.uncertaintyInMilliseconds, 0),\n };\n\n if (!property.instance) {\n delete property.instance;\n }\n\n this.context!.properties.push(property);\n }\n\n /**\n * Add a property to the payload.\n *\n * @param opts Contains options for the property.\n */\n addPayloadChangeProperty(opts: AlexaV3ContextProperty): void {\n opts ||= {} as AlexaV3ContextProperty;\n\n const property = {\n namespace: Utils.defaultIfNullOrEmpty(opts.namespace, 'Alexa.EndpointHealth'),\n instance: Utils.defaultIfNullOrEmpty(opts.instance, undefined),\n name: Utils.defaultIfNullOrEmpty(opts.name, 'connectivity'),\n value: Utils.defaultIfNullOrEmpty(opts.value, { value: 'OK' }),\n timeOfSample: Utils.defaultIfNullOrEmpty(opts.timeOfSample, new Date().toISOString()),\n uncertaintyInMilliseconds: Utils.defaultIfNullOrEmpty(opts.uncertaintyInMilliseconds, 0),\n };\n\n if (!property.instance) {\n delete property.instance;\n }\n\n if (!this.event) {\n throw new Error('Event is not defined');\n }\n this.event.payload.change ||= { properties: [], cause: { type: 'APP_INTERACTION' } };\n\n this.event.payload.change.properties.push(property);\n }\n\n static alexaCapability(): AlexaV3Capability[] {\n return [\n {\n type: 'AlexaInterface',\n interface: 'Alexa',\n version: '3',\n },\n ];\n }\n\n /**\n * Adds an endpoint to the payload.\n *\n * @param opts Contains options for the endpoint.\n */\n addPayloadEndpoint(opts: AlexaV3DiscoverAppliance): void {\n if (!this.event) {\n throw new Error('Event is not defined');\n }\n\n this.event.payload.endpoints ||= [];\n\n opts ||= {} as AlexaV3DiscoverAppliance;\n\n // construct the proper structure expected for the endpoint\n const endpoint: AlexaV3DiscoverAppliance = {\n endpointId: Utils.defaultIfNullOrEmpty(opts.endpointId, 'dummy-endpoint-001'),\n manufacturerName: Utils.defaultIfNullOrEmpty(opts.manufacturerName, 'ioBroker Group'),\n description: Utils.defaultIfNullOrEmpty(opts.description, 'Device controlled by ioBroker'),\n friendlyName: Utils.defaultIfNullOrEmpty(opts.friendlyName, 'ioBroker Stub Endpoint'),\n displayCategories: Utils.defaultIfNullOrEmpty(opts.displayCategories, ['OTHER']),\n capabilities: AlexaResponse.alexaCapability().concat(\n Utils.defaultIfNullOrEmpty<AlexaV3Capability[]>(opts.capabilities, []),\n ),\n cookie: undefined,\n };\n\n if (Object.prototype.hasOwnProperty.call(opts, 'cookie')) {\n endpoint.cookie = Utils.defaultIfNullOrEmpty<Record<string, string>>(opts.cookie, {});\n }\n\n this.event.payload.endpoints.push(endpoint);\n }\n\n /**\n * Creates a capability for an endpoint within the payload.\n *\n * @param opts Contains options for the endpoint capability.\n */\n asEndpointCapability(opts?: AlexaV3Capability): AlexaV3Capability {\n opts ||= {} as AlexaV3Capability;\n\n const response = {\n type: Utils.defaultIfNullOrEmpty(opts.type, 'AlexaInterface'),\n interface: Utils.defaultIfNullOrEmpty(opts.interface, 'Alexa'),\n version: Utils.defaultIfNullOrEmpty(opts.version, '3'),\n properties: Utils.defaultIfNullOrEmpty<{\n supported: { name: string }[];\n proactivelyReported?: boolean;\n retrievable?: boolean;\n nonControllable?: boolean;\n }>(\n opts.properties,\n {} as {\n supported: { name: string }[];\n proactivelyReported?: boolean;\n retrievable?: boolean;\n nonControllable?: boolean;\n },\n ),\n // not all capabilities have the following ones\n instance: Utils.defaultIfNullOrEmpty(opts.instance, undefined),\n configuration: Utils.defaultIfNullOrEmpty(opts.configuration, undefined),\n semantics: Utils.defaultIfNullOrEmpty(opts.semantics, undefined),\n capabilityResources: Utils.defaultIfNullOrEmpty(opts.capabilityResources, undefined),\n };\n\n if (!response.instance) {\n delete response.instance;\n }\n if (!response.configuration) {\n delete response.configuration;\n }\n if (!response.semantics) {\n delete response.semantics;\n }\n if (!response.capabilityResources) {\n delete response.capabilityResources;\n }\n\n return response;\n }\n\n /**\n * Get the composed Alexa Response.\n */\n get(): AlexaResponse {\n return this;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.ts"],"names":[],"mappings":";;;AAAA,+CAAgD;AAIhD,MAAa,IAAI;IACG,WAAW,CAAmB;IAE9C;QACI,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IAC7C,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC;IAED,IAAI,SAAS;QACT,OAAO,SAAS,IAAI,CAAC,WAAW,CAAC,IAAI,EAAsB,CAAC;IAChE,CAAC;IAED,WAAW,CAAC,KAAuB;QAC/B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,cAAc;QACV,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,KAAqB;QACzB,OAAO,CACH,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC,SAAS;YACtD,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC,OAAO,CAC5D,CAAC;IACN,CAAC;IAED,MAAM,KAAK,SAAS;QAChB,OAAO,SAAS,IAAA,iBAAS,EAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAsB,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,KAAqB;QAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC,SAAS,CAAC;IAClE,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC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C,OAAO,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC;IAChD,CAAC;CACJ;AA9HD,oBA8HC;AAED,kBAAe,IAAI,CAAC","sourcesContent":["import { className } from '../../Helpers/Utils';\nimport type { AlexaV3Capability, AlexaV3EndpointID, AlexaV3Namespace, AlexaV3Request } from '../../types';\nimport type { Base as PropertiesBase } from '../Properties/Base';\n\nexport class Base {\n public readonly _properties: PropertiesBase[];\n\n constructor() {\n this._properties = this.initProperties();\n }\n\n get name(): string {\n return `${this.constructor.name}`;\n }\n\n get namespace(): AlexaV3Namespace {\n return `Alexa.${this.constructor.name}` as AlexaV3Namespace;\n }\n\n reportValue(value: number | boolean): any {\n return value;\n }\n\n initProperties(): PropertiesBase[] {\n return [];\n }\n\n /**\n * Checks whether the capability instance matches, i.e. can handle the event Alexa sends to the skill\n *\n * @param event Contains the Alexa event.\n */\n matches(event: AlexaV3Request): boolean {\n return (\n event?.directive?.header?.namespace === this.namespace &&\n event?.directive?.header?.payloadVersion === this.version\n );\n }\n\n static get namespace(): AlexaV3Namespace {\n return `Alexa.${className(this.toString())}` as AlexaV3Namespace;\n }\n\n /**\n * Checks whether the capability object matches, i.e., can handle the event Alexa sends to the skill\n *\n * @param event Contains the Alexa event.\n */\n static matches(event: AlexaV3Request): boolean {\n return event?.directive?.header?.namespace === this.namespace;\n }\n\n get properties(): PropertiesBase[] {\n return this._properties;\n }\n\n /**\n *\n * @param event Contains the Alexa event.\n * @returns Property to handle on Alexa directive\n */\n property(event: AlexaV3Request): PropertiesBase | undefined {\n return this.properties.find(p => p.matches(event));\n }\n\n /**\n * Returns object containing all the properties of the smart device capability as it expected by Alexa during discovery\n */\n get discoverableProperties(): {\n supported: { name: string }[];\n proactivelyReported: boolean;\n retrievable: boolean;\n } {\n return {\n supported: this.properties.map(p => {\n return { name: p.propertyName };\n }),\n proactivelyReported: this.proactivelyReported,\n retrievable: this.retrievable,\n };\n }\n\n /**\n * Returns whether the smart device proactively reports state changes\n */\n get proactivelyReported(): boolean {\n return true;\n }\n\n /**\n * Returns whether the smart device handles Alexa ReportState directives\n */\n get retrievable(): boolean {\n return true;\n }\n\n get version(): string {\n return '3';\n }\n\n /**\n * Returns response to Alexa Discovery directive\n */\n get alexaResponse(): AlexaV3Capability {\n return {\n interface: this.namespace,\n version: this.version,\n properties: this.discoverableProperties,\n };\n }\n\n propertyName(event: AlexaV3Request): string | undefined {\n return this.property(event)?.propertyName;\n }\n\n /**\n * Extracts value to be set on the smart device sent in an Alexa directive\n */\n alexaValue(event: AlexaV3Request): number | boolean | undefined {\n throw new Error(`Method alexaValue is not implemented in ${this.name} capability`);\n // @ts-expect-error fix later!!!!\n return this.property(event)?.alexaValue(event);\n }\n\n /**\n * Extracts endpoint id sent in an Alexa directive\n */\n static endpointId(event: AlexaV3Request): AlexaV3EndpointID | undefined {\n return event.directive.endpoint?.endpointId;\n }\n}\n\nexport default Base;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BrightnessController.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,0EAAkD;AAElD,MAAqB,oBAAqB,SAAQ,cAAI;IAC1C,WAAW,CAAyB;IAE5C,cAAc;QACV,IAAI,CAAC,WAAW,GAAG,IAAI,oBAAU,EAAE,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAY,CAAC;IAC7B,CAAC;CACJ;AAXD,uCAWC","sourcesContent":["import Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\nimport Brightness from '../Properties/Brightness';\n\nexport default class BrightnessController extends Base {\n private _brightness: Brightness | undefined;\n\n initProperties(): PropertiesBase[] {\n this._brightness = new Brightness();\n return [this._brightness];\n }\n\n get brightness(): PropertiesBase {\n return this._brightness!;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ColorController.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.ts"],"names":[],"mappings":";;;;;AAAA,+DAAuC;AACvC,kDAA0B;AAG1B,MAAqB,eAAgB,SAAQ,cAAI;IAC7C,cAAc;QACV,OAAO,CAAC,IAAI,oBAAU,CAAC,KAAK,EAAE,CAAC,CAAC;IACpC,CAAC;CACJ;AAJD,kCAIC","sourcesContent":["import Properties from '../Properties';\nimport Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\n\nexport default class ColorController extends Base {\n initProperties(): PropertiesBase[] {\n return [new Properties.Color()];\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ColorTemperatureController.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,sGAA8E;AAE9E,MAAqB,0BAA2B,SAAQ,cAAI;IAChD,yBAAyB,CAAuC;IAExE,cAAc;QACV,IAAI,CAAC,yBAAyB,GAAG,IAAI,kCAAwB,EAAE,CAAC;QAChE,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,wBAAwB;QACxB,OAAO,IAAI,CAAC,yBAA0B,CAAC;IAC3C,CAAC;CACJ;AAXD,6CAWC","sourcesContent":["import Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\nimport ColorTemperatureInKelvin from '../Properties/ColorTemperatureInKelvin';\n\nexport default class ColorTemperatureController extends Base {\n private _colorTemperatureInKelvin: ColorTemperatureInKelvin | undefined;\n\n initProperties(): PropertiesBase[] {\n this._colorTemperatureInKelvin = new ColorTemperatureInKelvin();\n return [this._colorTemperatureInKelvin];\n }\n\n get colorTemperatureInKelvin(): PropertiesBase {\n return this._colorTemperatureInKelvin!;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContactSensor.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+DAAuC;AAGvC,MAAa,aAAc,SAAQ,cAAI;IACnC,cAAc;QACV,OAAO,CAAC,IAAI,oBAAU,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7C,CAAC;CACJ;AAJD,sCAIC;AAED,kBAAe,aAAa,CAAC","sourcesContent":["import Base from './Base';\nimport Properties from '../Properties';\nimport type { Base as PropertiesBase } from '../Properties/Base';\n\nexport class ContactSensor extends Base {\n initProperties(): PropertiesBase[] {\n return [new Properties.DetectionState()];\n }\n}\n\nexport default ContactSensor;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LockController.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.ts"],"names":[],"mappings":";;;;;AAAA,+DAAuC;AACvC,kDAA0B;AAG1B,MAAqB,cAAe,SAAQ,cAAI;IAC5C,cAAc;QACV,OAAO,CAAC,IAAI,oBAAU,CAAC,SAAS,EAAE,CAAC,CAAC;IACxC,CAAC;CACJ;AAJD,iCAIC","sourcesContent":["import Properties from '../Properties';\nimport Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\n\nexport default class LockController extends Base {\n initProperties(): PropertiesBase[] {\n return [new Properties.LockState()];\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModeController.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,8DAAsC;AAStC,MAAqB,cAAe,SAAQ,cAAI;IACpC,SAAS,CAAmB;IAEpC,cAAc;QACV,IAAI,CAAC,SAAS,GAAG,IAAI,cAAI,EAAE,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAED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AC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC;YACnF,aAAa,EAAE,IAAI,CAAC,SAAU,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC;SACpF,CAAC;IACN,CAAC;CACJ;AA/ED,iCA+EC","sourcesContent":["import Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\nimport Mode from '../Properties/Mode';\nimport type {\n AlexaV3ActionMapping,\n AlexaV3Capability,\n AlexaV3DiscoveryResponse,\n AlexaV3FriendlyName,\n AlexaV3StateMapping,\n} from '../../types';\n\nexport default class ModeController extends Base {\n private _property: Mode | undefined;\n\n initProperties(): PropertiesBase[] {\n this._property = new Mode();\n return [this._property];\n }\n\n /**\n * Returns response to Alexa Discovery directive\n */\n get alexaResponse(): AlexaV3Capability {\n return {\n interface: this.namespace,\n instance: this.instance,\n version: this.version,\n properties: this.discoverableProperties,\n configuration: this.configurationAsDiscoveryResponse,\n semantics: this.semanticsAsDiscoveryResponse,\n capabilityResources: this.capabilityResourcesAsDiscoveryResponse,\n };\n }\n\n get discoverableProperties(): {\n supported: { name: string }[];\n proactivelyReported: boolean;\n retrievable: boolean;\n nonControllable: false;\n } {\n return {\n supported: this.properties.map(p => {\n return { name: p.propertyName };\n }),\n proactivelyReported: this.proactivelyReported,\n retrievable: this.retrievable,\n nonControllable: false,\n };\n }\n\n get capabilityResourcesAsDiscoveryResponse(): {\n friendlyNames: AlexaV3FriendlyName[];\n } {\n return { friendlyNames: this.friendlyNames };\n }\n\n get friendlyNames(): AlexaV3FriendlyName[] {\n return [\n {\n '@type': 'asset',\n value: {\n assetId: 'Alexa.Setting.Mode',\n },\n },\n ];\n }\n\n get instance(): string {\n return `${this._property!.instance}`;\n }\n\n get configurationAsDiscoveryResponse(): {\n ordered: boolean;\n supportedModes: AlexaV3DiscoveryResponse[];\n } {\n return {\n ordered: false,\n supportedModes: this._property!.supportedModes.flatMap(mode => mode.discoveryResponse),\n };\n }\n\n get semanticsAsDiscoveryResponse(): {\n actionMappings: AlexaV3ActionMapping[];\n stateMappings: AlexaV3StateMapping[];\n } {\n return {\n actionMappings: this._property!.supportedModes.flatMap(mode => mode.actionMappings),\n stateMappings: this._property!.supportedModes.flatMap(mode => mode.stateMappings),\n };\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MotionSensor.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.ts"],"names":[],"mappings":";;;;;AAAA,+DAAuC;AACvC,kDAA0B;AAG1B,MAAqB,YAAa,SAAQ,cAAI;IAC1C,cAAc;QACV,OAAO,CAAC,IAAI,oBAAU,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7C,CAAC;CACJ;AAJD,+BAIC","sourcesContent":["import Properties from '../Properties';\nimport Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\n\nexport default class MotionSensor extends Base {\n initProperties(): PropertiesBase[] {\n return [new Properties.DetectionState()];\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PercentageController.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.ts"],"names":[],"mappings":";;;;;AAAA,+DAAuC;AACvC,kDAA0B;AAG1B,MAAqB,oBAAqB,SAAQ,cAAI;IAClD,cAAc;QACV,OAAO,CAAC,IAAI,oBAAU,CAAC,UAAU,EAAE,CAAC,CAAC;IACzC,CAAC;CACJ;AAJD,uCAIC","sourcesContent":["import Properties from '../Properties';\nimport Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\n\nexport default class PercentageController extends Base {\n initProperties(): PropertiesBase[] {\n return [new Properties.Percentage()];\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PowerController.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.ts"],"names":[],"mappings":";;;;;AAAA,0EAAkD;AAClD,kDAA0B;AAG1B,MAAqB,eAAgB,SAAQ,cAAI;IACrC,WAAW,CAAyB;IAE5C,cAAc;QACV,IAAI,CAAC,WAAW,GAAG,IAAI,oBAAU,EAAE,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAY,CAAC;IAC7B,CAAC;CACJ;AAXD,kCAWC","sourcesContent":["import PowerState from '../Properties/PowerState';\nimport Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\n\nexport default class PowerController extends Base {\n private _powerState: PowerState | undefined;\n\n initProperties(): PropertiesBase[] {\n this._powerState = new PowerState();\n return [this._powerState];\n }\n\n get powerState(): PropertiesBase {\n return this._powerState!;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Speaker.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.ts"],"names":[],"mappings":";;;;;AAAA,kEAA0C;AAC1C,gEAAwC;AACxC,kDAA0B;AAG1B,MAAqB,OAAQ,SAAQ,cAAI;IAC7B,OAAO,CAAqB;IAC5B,MAAM,CAAoB;IAElC,cAAc;QACV,IAAI,CAAC,OAAO,GAAG,IAAI,gBAAM,EAAE,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,IAAI,eAAK,EAAE,CAAC;QAC1B,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAQ,CAAC;IACzB,CAAC;IAED,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,MAAO,CAAC;IACxB,CAAC;CACJ;AAjBD,0BAiBC","sourcesContent":["import Volume from '../Properties/Volume';\nimport Muted from '../Properties/Muted';\nimport Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\n\nexport default class Speaker extends Base {\n private _volume: Volume | undefined;\n private _muted: Muted | undefined;\n\n initProperties(): PropertiesBase[] {\n this._volume = new Volume();\n this._muted = new Muted();\n return [this._volume, this._muted];\n }\n\n get volume(): Volume {\n return this._volume!;\n }\n\n get muted(): Muted {\n return this._muted!;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"TemperatureSensor.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.ts"],"names":[],"mappings":";;;;;AAAA,+DAAuC;AACvC,kDAA0B;AAG1B,MAAqB,iBAAkB,SAAQ,cAAI;IAC/C,cAAc;QACV,OAAO,CAAC,IAAI,oBAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IAC1C,CAAC;CACJ;AAJD,oCAIC","sourcesContent":["import Properties from '../Properties';\nimport Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\n\nexport default class TemperatureSensor extends Base {\n initProperties(): PropertiesBase[] {\n return [new Properties.Temperature()];\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThermostatController.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.ts"],"names":[],"mappings":";;;;;AAAA,kFAA0D;AAC1D,kFAA0D;AAC1D,kDAA0B;AAI1B,MAAqB,oBAAqB,SAAQ,cAAI;IAC1C,eAAe,CAA6B;IAEpD,IAAI,OAAO;QACP,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,cAAc;QACV,IAAI,CAAC,eAAe,GAAG,IAAI,wBAAc,EAAE,CAAC;QAC5C,OAAO,CAAC,IAAI,wBAAc,EAAE,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,eAAgB,CAAC;IACjC,CAAC;IAED,IAAI,aAAa;QAsBb,OAAO;YACH,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,sBAAsB;YACvC,aAAa,EAAE,IAAI,CAAC,aAAa;SACpC,CAAC;IACN,CAAC;IAED,IAAI,aAAa;QAKb,OAAO;YACH,OAAO,EAAE,KAAK;YACd,cAAc,EAAE,IAAI,CAAC,eAAgB,CAAC,cAAc;SACvD,CAAC;IACN,CAAC;CACJ;AAxDD,uCAwDC","sourcesContent":["import ThermostatMode from '../Properties/ThermostatMode';\nimport TargetSetpoint from '../Properties/TargetSetpoint';\nimport Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\nimport type { AlexaV3ActionMapping, AlexaV3FriendlyName, AlexaV3Namespace, AlexaV3StateMapping } from '../../types';\n\nexport default class ThermostatController extends Base {\n private _thermostatMode: ThermostatMode | undefined;\n\n get version(): string {\n return '3.2';\n }\n\n initProperties(): PropertiesBase[] {\n this._thermostatMode = new ThermostatMode();\n return [new TargetSetpoint(), this._thermostatMode];\n }\n\n get thermostatMode(): ThermostatMode {\n return this._thermostatMode!;\n }\n\n get alexaResponse(): {\n interface: AlexaV3Namespace;\n version: string;\n instance?: string;\n properties: {\n supported: { name: string }[];\n proactivelyReported: boolean;\n retrievable: boolean;\n };\n configuration?: {\n ordered: boolean;\n supportedModes: any[];\n supportsScheduling?: boolean;\n };\n semantics?: {\n actionMappings: AlexaV3ActionMapping[];\n stateMappings: AlexaV3StateMapping[];\n };\n capabilityResources?: {\n friendlyNames: AlexaV3FriendlyName[];\n };\n } {\n return {\n interface: this.namespace,\n version: this.version,\n properties: this.discoverableProperties,\n configuration: this.configuration,\n };\n }\n\n get configuration(): {\n ordered: boolean;\n supportedModes: string[];\n supportsScheduling?: boolean;\n } {\n return {\n ordered: false,\n supportedModes: this._thermostatMode!.supportedModes,\n };\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Properties/Base.ts"],"names":[],"mappings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AAC,IAAI,CAAC,QAAQ,EAAE,CAAC,YAAY,CAAC;IACnG,CAAC;IAED,OAAO,CAAC,KAAqB;QACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,KAAK,IAAI,CAAC,YAAY,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,KAAqB;QACrC,IAAI,IAAI,CAAC,YAAY,KAAK,OAAO,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC;QACzC,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,KAAK,0BAA0B,EAAE,CAAC;YACnD,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,wBAAwB,CAAC;QAC5D,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,KAAK,YAAY,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC;QAC9C,CAAC;QACD,6BAA6B;QAC7B,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACtD,CAAC;IAED,WAAW,CAAC,KAA4B;QACpC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,KAAK,MAAM;QACb,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,MAAM,KAAK,GAAG;QACV,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,KAAK,aAAa;QACpB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,IAAI,oBAAoB;QACpB,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACtC,CAAC;CACJ;AA5ID,oBA4IC;AAED,kBAAe,IAAI,CAAC","sourcesContent":["import { configuredRangeOrDefault, firstLower, className } from '../../Helpers/Utils';\nimport type {\n AlexaV3DirectiveName,\n AlexaV3DirectiveValue,\n AlexaV3Request,\n IotExternalDetectorState,\n} from '../../types';\n\nexport type ControlStateInitObject = {\n setState?: IotExternalDetectorState;\n getState?: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n\n // Extra for Color control\n hal?: {\n hue: string;\n saturation?: string;\n brightness?: string;\n };\n\n // Extra for Mode control\n supportedModes?: any[];\n instance?: string;\n};\n\nexport class Base {\n private _properties: string[] = [];\n private _setState: IotExternalDetectorState | null = null;\n protected _setId: string = '';\n protected _getId: string = '';\n private _valuesRange: { min: number | boolean; max: number | boolean } = { min: 0, max: 100 };\n private _currentValue: ioBroker.StateValue | undefined;\n protected _alexaSetter?: (value: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n protected _alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n private _instance?: string;\n protected _supportedModesAsEnum: Record<string, number | string> = {};\n\n /**\n * @param opts The object to initialize the corresponding ioBroker state.\n * @param opts.setState The iobroker state to write values to.\n * @param opts.getState The iobroker state to read values from.\n * @param opts.alexaSetter The function to apply to an Alexa value to transform it to the iobroker's one\n * @param opts.alexaGetter The function to apply to an iobroker value to transform it to the Alexa's one\n */\n init(opts: ControlStateInitObject): void {\n if (!opts.setState) {\n throw new Error(`missing setState in ${this.constructor.name}`);\n }\n this._setState = opts.setState;\n this._setId = opts.setState.id;\n this._getId = opts.getState?.id || this._setId;\n this._valuesRange = configuredRangeOrDefault(this._setState);\n this._instance = opts.instance;\n\n if (opts.alexaSetter) {\n this._alexaSetter = opts.alexaSetter;\n }\n if (opts.alexaGetter) {\n this._alexaGetter = opts.alexaGetter;\n }\n }\n\n get instance(): string | undefined {\n return this._instance;\n }\n\n get propertyName(): string {\n return firstLower(`${this.constructor.name}`);\n }\n\n static get propertyName(): string {\n return firstLower(className(this.toString()));\n }\n\n get valuesRangeMin(): number | boolean {\n return this._valuesRange.min;\n }\n\n get valuesRangeMax(): number | boolean {\n return this._valuesRange.max;\n }\n\n get setId(): string {\n return this._setId;\n }\n\n get getId(): string {\n return this._getId;\n }\n /**\n * returns last known iobroker value\n */\n get currentValue(): ioBroker.StateValue | undefined {\n return this._currentValue;\n }\n\n set currentValue(value: ioBroker.StateValue | undefined) {\n this._currentValue = value;\n }\n\n value(alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue | undefined {\n return this._alexaSetter && typeof alexaValue === 'number'\n ? this._alexaSetter(alexaValue)\n : (alexaValue as ioBroker.StateValue | undefined);\n }\n\n alexaValue(value: ioBroker.StateValue | undefined): AlexaV3DirectiveValue {\n return this._alexaGetter && typeof value === 'number'\n ? this._alexaGetter(value)\n : (value as AlexaV3DirectiveValue);\n }\n\n static directive(_event: AlexaV3Request): AlexaV3DirectiveName {\n return Base.SET;\n }\n\n /**\n * Checks whether a directive refers to the property\n *\n * @param event Contains the Alexa event.\n */\n static matches(event: AlexaV3Request): boolean {\n return event?.directive?.header?.namespace === `Alexa.${className(this.toString())}Controller`;\n }\n\n matches(event: AlexaV3Request): boolean {\n return event?.directive?.header?.name === this.propertyName;\n }\n\n /**\n * Extracts value to be set on the smart device sent in an Alexa directive\n */\n alexaDirectiveValue(event: AlexaV3Request): AlexaV3DirectiveValue {\n if (this.propertyName === 'color') {\n return event.directive.payload.color;\n }\n if (this.propertyName === 'colorTemperatureInKelvin') {\n return event.directive.payload.colorTemperatureInKelvin;\n }\n if (this.propertyName === 'brightness') {\n return event.directive.payload.brightness;\n }\n // @ts-expect-error fix later\n return event.directive.payload[this.propertyName];\n }\n\n reportValue(value: AlexaV3DirectiveValue): any {\n return value;\n }\n\n static get ADJUST(): AlexaV3DirectiveName {\n return 'ADJUST';\n }\n\n static get SET(): AlexaV3DirectiveName {\n return 'SET';\n }\n\n static get CELSIUS_SCALE(): AlexaV3DirectiveName {\n return 'CELSIUS';\n }\n\n get supportedModesAsEnum(): Record<string, number | string> {\n return this._supportedModesAsEnum;\n }\n}\n\nexport default Base;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Color.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Properties/Color.ts"],"names":[],"mappings":";;;;;AAAA,kDAA2D;AAG3D,MAAqB,KAAM,SAAQ,cAAI;IAC3B,IAAI,GAIR;QACA,GAAG,EAAE,EAAE;QACP,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,EAAE;KACjB,CAAC;IAEF,IAAI,CAAC,IAA4B;QAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;QACzG,CAAC;QACD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QAE3B,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC;QACzC,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC;QACzC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,KAAqB;QACzB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,KAAK,UAAU,CAAC;IACjF,CAAC;IAED,IAAI,GAAG,CAAC,KAAgE;QACpE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,GAAG;QAKH,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACJ;AA1CD,wBA0CC","sourcesContent":["import Base, { type ControlStateInitObject } from './Base';\nimport type { AlexaV3Request } from '../../types';\n\nexport default class Color extends Base {\n private _hal: {\n hue: string;\n saturation?: string;\n brightness?: string;\n } = {\n hue: '',\n saturation: '',\n brightness: '',\n };\n\n init(opts: ControlStateInitObject): void {\n if (!opts.hal) {\n throw new Error('Color control requires hal object with hue, saturation, and brightness properties');\n }\n this.hal = opts.hal;\n this._setId = opts.hal.hue;\n this._getId = opts.hal.hue;\n\n if (opts.alexaSetter) {\n this._alexaSetter = opts.alexaSetter;\n }\n if (opts.alexaGetter) {\n this._alexaGetter = opts.alexaGetter;\n }\n }\n\n matches(event: AlexaV3Request): boolean {\n return Color.matches(event) && event?.directive?.header?.name === 'SetColor';\n }\n\n set hal(value: { hue: string; saturation?: string; brightness?: string }) {\n this._hal = value;\n }\n\n get hal(): {\n hue: string;\n saturation?: string;\n brightness?: string;\n } {\n return this._hal;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DetectionState.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAG1B,MAAqB,cAAe,SAAQ,cAAI;IAC5C,MAAM,CAAC,OAAO,CAAC,KAAqB;QAChC,OAAO,CACH,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,KAAK,oBAAoB;YAC5D,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,KAAK,qBAAqB,CAChE,CAAC;IACN,CAAC;IAED,OAAO,CAAC,KAAqB;QACzB,OAAO,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,KAAK,QAAQ;QACf,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,MAAM,KAAK,YAAY;QACnB,OAAO,cAAc,CAAC;IAC1B,CAAC;CACJ;AAnBD,iCAmBC","sourcesContent":["import Base from './Base';\nimport type { AlexaV3DirectiveName, AlexaV3Request } from '../../types';\n\nexport default class DetectionState extends Base {\n static matches(event: AlexaV3Request): boolean {\n return (\n event?.directive?.header?.namespace === 'Alexa.MotionSensor' ||\n event?.directive?.header?.namespace === 'Alexa.ContactSensor'\n );\n }\n\n matches(event: AlexaV3Request): boolean {\n return DetectionState.matches(event);\n }\n\n static get DETECTED(): AlexaV3DirectiveName {\n return 'DETECTED';\n }\n\n static get NOT_DETECTED(): AlexaV3DirectiveName {\n return 'NOT_DETECTED';\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LockState.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Properties/LockState.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAG1B,MAAqB,SAAU,SAAQ,cAAI;IACvC,MAAM,CAAC,OAAO,CAAC,KAAqB;QAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,KAAK,sBAAsB,CAAC;IAC1E,CAAC;IAED,OAAO,CAAC,KAAqB;QACzB,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,mBAAmB,CAAC,KAAqB;QACrC,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,IAAyB,CAAC;IAC5D,CAAC;IAED,MAAM,KAAK,IAAI;QACX,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,MAAM,KAAK,MAAM;QACb,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,MAAM,KAAK,MAAM;QACb,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,MAAM,KAAK,QAAQ;QACf,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,MAAM;QACb,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAnCD,4BAmCC","sourcesContent":["import Base from './Base';\nimport type { AlexaV3DirectiveName, AlexaV3DirectiveValue, AlexaV3Request } from '../../types';\n\nexport default class LockState extends Base {\n static matches(event: AlexaV3Request): boolean {\n return event?.directive?.header?.namespace === 'Alexa.LockController';\n }\n\n matches(event: AlexaV3Request): boolean {\n return LockState.matches(event);\n }\n\n alexaDirectiveValue(event: AlexaV3Request): AlexaV3DirectiveValue {\n return event.directive.header.name as 'Lock' | 'Unlock';\n }\n\n static get LOCK(): string {\n return 'Lock';\n }\n\n static get LOCKED(): AlexaV3DirectiveName {\n return 'LOCKED';\n }\n\n static get UNLOCK(): string {\n return 'Unlock';\n }\n\n static get UNLOCKED(): AlexaV3DirectiveName {\n return 'UNLOCKED';\n }\n\n /**\n * The lock can't transition to `locked` or `unlocked` because the locking mechanism is jammed.\n */\n static get JAMMED(): AlexaV3DirectiveName {\n return 'JAMMED';\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Mode.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.ts"],"names":[],"mappings":";;;;;AAAA,kDAA2D;AAS3D,MAAqB,IAAK,SAAQ,cAAI;IAC1B,eAAe,GAKjB,EAAE,CAAC;IAET,IAAI,CAAC,IAA4B;QAC7B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClG,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;QACzF,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,KAAqB;QACzB,OAAO,CACH,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACnB,iCAAiC;YACjC,SAAS,KAAK,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI;YAC5C,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ;YACpD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,CAC9F,CAAC;IACN,CAAC;IAED,mBAAmB,CAAC,KAAqB;QACrC,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;IACxC,CAAC;IAED,IAAI,cAAc;QAMd,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;CACJ;AAzCD,uBAyCC","sourcesContent":["import Base, { type ControlStateInitObject } from './Base';\nimport type {\n AlexaV3ActionMapping,\n AlexaV3DirectiveValue,\n AlexaV3DiscoveryResponse,\n AlexaV3Request,\n AlexaV3StateMapping,\n} from '../../types';\n\nexport default class Mode extends Base {\n private _supportedModes: {\n value: string;\n actionMappings: AlexaV3ActionMapping[];\n discoveryResponse: AlexaV3DiscoveryResponse[];\n stateMappings: AlexaV3StateMapping[];\n }[] = [];\n\n init(opts: ControlStateInitObject): void {\n super.init(opts);\n if (!opts.supportedModes || !Array.isArray(opts.supportedModes) || opts.supportedModes.length === 0) {\n throw new Error('Mode control requires supportedModes array with at least one mode');\n }\n if (!opts.instance || typeof opts.instance !== 'string') {\n throw new Error('Mode control requires a valid instance string');\n }\n this._supportedModes = opts.supportedModes;\n }\n\n matches(event: AlexaV3Request): boolean {\n return (\n Mode.matches(event) &&\n // non-adjustable mode controller\n 'SetMode' === event?.directive?.header?.name &&\n this.instance === event?.directive?.header?.instance &&\n this.supportedModes.map(mode => mode.value).includes(event?.directive?.payload?.mode || '')\n );\n }\n\n alexaDirectiveValue(event: AlexaV3Request): AlexaV3DirectiveValue {\n return event.directive.payload.mode;\n }\n\n get supportedModes(): {\n value: string;\n actionMappings: AlexaV3ActionMapping[];\n discoveryResponse: AlexaV3DiscoveryResponse[];\n stateMappings: AlexaV3StateMapping[];\n }[] {\n return this._supportedModes;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PowerState.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Properties/PowerState.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAG1B,MAAqB,UAAW,SAAQ,cAAI;IACxC,MAAM,CAAC,OAAO,CAAC,KAAqB;QAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,KAAK,uBAAuB,CAAC;IAC3E,CAAC;IAED,OAAO,CAAC,KAAqB;QACzB,OAAO,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,KAAK,EAAE;QACT,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,KAAK,GAAG;QACV,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,mBAAmB,CAAC,KAAqB;QACrC,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;IACrF,CAAC;CACJ;AApBD,6BAoBC","sourcesContent":["import Base from './Base';\nimport type { AlexaV3DirectiveName, AlexaV3DirectiveValue, AlexaV3Request } from '../../types';\n\nexport default class PowerState extends Base {\n static matches(event: AlexaV3Request): boolean {\n return event?.directive?.header?.namespace === 'Alexa.PowerController';\n }\n\n matches(event: AlexaV3Request): boolean {\n return PowerState.matches(event);\n }\n\n static get ON(): AlexaV3DirectiveName {\n return 'ON';\n }\n\n static get OFF(): AlexaV3DirectiveName {\n return 'OFF';\n }\n\n alexaDirectiveValue(event: AlexaV3Request): AlexaV3DirectiveValue {\n return event.directive.header.name === 'TurnOn' ? PowerState.ON : PowerState.OFF;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThermostatMode.js","sourceRoot":"","sources":["../../../../../src/lib/Alex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AM,KAAK,GAAG;QACV,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,KAAK,IAAI;QACX,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,MAAM,KAAK,GAAG;QACV,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA7CD,iCA6CC","sourcesContent":["import type { AlexaV3DirectiveValue, AlexaV3Request } from '../../types';\n\nimport { asEnum } from '../../Helpers/Utils';\nimport Base, { type ControlStateInitObject } from './Base';\n\nexport default class ThermostatMode extends Base {\n private _supportedModes: string[] = [];\n\n init(opts: ControlStateInitObject): void {\n super.init(opts);\n if (!opts.supportedModes || !Array.isArray(opts.supportedModes) || opts.supportedModes.length === 0) {\n throw new Error('ThermostatMode control requires supportedModes array with at least one mode');\n }\n // set mode to be AUTO for thermostats without mode at all\n this.currentValue = this.setId ? undefined : ThermostatMode.AUTO;\n this._supportedModes = opts.supportedModes as string[];\n this._supportedModesAsEnum = asEnum(this._supportedModes);\n }\n\n static matches(event: AlexaV3Request): boolean {\n return event?.directive?.header?.name === 'SetThermostatMode';\n }\n\n matches(event: AlexaV3Request): boolean {\n return ThermostatMode.matches(event);\n }\n\n alexaDirectiveValue(event: AlexaV3Request): AlexaV3DirectiveValue {\n return event.directive.payload.thermostatMode?.value;\n }\n\n get supportedModes(): any[] {\n return this._supportedModes;\n }\n\n static get AUTO(): string {\n return 'AUTO';\n }\n static get COOL(): string {\n return 'COOL';\n }\n static get ECO(): string {\n return 'ECO';\n }\n static get HEAT(): string {\n return 'HEAT';\n }\n static get OFF(): string {\n return 'OFF';\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AdjustableControl.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/AdjustableControl.ts"],"names":[],"mappings":";;;;;AAAA,wDAAgC;AAChC,mDAAkE;AAGlE,MAAqB,iBAAkB,SAAQ,iBAAO;IAClD,oBAAoB;QAChB,OAAO,EAAE,CAAC;IACd,CAAC;IAED,iBAAiB,CAAC,KAAqB;QACnC,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,IAAI,CACnC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,WAAc,CAAC,MAAM,CAC7F,CAAC;IACN,CAAC;IAED,WAAW,CACP,KAAqB;QAErB,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAClG,CAAC;CACJ;AAhBD,oCAgBC","sourcesContent":["import Control from './Control';\nimport { Base as PropertiesBase } from '../Alexa/Properties/Base';\nimport type { AlexaV3DirectiveValue, AlexaV3Request } from '../types';\n\nexport default class AdjustableControl extends Control {\n adjustableProperties(): (typeof PropertiesBase)[] {\n return [];\n }\n\n isAdjustDirective(event: AlexaV3Request): boolean {\n return this.adjustableProperties().some(\n property => property.matches(event) && property.directive(event) === PropertiesBase.ADJUST,\n );\n }\n\n valueSetter(\n event: AlexaV3Request,\n ): (event: AlexaV3Request, property: PropertiesBase) => Promise<AlexaV3DirectiveValue> {\n return this.isAdjustDirective(event) ? this.adjustValue.bind(this) : super.valueSetter(event);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AdjustablePercentageControl.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AACjD,4EAAoD;AACpD,gFAAwD;AAIxD,MAAqB,2BAA4B,SAAQ,2BAAiB;IACtE,oBAAoB;QAChB,OAAO,CAAC,oBAAU,CAAC,CAAC;IACxB,CAAC;IAED,gBAAgB;QACZ,MAAM,MAAM,GAAuB,CAAC,IAAI,sBAAY,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAC7E,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7D,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAAwB,EAAE,KAA0B;QAC/D,aAAa;QACb,OAAO,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;CACJ;AAjBD,8CAiBC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport AdjustableControl from './AdjustableControl';\nimport Percentage from '../Alexa/Properties/Percentage';\nimport type { Base as PropertiesBase } from '../Alexa/Properties/Base';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\n\nexport default class AdjustablePercentageControl extends AdjustableControl {\n adjustableProperties(): (typeof PropertiesBase)[] {\n return [Percentage];\n }\n\n initCapabilities(): CapabilitiesBase[] {\n const result: CapabilitiesBase[] = [new Capabilities.PercentageController()];\n for (const property of result.flatMap(item => item.properties)) {\n property.init(this.percentageInitObject());\n }\n return result;\n }\n\n async setState(property: PropertiesBase, value: ioBroker.StateValue): Promise<void> {\n // todo: byON\n return super.setState(property, value);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AirCondition.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/AirCondition.ts"],"names":[],"mappings":";;;;;AAAA,sGAA8E;AAC9E,wFAAgE;AAChE,4FAAoE;AAEpE,gGAAwE;AACxE,kFAA0D;AAC1D,gFAAwD;AACxD,4EAAoD;AACpD,4CAAsD;AACtD,wFAAgE;AAEhE,iFAAyD;AAGzD,MAAqB,YAAa,SAAQ,2BAAiB;IAC/C,qBAAqB,CAAmC;IACxD,eAAe,CAA6B;IAC5C,gBAAg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AET,UAAiC;oBAEjC,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAoB,CAAC,CAAC;gBAC3D,CAAC;gBACD,WAAW,EAAE,UAET,KAAsC;oBAEtC,OAAO,IAAI,CAAC,oBAAoB,CAAC,KAAe,CAAC,CAAC;gBACtD,CAAC;gBACD,cAAc,EAAE;oBACZ,wBAAc,CAAC,IAAI;oBACnB,wBAAc,CAAC,IAAI;oBACnB,wBAAc,CAAC,GAAG;oBAClB,wBAAc,CAAC,IAAI;oBACnB,wBAAc,CAAC,GAAG;iBACrB;aACJ,CAAC;QACN,CAAC;IACL,CAAC;CACJ;AAhKD,+BAgKC","sourcesContent":["import ThermostatController from '../Alexa/Capabilities/ThermostatController';\nimport ThermostatMode from '../Alexa/Properties/ThermostatMode';\nimport PowerController from '../Alexa/Capabilities/PowerController';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\nimport TemperatureSensor from '../Alexa/Capabilities/TemperatureSensor';\nimport Temperature from '../Alexa/Properties/Temperature';\nimport PowerState from '../Alexa/Properties/PowerState';\nimport AdjustableControl from './AdjustableControl';\nimport { ensureValueInRange } from '../Helpers/Utils';\nimport TargetSetpoint from '../Alexa/Properties/TargetSetpoint';\nimport type { Base as PropertiesBase } from '../Alexa/Properties/Base';\nimport AdapterProvider from '../Helpers/AdapterProvider';\nimport type { AlexaV3Category, AlexaV3DirectiveValue, IotExternalDetectorState } from '../types';\n\nexport default class AirCondition extends AdjustableControl {\n private _thermostatController: ThermostatController | undefined;\n private _thermostatMode: ThermostatMode | undefined;\n private _powerController: PowerController | undefined;\n private _powerState: PowerState | undefined;\n private _lastKnownMode: number | string | undefined;\n\n get categories(): AlexaV3Category[] {\n return ['AIR_CONDITIONER'];\n }\n\n adjustableProperties(): (typeof PropertiesBase)[] {\n return [TargetSetpoint];\n }\n\n get dedicatedOnOff(): boolean {\n return this.states[this.statesMap.power] !== undefined;\n }\n\n initCapabilities(): CapabilitiesBase[] {\n this._thermostatController = new ThermostatController();\n this._thermostatMode = this._thermostatController.thermostatMode;\n this._powerController = new PowerController();\n this._powerState = this._powerController.powerState;\n const result: CapabilitiesBase[] = [new TemperatureSensor(), this._thermostatController, this._powerController];\n for (const property of result.flatMap(item => item.properties)) {\n const initObject = this.composeInitObject(property);\n if (initObject) {\n property.init(initObject);\n } else {\n throw new Error(`Unable to initialize property ${property.propertyName}`);\n }\n }\n return result;\n }\n\n async setState(property: PropertiesBase, value: ioBroker.StateValue | undefined): Promise<void> {\n // if we set power ON/OFF via thermostat mode\n if (property.propertyName === PowerState.propertyName && !this.dedicatedOnOff) {\n // set the mode to the last known value or AUTO by switching power ON\n if (value) {\n this._lastKnownMode ||= this._thermostatMode!.supportedModesAsEnum[ThermostatMode.AUTO];\n await AdapterProvider.setState(this._thermostatMode!.setId, this._lastKnownMode);\n this._thermostatMode!.currentValue = this._lastKnownMode;\n this._powerState!.currentValue = true;\n } else {\n // set mode to OFF\n const modeOffValue = this._thermostatMode!.supportedModesAsEnum[ThermostatMode.OFF];\n await AdapterProvider.setState(this._thermostatMode!.setId, modeOffValue);\n this._thermostatMode!.currentValue = this._lastKnownMode;\n this._powerState!.currentValue = false;\n }\n } else {\n // just set the property\n await AdapterProvider.setState(property.setId, value!);\n property.currentValue = value;\n\n if (property.propertyName === ThermostatMode.propertyName) {\n this._lastKnownMode = value as string;\n if (!this.dedicatedOnOff) {\n this._powerState!.currentValue =\n value !== this._thermostatMode!.supportedModesAsEnum[ThermostatMode.OFF];\n }\n }\n }\n }\n\n async getOrRetrieveCurrentValue(property: PropertiesBase): Promise<ioBroker.StateValue> {\n if (property.currentValue === undefined) {\n property.currentValue = await AdapterProvider.getState(property.getId);\n\n // convert mode != OFF to power = true\n if (property.propertyName === this._powerState!.propertyName && !this.dedicatedOnOff) {\n property.currentValue =\n property.currentValue !== this._thermostatMode!.supportedModesAsEnum[ThermostatMode.OFF];\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 composeInitObject(property: PropertiesBase):\n | {\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 | undefined {\n const map = this.statesMap;\n\n if (property.propertyName === PowerState.propertyName) {\n return {\n setState: this.states[map.power] || this.states[map.mode]!,\n getState: this.states[map.power] || this.states[map.mode]!,\n alexaSetter: function (alexaValue: AlexaV3DirectiveValue): boolean {\n return alexaValue === PowerState.ON;\n },\n alexaGetter: function (value: ioBroker.StateValue | undefined): AlexaV3DirectiveValue {\n return value ? PowerState.ON : PowerState.OFF;\n },\n };\n }\n\n if (property.propertyName === Temperature.propertyName) {\n return {\n setState: this.states[map.set]!,\n getState: this.states[map.actual] || this.states[map.set]!,\n };\n }\n\n if (property.propertyName === TargetSetpoint.propertyName) {\n // const range = Utils.configuredRangeOrDefault(this.states[map.set]);\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 || 0;\n },\n };\n }\n\n if (property.propertyName === ThermostatMode.propertyName) {\n return {\n setState: this.states[map.mode]!,\n getState: this.states[map.mode]!,\n alexaSetter: function (\n this: PropertiesBase,\n alexaValue: AlexaV3DirectiveValue,\n ): ioBroker.StateValue | undefined {\n return this.supportedModesAsEnum[alexaValue as string];\n },\n alexaGetter: function (\n this: PropertiesBase,\n value: ioBroker.StateValue | undefined,\n ): AlexaV3DirectiveValue {\n return this.supportedModesAsEnum[value as string];\n },\n supportedModes: [\n ThermostatMode.AUTO,\n ThermostatMode.COOL,\n ThermostatMode.ECO,\n ThermostatMode.HEAT,\n ThermostatMode.OFF,\n ],\n };\n }\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContactSensor.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/ContactSensor.ts"],"names":[],"mappings":";;;;;AAAA,uEAAiG;AAEjG,0EAAkD;AAGlD,MAAqB,aAAc,SAAQ,0BAAgB;IACvD,IAAI,UAAU;QACV,OAAO,IAAI,6BAAyB,EAAE,CAAC;IAC3C,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9B,CAAC;CACJ;AARD,gCAQC","sourcesContent":["import { ContactSensor as ContactSensorCapabilities } from '../Alexa/Capabilities/ContactSensor';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\nimport ReadOnlyDetector from './ReadOnlyDetector';\nimport type { AlexaV3Category } from '../types';\n\nexport default class ContactSensor extends ReadOnlyDetector {\n get capability(): CapabilitiesBase | undefined {\n return new ContactSensorCapabilities();\n }\n\n get categories(): AlexaV3Category[] {\n return ['CONTACT_SENSOR'];\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Control.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Control.ts"],"names":[],"mappings":";;;;;AAAA,2EAAmD;AACnD,4CAAuH;AACvH,+DAAuC;AACvC,iFAAyD;AAEzD,gFAAwD;AACxD,wFAAgE;AAWhE;;;GAGG;AACH,MAAqB,OAAO;IACxB,MAAM,CAAC,SAAS,GAAG;QACf,KAAK;QACL,QAAQ;QACR,QAAQ;QACR,WAAW;QACX,OAAO;QACP,MAAM;QACN,KAAK;QACL,QAAQ;QACR,YAAY;QACZ,YAAY;QACZ,aAAa;QACb,IAAI;QACJ,MAAM;KACT,CAAC;IACc,GAAG,CAAS;IACZ,UAAU,CAAqB;IAC/B,SAAS,CAAqB;IAC9B,OAAO,GAAyD,EAAE,CAAC;IAEnF;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className, ensureValueInRange_0_100, denormalize_0_100, normalize_0_100 } from '../Helpers/Utils';\nimport Logger from '../Helpers/Logger';\nimport AdapterProvider from '../Helpers/AdapterProvider';\nimport type { ControlStateInitObject, Base as PropertiesBase } from '../Alexa/Properties/Base';\nimport PowerState from '../Alexa/Properties/PowerState';\nimport DetectionState from '../Alexa/Properties/DetectionState';\nimport type {\n AlexaV3Category,\n AlexaV3DirectiveValue,\n AlexaV3ReportedState,\n AlexaV3Request,\n IotExternalDetectorState,\n IotExternalPatternControl,\n} from '../types';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\n\n/**\n * Represents the base functionality for a control in a smart device. A smart device has at least one control.\n * The specific functionality, natively supported capabilities, etc. are defined in derived classes.\n */\nexport default class Control {\n static stateKeys = [\n 'SET',\n 'ACTUAL',\n 'ON_SET',\n 'ON_ACTUAL',\n 'POWER',\n 'MODE',\n 'HUE',\n 'DIMMER',\n 'BRIGHTNESS',\n 'SATURATION',\n 'TEMPERATURE',\n 'ON',\n 'MUTE',\n ];\n public readonly log: Logger;\n public readonly _supported: CapabilitiesBase[];\n public readonly _enforced: CapabilitiesBase[];\n public readonly _states: Record<string, IotExternalDetectorState | undefined> = {};\n\n /**\n * @param detectedControl - The detected control in terms of iobroker type detector.\n */\n constructor(detectedControl: IotExternalPatternControl) {\n this.initStates(detectedControl);\n this._supported = this.initCapabilities();\n this._enforced = this.initEnforcedCapabilities();\n this.log = new Logger(this);\n this.log.silly(`created instance`);\n }\n /**\n * This function maps a passed on control to an array of objects. Each object contains an Alexa capability the control natively supports\n * and at least one property. Every property is initialized with corresponding iobroker state ids and value converters from Alexa to iobroker types\n * and vice versa.\n *\n * @returns Array of objects with natively supported Alexa capabilities and correspondingly configured instances of StateProxies\n */\n initCapabilities(): CapabilitiesBase[] {\n return [];\n }\n /**\n * This function maps a passed on control to an array of objects. Each object contains an Alexa capability the control can handle even\n * though not natively supported (e.g., the light control can handle the Alexa BrightnessController directive by switching\n * itself `ON` on brightness > 0 and `OFF` on brightness == 0)\n * Every capability has at least one property with set up iobroker state ids and value converters from Alexa to iobroker types\n * and vice versa.\n *\n * @returns Array of objects with natively supported Alexa capabilities and correspondingly configured instances of StateProxies\n */\n initEnforcedCapabilities(): CapabilitiesBase[] {\n return [];\n }\n\n get allCapabilities(): CapabilitiesBase[] {\n return this.supported.concat(this.enforced);\n }\n\n static get type(): string {\n return firstLower(className(this.toString()));\n }\n /**\n * Getter for Alexa categories\n */\n get categories(): AlexaV3Category[] {\n return ['OTHER'];\n }\n\n get name(): string {\n return `${this.constructor.name}`;\n }\n /**\n * Getter for _supported\n */\n get supported(): CapabilitiesBase[] {\n return this._supported;\n }\n /**\n * Getter for _enforced\n */\n get enforced(): CapabilitiesBase[] {\n return this._enforced;\n }\n /**\n * This function returns whether the control natively supports the passed on Alexa directive.\n *\n * @param event The event containing the Alexa directive as it comes from AWS Alexa Service\n * @returns True if the control natively supports the directive, false - otherwise\n */\n supports(event: AlexaV3Request): boolean {\n return this.supported.find(capability => capability.matches(event)) !== undefined;\n }\n /**\n * This function returns whether the control though doesn't natively support the passed on Alexa directive, but able to handle it.\n *\n * @param event The event containing the Alexa directive as it comes from AWS Alexa Service\n * @returns True if the control can handle the directive, false - otherwise\n */\n canHandle(event: AlexaV3Request): boolean {\n return this.enforced.find(capability => capability.matches(event)) !== undefined;\n }\n /**\n * This function processes an Alexa directive. Usually the result of the processing is setting an iobroker state to some value\n * as a reaction to an interaction with Alexa via voice, app, etc.\n *\n * @param event The event containing the Alexa directive as it comes from AWS Alexa Service\n * @returns Object containing the response to be sent to Alexa Service\n */\n async handle(event: AlexaV3Request): Promise<AlexaResponse> {\n this.log.debug(`handling Alexa event`);\n this.log.silly(`${JSON.stringify(event)}`);\n\n const property = this.allCapabilities\n .flatMap(item => item.properties)\n .find(property => property.matches(event));\n\n if (property) {\n let alexaValue: AlexaV3DirectiveValue;\n try {\n const setter = this.valueSetter(event);\n alexaValue = await setter(event, property);\n } catch (error) {\n this.log.debug(`${error}`);\n this.log.error(`failed handling Alexa event`);\n\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n return Promise.reject(AlexaResponse.endpointUnreachable(event.directive.header.messageId).get());\n }\n\n // even though the handler successfully processed the Alexa event,\n // we return an error here for ENFORCED capabilities, to prevent\n // reporting multiple successes for the same capability and\n // running into a situation of returning a wrong value back to Alexa\n if (this.enforced.find(capability => capability.matches(event))) {\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 const response = AlexaResponse.handled(\n event,\n property.propertyName,\n property.reportValue(alexaValue),\n property.instance,\n );\n\n // though the processed directive required to change a single value, the response must contain values of all \"relevant\" properties\n // Please refer to this for details: https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-thermostatcontroller.html#settargettemperature-response-event\n\n // TODO: add values of relevant properties to response\n\n this.log.silly(`${JSON.stringify(response.get())}`);\n return response.get();\n }\n\n const errorResponse = AlexaResponse.directiveNotSupportedByControl(\n this.name,\n event?.directive?.header?.namespace,\n event?.directive?.header?.messageId,\n event?.directive?.header?.payloadVersion,\n );\n this.log.silly(`${JSON.stringify(errorResponse.get())}`);\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n return Promise.reject(errorResponse.get());\n }\n\n valueSetter(\n _event: AlexaV3Request,\n ): (event: AlexaV3Request, property: PropertiesBase) => Promise<AlexaV3DirectiveValue> {\n return this.setValue.bind(this);\n }\n\n async setValue(event: AlexaV3Request, property: PropertiesBase): Promise<AlexaV3DirectiveValue> {\n // extract alexa value from event\n const alexaValue = property.alexaDirectiveValue(event);\n\n // convert alexa value to iobroker value\n let value = property.value(alexaValue);\n\n // if set, the device could support toggle\n if (event.currentState) {\n // console.error(`----------------------------------- command: ${value}, current value: ${JSON.stringify(event.currentState)}`);\n const state = event.currentState.find(item => item.name === property.propertyName);\n if (state && value === true) {\n // it could support toggle.\n // get current value\n const current = property.value(state.value);\n if (current === true) {\n // turn off\n value = false;\n } else if (current !== false) {\n const currentValue = await this.getOrRetrieveCurrentValue(property);\n if (currentValue === true) {\n // turn off\n value = false;\n }\n }\n }\n }\n\n // set iobroker state\n await this.setState(property, value!);\n\n property.currentValue = value;\n // return value as expected by Alexa\n return property.alexaValue(value);\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 // get current value\n const currentValue = await this.getOrRetrieveCurrentValue(property);\n // convert the current value to Alexa value\n const valueToAdjust = property.alexaValue(currentValue);\n // adjust Alexa value\n const adjustedValue = ensureValueInRange_0_100(\n parseFloat((valueToAdjust as string) || '0') + parseFloat((delta as string) || '0'),\n );\n // convert adjusted value to iobroker value\n const value = property.value(adjustedValue);\n\n // set iobroker state\n await this.setState(property, value as ioBroker.StateValue);\n\n return adjustedValue;\n }\n\n async getOrRetrieveCurrentValue(property: PropertiesBase): Promise<ioBroker.StateValue> {\n if (property.currentValue === undefined) {\n property.currentValue = await AdapterProvider.getState(property.getId);\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 reportState(): Promise<AlexaV3ReportedState[]> {\n this.log.debug(`reporting state`);\n\n const propertiesToReport: AlexaV3ReportedState[] = [];\n\n for (const capability of this.supported) {\n for (const property of capability.properties) {\n try {\n await this.getOrRetrieveCurrentValue(property);\n\n const toReport: AlexaV3ReportedState = {\n namespace: capability.namespace,\n instance: property.instance,\n name: property.propertyName,\n value: property.reportValue(property.alexaValue(property.currentValue)),\n };\n\n if (!toReport.instance) {\n delete toReport.instance;\n }\n\n propertiesToReport.push(toReport);\n } catch (error) {\n this.log.error(`failed reporting state for property ${property.propertyName} of ${this.name}`);\n this.log.debug(`${error}`);\n }\n }\n }\n\n this.log.debug(`${JSON.stringify(propertiesToReport)}`);\n return propertiesToReport;\n }\n\n toString(): string {\n return `${this.constructor.name}`;\n }\n\n initStates(ctrl: IotExternalPatternControl): void {\n for (const stateKey of Control.stateKeys) {\n this._states[stateKey] = ctrl.states.find(s => s.name === stateKey);\n }\n }\n\n get states(): Record<string, IotExternalDetectorState | undefined> {\n return this._states;\n }\n\n get statesMap(): Record<string, string> {\n const map: Record<string, string> = {};\n for (const stateKey of Control.stateKeys) {\n map[stateKey.toLowerCase()] = stateKey;\n }\n return map;\n }\n\n async setState(property: PropertiesBase, value: ioBroker.StateValue): Promise<void> {\n await AdapterProvider.setState(property.setId, value);\n property.currentValue = value;\n }\n\n //-------------------------------------------------------\n // standard property init objects\n //\n\n blankInitObject(): ControlStateInitObject {\n // const states = this.initStates(ctrl);\n const map = this.statesMap;\n return {\n setState: this.states[map.actual]!,\n getState: this.states[map.actual]!,\n };\n }\n\n powerStateInitObject(): ControlStateInitObject {\n // const states = this.initStates(ctrl);\n const map = this.statesMap;\n\n return {\n setState: this.states[map.set]!,\n getState: this.states[map.actual]!,\n alexaSetter: function (alexaValue) {\n return alexaValue === PowerState.ON;\n },\n alexaGetter: function (value) {\n return value ? PowerState.ON : PowerState.OFF;\n },\n };\n }\n\n detectedStateInitObject(): ControlStateInitObject {\n const map = this.statesMap;\n return {\n setState: this.states[map.actual]!,\n getState: this.states[map.actual]!,\n alexaSetter: function (_alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue | undefined {\n // should be never called\n return 0;\n },\n alexaGetter: function (value: ioBroker.StateValue | undefined): AlexaV3DirectiveValue {\n return value ? DetectionState.DETECTED : DetectionState.NOT_DETECTED;\n },\n };\n }\n\n percentageInitObject(): ControlStateInitObject {\n const map = this.statesMap;\n // const range = configuredRangeOrDefault(this.states[map.set]);\n return {\n setState: this.states[map.set]!,\n getState: this.states[map.actual]!,\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"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Ct.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Ct.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AACjD,4CAAiH;AACjH,iFAAyD;AACzD,4EAAoD;AAIpD,gFAAwD;AACxD,4GAAoF;AAGpF,gFAAwD;AAGxD,MAAqB,EAAG,SAAQ,2BAAiB;IACrC,qBAAqB,CAAmC;IACxD,WAAW,CAAyB;IACpC,2BAA2B,CAAyC;IACpE,0BAA0B,CAA8B;IACxD,WAAW,CAAyB;IAE5C,IAAI,UAAU;QACV,OAAO,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED,oBAAoB;QAChB,OAAO,CAAC,kCAAwB,CAAC,CAAC;IACtC,CAAC;IAED,gBAAgB;QACZ,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAC3B,MAAM,MAAM,GAAG,CAAC,IAAI,sBAAY,CAAC,eAAe,EAAE,CAAC,CAAC;QAEpD,+CAA+C;QAC/C,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACzD,IAAI,CAAC,qBAAqB,GAAG,IAAI,sBAAY,CAAC,oBAAoB,EAAE,CAAC;YACrE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC;YACzD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC5C,CAAC;QAED,sCAAsC;QACtC,IAAI,IAAI,CAA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BAAqB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;wBAC/F,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;oBAC7C,CAAC;oBACD,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;wBACpB,qBAAqB;wBACrB,MAAM,OAAO,GAAG,IAAA,uBAAe,EAC1B,IAAI,CAAC,YAAuB,IAAI,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAC9D,IAAI,CAAC,qBAAqB,CAC7B,CAAC;wBACF,IAAI,KAAK,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;wBAC5D,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;wBAC9B,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;oBAC7C,CAAC;oBAED,OAAO,UAAoB,CAAC;gBAChC,CAAC;gBACD,WAAW,EAAE,UAAU,KAAsC;oBACzD,OAAO,KAAe,CAAC;gBAC3B,CAAC;aACJ,CAAC;QACN,CAAC;IACL,CAAC;CACJ;AAzND,qBAyNC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport { configuredRangeOrDefault, denormalize_0_100, normalize_0_100, closestFromList } from '../Helpers/Utils';\nimport AdapterProvider from '../Helpers/AdapterProvider';\nimport AdjustableControl from './AdjustableControl';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\nimport type { Base as PropertiesBase } from '../Alexa/Properties/Base';\nimport type BrightnessController from '../Alexa/Capabilities/BrightnessController';\nimport Brightness from '../Alexa/Properties/Brightness';\nimport ColorTemperatureInKelvin from '../Alexa/Properties/ColorTemperatureInKelvin';\nimport type ColorTemperatureController from '../Alexa/Capabilities/ColorTemperatureController';\nimport type PowerController from '../Alexa/Capabilities/PowerController';\nimport PowerState from '../Alexa/Properties/PowerState';\nimport type { AlexaV3Category, AlexaV3DirectiveValue, AlexaV3Request, IotExternalDetectorState } from '../types';\n\nexport default class Ct extends AdjustableControl {\n private _brightnessCapability: BrightnessController | undefined;\n private _brightness: Brightness | undefined;\n private _colorTemperatureCapability: ColorTemperatureController | undefined;\n private _powerControllerCapability: PowerController | undefined;\n private _powerState: PowerState | undefined;\n\n get categories(): AlexaV3Category[] {\n return ['LIGHT'];\n }\n\n adjustableProperties(): (typeof PropertiesBase)[] {\n return [ColorTemperatureInKelvin];\n }\n\n initCapabilities(): CapabilitiesBase[] {\n const map = this.statesMap;\n const result = [new Capabilities.ColorController()];\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();\n this._brightness = this._brightnessCapability.brightness;\n result.push(this._brightnessCapability);\n }\n\n // if the state TEMPERATURE configured\n if (this.states[map.temperature]) {\n this._colorTemperatureCapability = new Capabilities.ColorTemperatureController();\n result.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();\n this._powerState = this._powerControllerCapability.powerState;\n result.push(this._powerControllerCapability);\n }\n\n for (const property of result.flatMap(item => item.properties)) {\n const initObject = this.composeInitObject(property);\n if (initObject) {\n property.init(initObject);\n }\n }\n\n return result;\n }\n\n async getOrRetrieveCurrentValue(property: PropertiesBase): 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 === PowerState.propertyName && !this.states[map.on]) {\n property.currentValue = property.currentValue !== 0;\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): 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);\n property.currentValue = value;\n } else {\n if (!this._brightness) {\n throw new Error('No brightness property configured');\n }\n if (!this._powerState) {\n throw new Error('No powerState property configured');\n }\n\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: number | string | undefined | null;\n if (smartName && typeof smartName === 'object') {\n byOn = smartName.byON;\n } else {\n byOn = undefined;\n }\n if (byOn === undefined || byOn === null || isNaN(byOn as unknown as number)) {\n byOn = range.max as number | string | undefined | null;\n } else {\n byOn = parseFloat(byOn);\n }\n await AdapterProvider.setState(this._brightness.setId, byOn ?? 100);\n this._brightness.currentValue = byOn;\n this._powerState.currentValue = true;\n } else {\n // set brightness to 0 on power OFF\n await AdapterProvider.setState(this._brightness.setId, 0);\n this._brightness.currentValue = 0;\n this._powerState.currentValue = false;\n }\n }\n } else if (\n property.propertyName === Brightness.propertyName ||\n property.propertyName === ColorTemperatureInKelvin.propertyName\n ) {\n await AdapterProvider.setState(property.setId, value);\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 ?? 0);\n\n return value as AlexaV3DirectiveValue;\n }\n\n composeInitObject(property: PropertiesBase):\n | {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n }\n | undefined {\n const map = this.statesMap;\n\n if (property.propertyName === PowerState.propertyName) {\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 (value: ioBroker.StateValue | undefined): AlexaV3DirectiveValue {\n return value ? PowerState.ON : PowerState.OFF;\n },\n };\n }\n\n if (property.propertyName === Brightness.propertyName) {\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(\n value as number,\n this.valuesRangeMin as number,\n this.valuesRangeMax as number,\n );\n },\n };\n }\n\n if (property.propertyName === ColorTemperatureInKelvin.propertyName) {\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 =\n 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 (value: ioBroker.StateValue | undefined): AlexaV3DirectiveValue {\n return value as number;\n },\n };\n }\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Dimmer.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Dimmer.ts"],"names":[],"mappings":";;;;;AAAA,4FAAoE;AACpE,sGAA8E;AAC9E,4EAAoD;AACpD,4CAAgG;AAChG,gFAAwD;AACxD,gFAAwD;AACxD,iFAAyD;AAKzD,MAAqB,MAAO,SAAQ,2BAAiB;IACzC,0BAA0B,CAAmB;IAC7C,WAAW,CAAc;IACzB,qBAAqB,CAAwB;IAC7C,WAAW,CAAc;IAEjC,IAAI,UAAU;QACV,OAAO,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED,oBAAoB;QAChB,OAAO,CAAC,oBAAU,CAAC,CAAC;IACxB,CAAC;IAED,gBAAgB;QACZ,IAAI,CAAC,0BAA0B,GAAG,IAAI,yBAAe,EAAE,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,0BAA0B,CAAC,UAAU,CAAC;QAE9D,IAAI,CAAC,qBAAqB,GAAG,IAAI,8BAAoB,EAAE,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC;QAEzD,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,0BAA0B,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC7E,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YACjD,IAAI,OAAO,EAAE,CAAC;gBACV,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAAwB,EA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D,yBAoJC","sourcesContent":["import PowerController from '../Alexa/Capabilities/PowerController';\nimport BrightnessController from '../Alexa/Capabilities/BrightnessController';\nimport AdjustableControl from './AdjustableControl';\nimport { configuredRangeOrDefault, denormalize_0_100, normalize_0_100 } from '../Helpers/Utils';\nimport PowerState from '../Alexa/Properties/PowerState';\nimport Brightness from '../Alexa/Properties/Brightness';\nimport AdapterProvider from '../Helpers/AdapterProvider';\nimport type { AlexaV3Category, AlexaV3DirectiveValue, IotExternalDetectorState } from '../types';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\nimport type { Base as PropertiesBase } from '../Alexa/Properties/Base';\n\nexport default class Dimmer extends AdjustableControl {\n private _powerControllerCapability!: PowerController;\n private _powerState!: PowerState;\n private _brightnessCapability!: BrightnessController;\n private _brightness!: Brightness;\n\n get categories(): AlexaV3Category[] {\n return ['LIGHT'];\n }\n\n adjustableProperties(): (typeof PropertiesBase)[] {\n return [Brightness];\n }\n\n initCapabilities(): CapabilitiesBase[] {\n this._powerControllerCapability = new PowerController();\n this._powerState = this._powerControllerCapability.powerState;\n\n this._brightnessCapability = new BrightnessController();\n this._brightness = this._brightnessCapability.brightness;\n\n const result = [this._powerControllerCapability, this._brightnessCapability];\n for (const property of result.flatMap(item => item.properties)) {\n const initObj = this.composeInitObject(property);\n if (initObj) {\n property.init(initObj);\n }\n }\n\n return result;\n }\n\n async setState(property: PropertiesBase, value: ioBroker.StateValue): Promise<void> {\n // set the property itself\n await AdapterProvider.setState(property.setId, value);\n property.currentValue = value;\n const valuesRange = configuredRangeOrDefault(this.states[this.statesMap.set]!);\n\n // todo: use adapter.config.deviceOffLevel\n // If\n\n if (property.propertyName === PowerState.propertyName) {\n // set brightness\n if (value) {\n const smartName = this.states[this.statesMap.set]!.smartName;\n let byOn: string | number | undefined | null;\n if (smartName && typeof smartName === 'object') {\n byOn = smartName.byON;\n }\n // set byOn to the configured value or 100 otherwise\n byOn =\n byOn === undefined || byOn === null || isNaN(byOn as number)\n ? (valuesRange.max as number)\n : parseFloat(byOn as string);\n await AdapterProvider.setState(this._brightness.setId, byOn);\n this._brightness.currentValue = byOn;\n } else {\n // set brightness to 0 on power OFF\n await AdapterProvider.setState(this._brightness.setId, valuesRange.min);\n this._brightness.currentValue = valuesRange.min;\n }\n } else {\n // set power\n const powerValue = value !== valuesRange.min;\n\n // only do this on different IDs for brightness and power\n if (this._brightness.setId !== this._powerState.setId) {\n await AdapterProvider.setState(this._powerState.setId, powerValue);\n }\n this._powerState.currentValue = powerValue;\n }\n }\n\n async getOrRetrieveCurrentValue(property: PropertiesBase): Promise<ioBroker.StateValue> {\n if (property.currentValue === undefined) {\n property.currentValue = await AdapterProvider.getState(property.getId);\n\n const valuesRange = configuredRangeOrDefault(this.states[this.statesMap.set]!);\n // convert non-zero brightness to power = true\n if (property.propertyName === this._powerState.propertyName && property.getId === this._brightness.getId) {\n property.currentValue = property.currentValue !== valuesRange.min;\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 composeInitObject(property: PropertiesBase):\n | {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n }\n | undefined {\n /*\n Device of type 'dimmer' can be switched 'ON'/'OFF' and its brightness can be set to a value between 0 and 100.\n\n If there is no 'ON_SET' state available:\n - switching control 'OFF' is done via setting its brightness to 0\n - switching control 'ON' is done via setting its brightness to the configured 'byOn' value or to the last known brightness.\n */\n\n const map = this.statesMap;\n\n if (property.propertyName === PowerState.propertyName) {\n return {\n setState: this.states[map.on_set] || this.states[map.set]!,\n getState: this.states[map.on_actual] || this.states[map.on_set] || this.states[map.set]!,\n alexaSetter: function (this: PropertiesBase, alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue {\n return alexaValue === PowerState.ON;\n },\n alexaGetter: function (value: ioBroker.StateValue | undefined): AlexaV3DirectiveValue {\n return value ? PowerState.ON : PowerState.OFF;\n },\n };\n }\n\n if (property.propertyName === Brightness.propertyName) {\n return {\n setState: this.states[map.set]!,\n getState: this.states[map.actual]!,\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(\n value as number,\n this.valuesRangeMin as number,\n this.valuesRangeMax as number,\n );\n },\n };\n }\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Gate.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Gate.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AACjD,qEAAwC;AACxC,wDAAgC;AAKhC,MAAqB,IAAK,SAAQ,iBAAO;IACrC,IAAI,UAAU;QACV,OAAO,CAAC,aAAa,CAAC,CAAC;IAC3B,CAAC;IAED,gBAAgB;QACZ,MAAM,MAAM,GAAG,CAAC,IAAI,sBAAY,CAAC,cAAc,EAAE,CAAC,CAAC;QACnD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7D,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,cAAc;QAQV,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAC3B,MAAM,IAAI,GAAG,eAAe,CAAC;QAE7B,OAAO;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAE;YAC/B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAE;YAC/B,WAAW,EAAE,UAAU,UAAU;gBAC7B,OAAO,UAAU,KAAK,GAAG,IAAI,IAAI,oBAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACxD,CAAC;YACD,WAAW,EAAE,UAAU,KAAK;gBACxB,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,oBAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,oBAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACnF,CAAC;YACD,QAAQ,EAAE,IAAI;YACd,cAAc,EAAE,CAAC,IAAI,oBAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,oBAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SACjE,CAAC;IACN,CAAC;CACJ;AArCD,uBAqCC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport Modes from '../Alexa/ModeValues';\nimport Control from './Control';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\nimport type { Base as ModeBase } from '../Alexa/ModeValues/Base';\nimport type { AlexaV3Category, AlexaV3DirectiveValue, IotExternalDetectorState } from '../types';\n\nexport default class Gate extends Control {\n get categories(): AlexaV3Category[] {\n return ['GARAGE_DOOR'];\n }\n\n initCapabilities(): CapabilitiesBase[] {\n const result = [new Capabilities.ModeController()];\n for (const property of result.flatMap(item => item.properties)) {\n property.init(this.modeInitObject());\n }\n return result;\n }\n\n modeInitObject(): {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n instance?: string;\n supportedModes?: ModeBase[];\n } {\n const map = this.statesMap;\n const mode = 'Gate.Position';\n\n return {\n setState: this.states[map.set]!,\n getState: this.states[map.set]!,\n alexaSetter: function (alexaValue) {\n return alexaValue === `${mode}.${Modes.Open.value}`;\n },\n alexaGetter: function (value) {\n return value ? `${mode}.${Modes.Open.value}` : `${mode}.${Modes.Closed.value}`;\n },\n instance: mode,\n supportedModes: [new Modes.Open(mode), new Modes.Closed(mode)],\n };\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Hue.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Hue.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AAIjD,4CAAiH;AACjH,qEAA6C;AAC7C,gFAAwD;AACxD,gFAAwD;AACxD,iFAAyD;AACzD,4EAAoD;AAIpD,sEAA8C;AAC9C,4GAAoF;AAEpF,MAAqB,GAAI,SAAQ,2BAAiB;IACtC,0BAA0B,CAAmB;IAC7C,WAAW,CAAc;IACzB,qBAAqB,CAAwB;IAC7C,WAAW,CAAc;IACzB,2BAA2B,CAA8B;IAEjE,IAAI,UAAU;QACV,OAAO,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED,oBAAoB;QAChB,OAAO,CAAC,oBAAU,CAAC,wBAAwB,CAAC,CAAC;IACjD,CAAC;IAED,gBAAgB;QACZ,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAC3B,MAAM,MAAM,GAAG,CAAC,IAAI,sBAAY,CAAC,eAAe,EAAE,CAAC,CAAC;QAEpD,+CAA+C;QAC/C,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACzD,IAAI,CAAC,qBAAqB,GAAG,IAAI,sBAAY,CAAC,oBAAoB,EAAE,CAAC;YACrE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC;YACzD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC5C,CAAC;QAED,s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,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;wBAC/F,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;oBAC7C,CAAC;oBACD,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;wBACpB,qBAAqB;wBACrB,MAAM,OAAO,GAAG,IAAA,uBAAe,EAC1B,IAAI,CAAC,YAAuB,IAAI,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAC9D,IAAI,CAAC,qBAAqB,CAC7B,CAAC;wBACF,IAAI,KAAK,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;wBAC5D,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;wBAC9B,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;oBAC7C,CAAC;oBAED,OAAO,UAAoB,CAAC;gBAChC,CAAC;gBACD,WAAW,EAAE,UAET,KAAsC;oBAEtC,OAAO,KAAe,CAAC;gBAC3B,CAAC;aACJ,CAAC;QACN,CAAC;IACL,CAAC;CACJ;AAlPD,sBAkPC","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 } from '../types';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\nimport Color from '../Alexa/Properties/Color';\nimport ColorTemperatureInKelvin from '../Alexa/Properties/ColorTemperatureInKelvin';\n\nexport default class Hue extends AdjustableControl {\n private _powerControllerCapability!: PowerController;\n private _powerState!: PowerState;\n private _brightnessCapability!: BrightnessController;\n private _brightness!: Brightness;\n private _colorTemperatureCapability!: ColorTemperatureController;\n\n get categories(): AlexaV3Category[] {\n return ['LIGHT'];\n }\n\n adjustableProperties(): (typeof PropertiesBase)[] {\n return [Properties.ColorTemperatureInKelvin];\n }\n\n initCapabilities(): CapabilitiesBase[] {\n const map = this.statesMap;\n const result = [new Capabilities.ColorController()];\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();\n this._brightness = this._brightnessCapability.brightness;\n result.push(this._brightnessCapability);\n }\n\n // if the state TEMPERATURE configured\n if (this.states[map.temperature]) {\n this._colorTemperatureCapability = new Capabilities.ColorTemperatureController();\n result.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();\n this._powerState = this._powerControllerCapability.powerState;\n result.push(this._powerControllerCapability);\n }\n\n for (const property of result.flatMap(item => item.properties)) {\n const initObj = this.composeInitObject(property);\n if (initObj) {\n property.init(initObj);\n }\n }\n\n return result;\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 await AdapterProvider.setState(this._brightness.setId, byOn);\n this._brightness.currentValue = byOn;\n this._powerState.currentValue = true;\n } else {\n // set brightness to 0 on power OFF\n await AdapterProvider.setState(this._brightness.setId, 0);\n this._brightness.currentValue = 0;\n this._powerState.currentValue = false;\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 composeInitObject(property: PropertiesBase): ControlStateInitObject | undefined {\n const map = this.statesMap;\n\n if (property.propertyName === Properties.PowerState.propertyName) {\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 if (property.propertyName === Brightness.propertyName) {\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(\n value as number,\n this.valuesRangeMin as number,\n this.valuesRangeMax as number,\n );\n },\n };\n }\n\n if (property.propertyName === Properties.Color.propertyName) {\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 if (property.propertyName === Properties.ColorTemperatureInKelvin.propertyName) {\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 =\n 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}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Light.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Light.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AACjD,wDAAgC;AAIhC,MAAqB,KAAM,SAAQ,iBAAO;IACtC,IAAI,UAAU;QACV,OAAO,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED,gBAAgB;QACZ,MAAM,MAAM,GAAG,CAAC,IAAI,sBAAY,CAAC,eAAe,EAAE,CAAC,CAAC;QAEpD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7D,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,wBAAwB;QACpB,MAAM,MAAM,GAAG,CAAC,IAAI,sBAAY,CAAC,oBAAoB,EAAE,CAAC,CAAC;QACzD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7D,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,IAAI,SAAS;QAIT,OAAO;YACH,GAAG,EAAE,KAAK;YACV,MAAM,EAAE,WAAW;SACtB,CAAC;IACN,CAAC;IAED,oBAAoB;QAMhB,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;AArDD,wBAqDC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport Control from './Control';\nimport type { AlexaV3Category, AlexaV3DirectiveValue, IotExternalDetectorState } from '../types';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\n\nexport default class Light extends Control {\n get categories(): AlexaV3Category[] {\n return ['LIGHT'];\n }\n\n initCapabilities(): CapabilitiesBase[] {\n const result = [new Capabilities.PowerController()];\n\n for (const property of result.flatMap(item => item.properties)) {\n property.init(this.powerStateInitObject());\n }\n\n return result;\n }\n\n initEnforcedCapabilities(): CapabilitiesBase[] {\n const result = [new Capabilities.BrightnessController()];\n for (const property of result.flatMap(item => item.properties)) {\n property.init(this.brightnessInitObject());\n }\n\n return result;\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 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"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Lock.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Lock.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AACjD,qEAA6C;AAC7C,wDAAgC;AAIhC,MAAqB,IAAK,SAAQ,iBAAO;IACrC,IAAI,UAAU;QACV,OAAO,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;IAED,gBAAgB;QACZ,MAAM,MAAM,GAAG,CAAC,IAAI,sBAAY,CAAC,cAAc,EAAE,CAAC,CAAC;QACnD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7D,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,mBAAmB;QAMf,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,QAAQ,CAAC,CAAC,CAAC,oBAAU,CAAC,SAAS,CAAC,MAAM,CAAC;YAC/E,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AA/BD,uBA+BC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport Properties from '../Alexa/Properties';\nimport Control from './Control';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\nimport type { AlexaV3Category, AlexaV3DirectiveValue, IotExternalDetectorState } from '../types';\n\nexport default class Lock extends Control {\n get categories(): AlexaV3Category[] {\n return ['SMARTLOCK'];\n }\n\n initCapabilities(): CapabilitiesBase[] {\n const result = [new Capabilities.LockController()];\n for (const property of result.flatMap(item => item.properties)) {\n property.init(this.lockStateInitObject());\n }\n return result;\n }\n\n 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.UNLOCKED : Properties.LockState.LOCKED;\n },\n };\n }\n}\n"]}
@@ -1 +0,0 @@
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,IAAI,UAAU;QACV,OAAO,IAAI,sBAAY,EAAE,CAAC;IAC9B,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7B,CAAC;CACJ;AARD,yBAQC","sourcesContent":["import type { AlexaV3Category } 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 get capability(): CapabilitiesBase | undefined {\n return new MotionSensor();\n }\n\n get categories(): AlexaV3Category[] {\n return ['MOTION_SENSOR'];\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ReadOnlyDetector.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.ts"],"names":[],"mappings":";;;;;AAAA,2EAAmD;AACnD,wDAAgC;AAIhC,MAAqB,gBAAiB,SAAQ,iBAAO;IACjD,IAAI,UAAU;QACV,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,gBAAgB;QACZ,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,UAAW,CAAC,CAAC;QAClC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7D,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,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;AA1BD,mCA0BC","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 class ReadOnlyDetector extends Control {\n get capability(): CapabilitiesBase | undefined {\n return undefined;\n }\n\n initCapabilities(): CapabilitiesBase[] {\n const result = [this.capability!];\n for (const property of result.flatMap(item => item.properties)) {\n property.init(this.detectedStateInitObject());\n }\n return result;\n }\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"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Socket.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Socket.ts"],"names":[],"mappings":";;;;;AACA,4FAAoE;AACpE,wDAAgC;AAGhC,MAAqB,MAAO,SAAQ,iBAAO;IACvC,IAAI,UAAU;QACV,OAAO,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;IAED,gBAAgB;QACZ,MAAM,MAAM,GAAG,CAAC,IAAI,yBAAe,EAAE,CAAC,CAAC;QACvC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7D,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAZD,yBAYC","sourcesContent":["import type { AlexaV3Category } from '../types';\nimport PowerController from '../Alexa/Capabilities/PowerController';\nimport Control from './Control';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\n\nexport default class Socket extends Control {\n get categories(): AlexaV3Category[] {\n return ['SMARTPLUG'];\n }\n\n initCapabilities(): CapabilitiesBase[] {\n const result = [new PowerController()];\n for (const property of result.flatMap(item => item.properties)) {\n property.init(this.powerStateInitObject());\n }\n return result;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Temperature.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Temperature.ts"],"names":[],"mappings":";;;;;AACA,gGAAwE;AACxE,wDAAgC;AAGhC,MAAqB,WAAY,SAAQ,iBAAO;IAC5C,IAAI,UAAU;QACV,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClC,CAAC;IAED,gBAAgB;QACZ,MAAM,MAAM,GAAG,CAAC,IAAI,2BAAiB,EAAE,CAAC,CAAC;QACzC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7D,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAbD,8BAaC","sourcesContent":["import type { AlexaV3Category } from '../types';\nimport TemperatureSensor from '../Alexa/Capabilities/TemperatureSensor';\nimport Control from './Control';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\n\nexport default class Temperature extends Control {\n get categories(): AlexaV3Category[] {\n return ['TEMPERATURE_SENSOR'];\n }\n\n initCapabilities(): CapabilitiesBase[] {\n const result = [new TemperatureSensor()];\n for (const property of result.flatMap(item => item.properties)) {\n property.init(this.blankInitObject());\n }\n\n return result;\n }\n}\n"]}