iobroker.iot 4.0.2 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/README.md +8 -0
  2. package/admin/assets/index-Ck_2gqQY.js +681 -0
  3. package/admin/index_m.html +1 -1
  4. package/admin/rules/assets/{ActionVisu-D9x2f6zu.js → ActionVisu-DE8dgNVF.js} +1 -1
  5. package/admin/rules/assets/{ActionVisu__loadShare__react__loadShare__-Cg21Ef1U.js → ActionVisu__loadShare__react__loadShare__-BKaC-p5K.js} +1 -1
  6. package/admin/rules/assets/{ActionVisu__loadShare__react_mf_2_dom__loadShare__-B1zRWn0u.js → ActionVisu__loadShare__react_mf_2_dom__loadShare__-Bs1o8DtQ.js} +2 -2
  7. package/admin/rules/assets/ActionVisu__mf_v__runtimeInit__mf_v__-DtUoI3FU.js +5 -0
  8. package/admin/rules/assets/bootstrap-Ba57tu25.js +1 -0
  9. package/admin/rules/assets/{hostInit-hos3Txsy.js → hostInit-Dxp6BaAc.js} +2 -2
  10. package/admin/rules/assets/index-208Qrr3S.js +1152 -0
  11. package/admin/rules/assets/{index-Duo7mFlZ.js → index-Bvn52imU.js} +2 -2
  12. package/admin/rules/assets/{index-CAAeiKCc.js → index-DjPMvPni.js} +2 -2
  13. package/admin/rules/assets/preload-helper-BDBacUwf.js +1 -0
  14. package/admin/rules/assets/virtualExposes-O8-92o9I.js +2 -0
  15. package/admin/rules/customRuleBlocks.js +2 -2
  16. package/admin/rules/i18n/de.json +8 -8
  17. package/admin/rules/i18n/es.json +8 -8
  18. package/admin/rules/i18n/fr.json +8 -8
  19. package/admin/rules/i18n/it.json +8 -8
  20. package/admin/rules/i18n/nl.json +8 -8
  21. package/admin/rules/i18n/pl.json +8 -8
  22. package/admin/rules/i18n/pt.json +8 -8
  23. package/admin/rules/i18n/ru.json +8 -8
  24. package/admin/rules/i18n/uk.json +8 -8
  25. package/admin/rules/i18n/zh-cn.json +8 -8
  26. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.js +2 -7
  27. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.js.map +1 -0
  28. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js +6 -5
  29. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js.map +1 -0
  30. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js +3 -2
  31. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js.map +1 -0
  32. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js +4 -3
  33. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js.map +1 -0
  34. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js +3 -2
  35. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js.map +1 -0
  36. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js +3 -2
  37. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js.map +1 -0
  38. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js +4 -3
  39. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js.map +1 -0
  40. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js +3 -2
  41. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js.map +1 -0
  42. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js +3 -2
  43. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js.map +1 -0
  44. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js +6 -5
  45. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js.map +1 -0
  46. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js +5 -4
  47. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js.map +1 -0
  48. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js +3 -2
  49. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js.map +1 -0
  50. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js +5 -4
  51. package/build/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js.map +1 -0
  52. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js +20 -18
  53. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js.map +1 -0
  54. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js +2 -7
  55. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js.map +1 -0
  56. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js +3 -0
  57. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js.map +1 -0
  58. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js +3 -3
  59. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js.map +1 -0
  60. package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js +3 -3
  61. package/build/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js.map +1 -0
  62. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js +0 -3
  63. package/build/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js.map +1 -0
  64. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js +5 -7
  65. package/build/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js.map +1 -0
  66. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/AirCondition.js +64 -69
  67. package/build/lib/AlexaSmartHomeV3/Controls/AirCondition.js.map +1 -0
  68. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/ContactSensor.js +5 -1
  69. package/build/lib/AlexaSmartHomeV3/Controls/ContactSensor.js.map +1 -0
  70. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Control.js +13 -29
  71. package/build/lib/AlexaSmartHomeV3/Controls/Control.js.map +1 -0
  72. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Ct.js +66 -73
  73. package/build/lib/AlexaSmartHomeV3/Controls/Ct.js.map +1 -0
  74. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Dimmer.js +32 -39
  75. package/build/lib/AlexaSmartHomeV3/Controls/Dimmer.js.map +1 -0
  76. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Gate.js +5 -7
  77. package/build/lib/AlexaSmartHomeV3/Controls/Gate.js.map +1 -0
  78. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Hue.js +91 -89
  79. package/build/lib/AlexaSmartHomeV3/Controls/Hue.js.map +1 -0
  80. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Light.js +10 -14
  81. package/build/lib/AlexaSmartHomeV3/Controls/Light.js.map +1 -0
  82. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Lock.js +5 -7
  83. package/build/lib/AlexaSmartHomeV3/Controls/Lock.js.map +1 -0
  84. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Motion.js +5 -1
  85. package/build/lib/AlexaSmartHomeV3/Controls/Motion.js.map +1 -0
  86. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js +0 -10
  87. package/build/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js.map +1 -0
  88. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Socket.js +5 -7
  89. package/build/lib/AlexaSmartHomeV3/Controls/Socket.js.map +1 -0
  90. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Temperature.js +5 -7
  91. package/build/lib/AlexaSmartHomeV3/Controls/Temperature.js.map +1 -0
  92. package/build/lib/AlexaSmartHomeV3/Controls/Thermostat.js +82 -0
  93. package/build/lib/AlexaSmartHomeV3/Controls/Thermostat.js.map +1 -0
  94. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js +5 -7
  95. package/build/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js.map +1 -0
  96. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Volume.js +29 -36
  97. package/build/lib/AlexaSmartHomeV3/Controls/Volume.js.map +1 -0
  98. package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/index.js +6 -6
  99. package/build/lib/AlexaSmartHomeV3/Controls/index.js.map +1 -0
  100. package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/AdapterProvider.js +4 -1
  101. package/build/lib/AlexaSmartHomeV3/Helpers/AdapterProvider.js.map +1 -0
  102. package/{build-backend → build}/lib/alexaCustom.js +71 -60
  103. package/build/lib/alexaCustom.js.map +1 -0
  104. package/{build-backend → build}/lib/alexaSmartHomeV3.js +3 -3
  105. package/build/lib/alexaSmartHomeV3.js.map +1 -0
  106. package/{build-backend → build}/main.js +6 -6
  107. package/build/main.js.map +1 -0
  108. package/io-package.json +30 -29
  109. package/package.json +12 -12
  110. package/admin/assets/index-5zouxn2w.js +0 -680
  111. package/admin/rules/assets/ActionVisu__mf_v__runtimeInit__mf_v__-Cz053nO7.js +0 -10
  112. package/admin/rules/assets/bootstrap-BCFKIiwZ.js +0 -1
  113. package/admin/rules/assets/index-DwYdaT5M.js +0 -1151
  114. package/admin/rules/assets/preload-helper-Dp1pzeXC.js +0 -1
  115. package/admin/rules/assets/virtualExposes-BqVak7rX.js +0 -2
  116. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.js.map +0 -1
  117. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js.map +0 -1
  118. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js.map +0 -1
  119. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js.map +0 -1
  120. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js.map +0 -1
  121. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js.map +0 -1
  122. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js.map +0 -1
  123. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js.map +0 -1
  124. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js.map +0 -1
  125. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js.map +0 -1
  126. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js.map +0 -1
  127. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js.map +0 -1
  128. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js.map +0 -1
  129. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js.map +0 -1
  130. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js.map +0 -1
  131. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js.map +0 -1
  132. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js.map +0 -1
  133. package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js.map +0 -1
  134. package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js.map +0 -1
  135. package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js.map +0 -1
  136. package/build-backend/lib/AlexaSmartHomeV3/Controls/AirCondition.js.map +0 -1
  137. package/build-backend/lib/AlexaSmartHomeV3/Controls/ContactSensor.js.map +0 -1
  138. package/build-backend/lib/AlexaSmartHomeV3/Controls/Control.js.map +0 -1
  139. package/build-backend/lib/AlexaSmartHomeV3/Controls/Ct.js.map +0 -1
  140. package/build-backend/lib/AlexaSmartHomeV3/Controls/Dimmer.js.map +0 -1
  141. package/build-backend/lib/AlexaSmartHomeV3/Controls/Gate.js.map +0 -1
  142. package/build-backend/lib/AlexaSmartHomeV3/Controls/Hue.js.map +0 -1
  143. package/build-backend/lib/AlexaSmartHomeV3/Controls/Light.js.map +0 -1
  144. package/build-backend/lib/AlexaSmartHomeV3/Controls/Lock.js.map +0 -1
  145. package/build-backend/lib/AlexaSmartHomeV3/Controls/Motion.js.map +0 -1
  146. package/build-backend/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js.map +0 -1
  147. package/build-backend/lib/AlexaSmartHomeV3/Controls/Socket.js.map +0 -1
  148. package/build-backend/lib/AlexaSmartHomeV3/Controls/Temperature.js.map +0 -1
  149. package/build-backend/lib/AlexaSmartHomeV3/Controls/Thermostat.js +0 -85
  150. package/build-backend/lib/AlexaSmartHomeV3/Controls/Thermostat.js.map +0 -1
  151. package/build-backend/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js.map +0 -1
  152. package/build-backend/lib/AlexaSmartHomeV3/Controls/Volume.js.map +0 -1
  153. package/build-backend/lib/AlexaSmartHomeV3/Controls/index.js.map +0 -1
  154. package/build-backend/lib/AlexaSmartHomeV3/Helpers/AdapterProvider.js.map +0 -1
  155. package/build-backend/lib/alexaCustom.js.map +0 -1
  156. package/build-backend/lib/alexaSmartHomeV3.js.map +0 -1
  157. package/build-backend/main.js.map +0 -1
  158. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.js +0 -0
  159. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.js.map +0 -0
  160. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js +0 -0
  161. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js.map +0 -0
  162. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js +0 -0
  163. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js.map +0 -0
  164. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/ChangeReport.js +0 -0
  165. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/ChangeReport.js.map +0 -0
  166. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js +0 -0
  167. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js.map +0 -0
  168. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/ReportState.js +0 -0
  169. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/ReportState.js.map +0 -0
  170. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/index.js +0 -0
  171. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Directives/index.js.map +0 -0
  172. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js +0 -0
  173. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js.map +0 -0
  174. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js +0 -0
  175. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js.map +0 -0
  176. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js +0 -0
  177. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js.map +0 -0
  178. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js +0 -0
  179. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js.map +0 -0
  180. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js +0 -0
  181. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js.map +0 -0
  182. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js +0 -0
  183. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js.map +0 -0
  184. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/ColorTemperatureInKelvin.js +0 -0
  185. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/ColorTemperatureInKelvin.js.map +0 -0
  186. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/LockState.js +0 -0
  187. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/LockState.js.map +0 -0
  188. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js +0 -0
  189. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js.map +0 -0
  190. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js +0 -0
  191. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js.map +0 -0
  192. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/PowerState.js +0 -0
  193. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/PowerState.js.map +0 -0
  194. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js +0 -0
  195. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js.map +0 -0
  196. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js +0 -0
  197. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js.map +0 -0
  198. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js +0 -0
  199. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js.map +0 -0
  200. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/index.js +0 -0
  201. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Alexa/Properties/index.js.map +0 -0
  202. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Blind.js +0 -0
  203. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Blind.js.map +0 -0
  204. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Door.js +0 -0
  205. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Door.js.map +0 -0
  206. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Slider.js +0 -0
  207. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Slider.js.map +0 -0
  208. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js +0 -0
  209. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js.map +0 -0
  210. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Window.js +0 -0
  211. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Controls/Window.js.map +0 -0
  212. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Device.js +0 -0
  213. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Device.js.map +0 -0
  214. /package/{build-backend → build}/lib/AlexaSmartHomeV3/DeviceManager.js +0 -0
  215. /package/{build-backend → build}/lib/AlexaSmartHomeV3/DeviceManager.js.map +0 -0
  216. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js +0 -0
  217. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js.map +0 -0
  218. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js +0 -0
  219. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js.map +0 -0
  220. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js +0 -0
  221. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js.map +0 -0
  222. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/FileHelper.js +0 -0
  223. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/FileHelper.js.map +0 -0
  224. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/IotProxy.js +0 -0
  225. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/IotProxy.js.map +0 -0
  226. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/Logger.js +0 -0
  227. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/Logger.js.map +0 -0
  228. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js +0 -0
  229. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js.map +0 -0
  230. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/Utils.js +0 -0
  231. /package/{build-backend → build}/lib/AlexaSmartHomeV3/Helpers/Utils.js.map +0 -0
  232. /package/{build-backend → build}/lib/Utils.js +0 -0
  233. /package/{build-backend → build}/lib/Utils.js.map +0 -0
  234. /package/{build-backend → build}/lib/adminCommonSocket.js +0 -0
  235. /package/{build-backend → build}/lib/adminCommonSocket.js.map +0 -0
  236. /package/{build-backend → build}/lib/alexaSmartHomeV2.js +0 -0
  237. /package/{build-backend → build}/lib/alisa.js +0 -0
  238. /package/{build-backend → build}/lib/devices.js +0 -0
  239. /package/{build-backend → build}/lib/devices.js.map +0 -0
  240. /package/{build-backend → build}/lib/functions.js +0 -0
  241. /package/{build-backend → build}/lib/functions.js.map +0 -0
  242. /package/{build-backend → build}/lib/googleHome.js +0 -0
  243. /package/{build-backend → build}/lib/notifications.js +0 -0
  244. /package/{build-backend → build}/lib/notifications.js.map +0 -0
  245. /package/{build-backend → build}/lib/remote.js +0 -0
  246. /package/{build-backend → build}/lib/remote.js.map +0 -0
  247. /package/{build-backend → build}/lib/rooms.js +0 -0
  248. /package/{build-backend → build}/lib/rooms.js.map +0 -0
  249. /package/{build-backend → build}/lib/texts.js +0 -0
  250. /package/{build-backend → build}/lib/texts.js.map +0 -0
  251. /package/{build-backend → build}/lib/translate.js +0 -0
  252. /package/{build-backend → build}/lib/translate.js.map +0 -0
  253. /package/{build-backend → build}/lib/visuApp.js +0 -0
  254. /package/{build-backend → build}/lib/visuApp.js.map +0 -0
@@ -15,26 +15,20 @@ class Dimmer extends AdjustableControl_1.default {
15
15
  _powerState;
16
16
  _brightnessCapability;
17
17
  _brightness;
18
+ constructor(detectedControl) {
19
+ super(detectedControl);
20
+ this._powerControllerCapability = new PowerController_1.default(this.composeInitObjectPowerState());
21
+ this._powerState = this._powerControllerCapability.powerState;
22
+ this._brightnessCapability = new BrightnessController_1.default(this.composeInitObjectBrightness());
23
+ this._brightness = this._brightnessCapability.brightness;
24
+ this._supported = [this._powerControllerCapability, this._brightnessCapability];
25
+ }
18
26
  get categories() {
19
27
  return ['LIGHT'];
20
28
  }
21
29
  adjustableProperties() {
22
30
  return [Brightness_1.default];
23
31
  }
24
- initCapabilities() {
25
- this._powerControllerCapability = new PowerController_1.default();
26
- this._powerState = this._powerControllerCapability.powerState;
27
- this._brightnessCapability = new BrightnessController_1.default();
28
- this._brightness = this._brightnessCapability.brightness;
29
- const result = [this._powerControllerCapability, this._brightnessCapability];
30
- for (const property of result.flatMap(item => item.properties)) {
31
- const initObj = this.composeInitObject(property);
32
- if (initObj) {
33
- property.init(initObj);
34
- }
35
- }
36
- return result;
37
- }
38
32
  async setState(property, value) {
39
33
  // set the property itself
40
34
  await AdapterProvider_1.default.setState(property.setId, value);
@@ -88,7 +82,20 @@ class Dimmer extends AdjustableControl_1.default {
88
82
  }
89
83
  return property.currentValue;
90
84
  }
91
- composeInitObject(property) {
85
+ composeInitObjectPowerState() {
86
+ const map = this.statesMap;
87
+ return {
88
+ setState: this.states[map.on_set] || this.states[map.set],
89
+ getState: this.states[map.on_actual] || this.states[map.on_set] || this.states[map.set],
90
+ alexaSetter: function (alexaValue) {
91
+ return alexaValue === PowerState_1.default.ON;
92
+ },
93
+ alexaGetter: function (value) {
94
+ return value ? PowerState_1.default.ON : PowerState_1.default.OFF;
95
+ },
96
+ };
97
+ }
98
+ composeInitObjectBrightness() {
92
99
  /*
93
100
  Device of type 'dimmer' can be switched 'ON'/'OFF' and its brightness can be set to a value between 0 and 100.
94
101
 
@@ -97,30 +104,16 @@ class Dimmer extends AdjustableControl_1.default {
97
104
  - switching control 'ON' is done via setting its brightness to the configured 'byOn' value or to the last known brightness.
98
105
  */
99
106
  const map = this.statesMap;
100
- if (property.propertyName === PowerState_1.default.propertyName) {
101
- return {
102
- setState: this.states[map.on_set] || this.states[map.set],
103
- getState: this.states[map.on_actual] || this.states[map.on_set] || this.states[map.set],
104
- alexaSetter: function (alexaValue) {
105
- return alexaValue === PowerState_1.default.ON;
106
- },
107
- alexaGetter: function (value) {
108
- return value ? PowerState_1.default.ON : PowerState_1.default.OFF;
109
- },
110
- };
111
- }
112
- if (property.propertyName === Brightness_1.default.propertyName) {
113
- return {
114
- setState: this.states[map.set],
115
- getState: this.states[map.actual],
116
- alexaSetter: function (alexaValue) {
117
- return ((0, Utils_1.denormalize_0_100)(alexaValue, this.valuesRangeMin, this.valuesRangeMax) ?? 0);
118
- },
119
- alexaGetter: function (value) {
120
- return (0, Utils_1.normalize_0_100)(value, this.valuesRangeMin, this.valuesRangeMax);
121
- },
122
- };
123
- }
107
+ return {
108
+ setState: this.states[map.set],
109
+ getState: this.states[map.actual],
110
+ alexaSetter: function (alexaValue) {
111
+ return ((0, Utils_1.denormalize_0_100)(alexaValue, this.valuesRangeMin, this.valuesRangeMax) ?? 0);
112
+ },
113
+ alexaGetter: function (value) {
114
+ return (0, Utils_1.normalize_0_100)(value, this.valuesRangeMin, this.valuesRangeMax);
115
+ },
116
+ };
124
117
  }
125
118
  }
126
119
  exports.default = D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AC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAE;YACxF,WAAW,EAAE,UAAgC,UAAiC;gBAC1E,OAAO,UAAU,KAAK,oBAAU,CAAC,EAAE,CAAC;YACxC,CAAC;YACD,WAAW,EAAE,UAAU,KAAsC;gBACzD,OAAO,KAAK,CAAC,CAAC,CAAC,oBAAU,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAU,CAAC,GAAG,CAAC;YAClD,CAAC;SACJ,CAAC;IACN,CAAC;IAEO,2BAA2B;QAM/B;;;;;;UAME;QAEF,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,UAAgC,UAAiC;gBAC1E,OAAO,CACH,IAAA,yBAAiB,EACb,UAAoB,EACpB,IAAI,CAAC,cAAwB,EAC7B,IAAI,CAAC,cAAwB,CAChC,IAAI,CAAC,CACT,CAAC;YACN,CAAC;YACD,WAAW,EAAE,UAET,KAAsC;gBAEtC,OAAO,IAAA,uBAAe,EAAC,KAAe,EAAE,IAAI,CAAC,cAAwB,EAAE,IAAI,CAAC,cAAwB,CAAC,CAAC;YAC1G,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AA3ID,yBA2IC","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 {\n AlexaV3Category,\n AlexaV3DirectiveValue,\n IotExternalDetectorState,\n IotExternalPatternControl,\n} from '../types';\nimport type { Base as PropertiesBase } from '../Alexa/Properties/Base';\n\nexport default class Dimmer extends AdjustableControl {\n private readonly _powerControllerCapability: PowerController;\n private readonly _powerState: PowerState;\n private readonly _brightnessCapability: BrightnessController;\n private readonly _brightness: Brightness;\n\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n this._powerControllerCapability = new PowerController(this.composeInitObjectPowerState());\n this._powerState = this._powerControllerCapability.powerState;\n\n this._brightnessCapability = new BrightnessController(this.composeInitObjectBrightness());\n this._brightness = this._brightnessCapability.brightness;\n\n this._supported = [this._powerControllerCapability, this._brightnessCapability];\n }\n\n get categories(): AlexaV3Category[] {\n return ['LIGHT'];\n }\n\n adjustableProperties(): (typeof PropertiesBase)[] {\n return [Brightness];\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 private composeInitObjectPowerState(): {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n } {\n const map = this.statesMap;\n 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 private composeInitObjectBrightness(): {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n } {\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 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"]}
@@ -7,16 +7,14 @@ const Capabilities_1 = __importDefault(require("../Alexa/Capabilities"));
7
7
  const ModeValues_1 = __importDefault(require("../Alexa/ModeValues"));
8
8
  const Control_1 = __importDefault(require("./Control"));
9
9
  class Gate extends Control_1.default {
10
+ constructor(detectedControl) {
11
+ super(detectedControl);
12
+ const modeController = new Capabilities_1.default.ModeController(this.modeInitObject());
13
+ this._supported = [modeController];
14
+ }
10
15
  get categories() {
11
16
  return ['GARAGE_DOOR'];
12
17
  }
13
- initCapabilities() {
14
- const result = [new Capabilities_1.default.ModeController()];
15
- for (const property of result.flatMap(item => item.properties)) {
16
- property.init(this.modeInitObject());
17
- }
18
- return result;
19
- }
20
18
  modeInitObject() {
21
19
  const map = this.statesMap;
22
20
  const mode = 'Gate.Position';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Gate.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Gate.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AACjD,qEAAwC;AACxC,wDAAgC;AAShC,MAAqB,IAAK,SAAQ,iBAAO;IACrC,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QACvB,MAAM,cAAc,GAAG,IAAI,sBAAY,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QAC9E,IAAI,CAAC,UAAU,GAAG,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,aAAa,CAAC,CAAC;IAC3B,CAAC;IAEO,cAAc;QAQlB,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;AAnCD,uBAmCC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport Modes from '../Alexa/ModeValues';\nimport Control from './Control';\nimport type { Base as ModeBase } from '../Alexa/ModeValues/Base';\nimport type {\n AlexaV3Category,\n AlexaV3DirectiveValue,\n IotExternalDetectorState,\n IotExternalPatternControl,\n} from '../types';\n\nexport default class Gate extends Control {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n const modeController = new Capabilities.ModeController(this.modeInitObject());\n this._supported = [modeController];\n }\n\n get categories(): AlexaV3Category[] {\n return ['GARAGE_DOOR'];\n }\n\n private 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"]}
@@ -18,39 +18,33 @@ class Hue extends AdjustableControl_1.default {
18
18
  _brightnessCapability;
19
19
  _brightness;
20
20
  _colorTemperatureCapability;
21
- get categories() {
22
- return ['LIGHT'];
23
- }
24
- adjustableProperties() {
25
- return [Properties_1.default.ColorTemperatureInKelvin];
26
- }
27
- initCapabilities() {
21
+ constructor(detectedControl) {
22
+ super(detectedControl);
28
23
  const map = this.statesMap;
29
- const result = [new Capabilities_1.default.ColorController()];
24
+ this._supported = [new Capabilities_1.default.ColorController(this.composeInitObjectColor())];
30
25
  // if the state DIMMER or BRIGHTNESS configured
31
26
  if (this.states[map.dimmer] || this.states[map.brightness]) {
32
- this._brightnessCapability = new Capabilities_1.default.BrightnessController();
27
+ this._brightnessCapability = new Capabilities_1.default.BrightnessController(this.composeInitObjectBrightness());
33
28
  this._brightness = this._brightnessCapability.brightness;
34
- result.push(this._brightnessCapability);
29
+ this._supported.push(this._brightnessCapability);
35
30
  }
36
31
  // if the state TEMPERATURE configured
37
32
  if (this.states[map.temperature]) {
38
- this._colorTemperatureCapability = new Capabilities_1.default.ColorTemperatureController();
39
- result.push(this._colorTemperatureCapability);
33
+ this._colorTemperatureCapability = new Capabilities_1.default.ColorTemperatureController(this.composeInitObjectColorTemperature());
34
+ this._supported.push(this._colorTemperatureCapability);
40
35
  }
41
36
  // if the state ON, DIMMER or BRIGHTNESS configured
42
37
  if (this.states[map.on] || this._brightness) {
43
- this._powerControllerCapability = new Capabilities_1.default.PowerController();
38
+ this._powerControllerCapability = new Capabilities_1.default.PowerController(this.composeInitObjectPowerState());
44
39
  this._powerState = this._powerControllerCapability.powerState;
45
- result.push(this._powerControllerCapability);
46
- }
47
- for (const property of result.flatMap(item => item.properties)) {
48
- const initObj = this.composeInitObject(property);
49
- if (initObj) {
50
- property.init(initObj);
51
- }
40
+ this._supported.push(this._powerControllerCapability);
52
41
  }
53
- return result;
42
+ }
43
+ get categories() {
44
+ return ['LIGHT'];
45
+ }
46
+ adjustableProperties() {
47
+ return [Properties_1.default.ColorTemperatureInKelvin];
54
48
  }
55
49
  async getOrRetrieveCurrentValue(property) {
56
50
  const map = this.statesMap;
@@ -95,15 +89,23 @@ class Hue extends AdjustableControl_1.default {
95
89
  byOn === null || byOn === undefined || isNaN(byOn)
96
90
  ? range.max
97
91
  : parseFloat(byOn);
98
- await AdapterProvider_1.default.setState(this._brightness.setId, byOn);
99
- this._brightness.currentValue = byOn;
100
- this._powerState.currentValue = true;
92
+ if (this._brightness) {
93
+ await AdapterProvider_1.default.setState(this._brightness.setId, byOn);
94
+ this._brightness.currentValue = byOn;
95
+ }
96
+ if (this._powerState) {
97
+ this._powerState.currentValue = true;
98
+ }
101
99
  }
102
100
  else {
103
- // set brightness to 0 on power OFF
104
- await AdapterProvider_1.default.setState(this._brightness.setId, 0);
105
- this._brightness.currentValue = 0;
106
- this._powerState.currentValue = false;
101
+ if (this._brightness) {
102
+ // set brightness to 0 on power OFF
103
+ await AdapterProvider_1.default.setState(this._brightness.setId, 0);
104
+ this._brightness.currentValue = 0;
105
+ }
106
+ if (this._powerState) {
107
+ this._powerState.currentValue = false;
108
+ }
107
109
  }
108
110
  }
109
111
  }
@@ -140,68 +142,68 @@ class Hue extends AdjustableControl_1.default {
140
142
  await this.setState(property, value);
141
143
  return value;
142
144
  }
143
- composeInitObject(property) {
145
+ composeInitObjectPowerState() {
144
146
  const map = this.statesMap;
145
- if (property.propertyName === Properties_1.default.PowerState.propertyName) {
146
- return {
147
- setState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness],
148
- getState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness],
149
- alexaSetter: function (alexaValue) {
150
- return alexaValue === PowerState_1.default.ON;
151
- },
152
- alexaGetter: function (value) {
153
- return value ? PowerState_1.default.ON : PowerState_1.default.OFF;
154
- },
155
- };
156
- }
157
- if (property.propertyName === Brightness_1.default.propertyName) {
158
- return {
159
- setState: this.states[map.dimmer] || this.states[map.brightness],
160
- getState: this.states[map.dimmer] || this.states[map.brightness],
161
- alexaSetter: function (alexaValue) {
162
- return ((0, Utils_1.denormalize_0_100)(alexaValue, this.valuesRangeMin, this.valuesRangeMax) ?? 0);
163
- },
164
- alexaGetter: function (value) {
165
- return (0, Utils_1.normalize_0_100)(value, this.valuesRangeMin, this.valuesRangeMax);
166
- },
167
- };
168
- }
169
- if (property.propertyName === Properties_1.default.Color.propertyName) {
170
- return {
171
- hal: {
172
- hue: this.states[map.hue].id,
173
- saturation: this.states[map.saturation]?.id,
174
- brightness: (this.states[map.dimmer] || this.states[map.brightness])?.id,
175
- },
176
- };
177
- }
178
- if (property.propertyName === Properties_1.default.ColorTemperatureInKelvin.propertyName) {
179
- return {
180
- setState: this.states[map.temperature],
181
- getState: this.states[map.temperature],
182
- alexaSetter: function (alexaValue) {
183
- if (alexaValue === 1) {
184
- // increase directive
185
- const closest = (0, Utils_1.closestFromList)(this.currentValue || this.colorTemperatureTable[0], this.colorTemperatureTable);
186
- let index = this.colorTemperatureTable.indexOf(closest) + 1;
187
- index =
188
- index >= this.colorTemperatureTable.length ? this.colorTemperatureTable.length - 1 : index;
189
- return this.colorTemperatureTable[index];
190
- }
191
- if (alexaValue === -1) {
192
- // decrease directive
193
- const closest = (0, Utils_1.closestFromList)(this.currentValue || this.colorTemperatureTable[0], this.colorTemperatureTable);
194
- let index = this.colorTemperatureTable.indexOf(closest) - 1;
195
- index = index < 0 ? 0 : index;
196
- return this.colorTemperatureTable[index];
197
- }
198
- return alexaValue;
199
- },
200
- alexaGetter: function (value) {
201
- return value;
202
- },
203
- };
204
- }
147
+ return {
148
+ setState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness],
149
+ getState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness],
150
+ alexaSetter: function (alexaValue) {
151
+ return alexaValue === PowerState_1.default.ON;
152
+ },
153
+ alexaGetter: function (value) {
154
+ return value ? PowerState_1.default.ON : PowerState_1.default.OFF;
155
+ },
156
+ };
157
+ }
158
+ composeInitObjectBrightness() {
159
+ const map = this.statesMap;
160
+ return {
161
+ setState: this.states[map.dimmer] || this.states[map.brightness],
162
+ getState: this.states[map.dimmer] || this.states[map.brightness],
163
+ alexaSetter: function (alexaValue) {
164
+ return ((0, Utils_1.denormalize_0_100)(alexaValue, this.valuesRangeMin, this.valuesRangeMax) ?? 0);
165
+ },
166
+ alexaGetter: function (value) {
167
+ return (0, Utils_1.normalize_0_100)(value, this.valuesRangeMin, this.valuesRangeMax);
168
+ },
169
+ };
170
+ }
171
+ composeInitObjectColor() {
172
+ const map = this.statesMap;
173
+ return {
174
+ hal: {
175
+ hue: this.states[map.hue].id,
176
+ saturation: this.states[map.saturation]?.id,
177
+ brightness: (this.states[map.dimmer] || this.states[map.brightness])?.id,
178
+ },
179
+ };
180
+ }
181
+ composeInitObjectColorTemperature() {
182
+ const map = this.statesMap;
183
+ return {
184
+ setState: this.states[map.temperature],
185
+ getState: this.states[map.temperature],
186
+ alexaSetter: function (alexaValue) {
187
+ if (alexaValue === 1) {
188
+ // increase directive
189
+ const closest = (0, Utils_1.closestFromList)(this.currentValue || this.colorTemperatureTable[0], this.colorTemperatureTable);
190
+ let index = this.colorTemperatureTable.indexOf(closest) + 1;
191
+ index = index >= this.colorTemperatureTable.length ? this.colorTemperatureTable.length - 1 : index;
192
+ return this.colorTemperatureTable[index];
193
+ }
194
+ if (alexaValue === -1) {
195
+ // decrease directive
196
+ const closest = (0, Utils_1.closestFromList)(this.currentValue || this.colorTemperatureTable[0], this.colorTemperatureTable);
197
+ let index = this.colorTemperatureTable.indexOf(closest) - 1;
198
+ index = index < 0 ? 0 : index;
199
+ return this.colorTemperatureTable[index];
200
+ }
201
+ return alexaValue;
202
+ },
203
+ alexaGetter: function (value) {
204
+ return value;
205
+ },
206
+ };
205
207
  }
206
208
  }
207
209
  exports.default = Hue;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hue.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Hue.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AAIjD,4CAAiH;AACjH,qEAA6C;AAC7C,gFAAwD;AACxD,gFAAwD;AACxD,iFAAyD;AACzD,4EAAoD;AAGpD,sEAA8C;AAC9C,4GAAoF;AAEpF,MAAqB,GAAI,SAAQ,2BAAiB;IAC7B,0BAA0B,CAA8B;IACxD,WAAW,CAAyB;IACpC,qBAAqB,CAAmC;IACxD,WAAW,CAAyB;IACpC,2BAA2B,CAAyC;IAErF,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QAEvB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,sBAAY,CAAC,eAAe,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;QAEpF,+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,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,CAAC;YACvG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC;YACzD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACrD,CAAC;QAED,sCAAsC;QACtC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,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AC,KAAK,CAAC,CAAC;gBAC7C,CAAC;gBACD,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;oBACpB,qBAAqB;oBACrB,MAAM,OAAO,GAAG,IAAA,uBAAe,EAC1B,IAAI,CAAC,YAAuB,IAAI,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAC9D,IAAI,CAAC,qBAAqB,CAC7B,CAAC;oBACF,IAAI,KAAK,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;oBAC5D,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;oBAC9B,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAC7C,CAAC;gBAED,OAAO,UAAoB,CAAC;YAChC,CAAC;YACD,WAAW,EAAE,UAET,KAAsC;gBAEtC,OAAO,KAAe,CAAC;YAC3B,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AAjPD,sBAiPC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport type PowerController from '../Alexa/Capabilities/PowerController';\nimport type BrightnessController from '../Alexa/Capabilities/BrightnessController';\nimport type ColorTemperatureController from '../Alexa/Capabilities/ColorTemperatureController';\nimport { configuredRangeOrDefault, denormalize_0_100, normalize_0_100, closestFromList } from '../Helpers/Utils';\nimport Properties from '../Alexa/Properties';\nimport PowerState from '../Alexa/Properties/PowerState';\nimport Brightness from '../Alexa/Properties/Brightness';\nimport AdapterProvider from '../Helpers/AdapterProvider';\nimport AdjustableControl from './AdjustableControl';\nimport type { Base as PropertiesBase, ControlStateInitObject } from '../Alexa/Properties/Base';\nimport type { AlexaV3Category, AlexaV3DirectiveValue, AlexaV3Request, IotExternalPatternControl } from '../types';\nimport Color from '../Alexa/Properties/Color';\nimport ColorTemperatureInKelvin from '../Alexa/Properties/ColorTemperatureInKelvin';\n\nexport default class Hue extends AdjustableControl {\n private readonly _powerControllerCapability: PowerController | undefined;\n private readonly _powerState: PowerState | undefined;\n private readonly _brightnessCapability: BrightnessController | undefined;\n private readonly _brightness: Brightness | undefined;\n private readonly _colorTemperatureCapability: ColorTemperatureController | undefined;\n\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n const map = this.statesMap;\n this._supported = [new Capabilities.ColorController(this.composeInitObjectColor())];\n\n // if the state DIMMER or BRIGHTNESS configured\n if (this.states[map.dimmer] || this.states[map.brightness]) {\n this._brightnessCapability = new Capabilities.BrightnessController(this.composeInitObjectBrightness());\n this._brightness = this._brightnessCapability.brightness;\n this._supported.push(this._brightnessCapability);\n }\n\n // if the state TEMPERATURE configured\n if (this.states[map.temperature]) {\n this._colorTemperatureCapability = new Capabilities.ColorTemperatureController(\n this.composeInitObjectColorTemperature(),\n );\n this._supported.push(this._colorTemperatureCapability);\n }\n\n // if the state ON, DIMMER or BRIGHTNESS configured\n if (this.states[map.on] || this._brightness) {\n this._powerControllerCapability = new Capabilities.PowerController(this.composeInitObjectPowerState());\n this._powerState = this._powerControllerCapability.powerState;\n this._supported.push(this._powerControllerCapability);\n }\n }\n\n get categories(): AlexaV3Category[] {\n return ['LIGHT'];\n }\n\n adjustableProperties(): (typeof PropertiesBase)[] {\n return [Properties.ColorTemperatureInKelvin];\n }\n\n async getOrRetrieveCurrentValue(property: Color): Promise<ioBroker.StateValue> {\n const map = this.statesMap;\n\n if (property.currentValue === undefined) {\n property.currentValue = await AdapterProvider.getState(property.getId);\n // convert the non-zero brightness to power = true\n if (property.propertyName === Properties.PowerState.propertyName && !this.states[map.on]) {\n property.currentValue = property.currentValue !== 0;\n }\n\n if (property.propertyName === Properties.Color.propertyName) {\n // @ts-expect-error special case for Color property\n property.currentValue = {\n hue: property.currentValue,\n saturation: property.hal.saturation,\n brightness: property.hal.brightness,\n };\n }\n }\n\n if (property.currentValue === undefined) {\n throw new Error(`unable to retrieve ${property.getId}`);\n }\n\n return property.currentValue;\n }\n\n async setState(property: PropertiesBase, value: ioBroker.StateValue | undefined): Promise<void> {\n const map = this.statesMap;\n\n if (property.propertyName === PowerState.propertyName) {\n if (this.states[map.on]) {\n await AdapterProvider.setState(property.setId, value ?? false);\n property.currentValue = value;\n } else {\n if (value) {\n // set brightness\n // set byOn to the configured value or range.max otherwise\n const range = configuredRangeOrDefault(this.states[map.dimmer] || this.states[map.brightness]!);\n const smartName = (this.states[map.dimmer] || this.states[map.brightness])?.smartName;\n let byOn: string | number | undefined | null;\n if (smartName && typeof smartName === 'object') {\n byOn = smartName.byON;\n }\n byOn =\n byOn === null || byOn === undefined || isNaN(byOn as number)\n ? (range.max as number)\n : parseFloat(byOn as string);\n if (this._brightness) {\n await AdapterProvider.setState(this._brightness.setId, byOn);\n this._brightness.currentValue = byOn;\n }\n if (this._powerState) {\n this._powerState.currentValue = true;\n }\n } else {\n if (this._brightness) {\n // set brightness to 0 on power OFF\n await AdapterProvider.setState(this._brightness.setId, 0);\n this._brightness.currentValue = 0;\n }\n if (this._powerState) {\n this._powerState.currentValue = false;\n }\n }\n }\n } else if (property.propertyName === Brightness.propertyName) {\n await AdapterProvider.setState(property.setId, value ?? 0);\n property.currentValue = value;\n } else if (property.propertyName === Color.propertyName) {\n const colorProperty = property as Color;\n const hueValue = value as unknown as { hue: number; saturation: number };\n await AdapterProvider.setState(colorProperty.hal.hue, hueValue.hue);\n if (colorProperty.hal.saturation) {\n await AdapterProvider.setState(colorProperty.hal.saturation, hueValue.saturation);\n }\n\n // do not set brightness\n\n // https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-colorcontroller.html\n // Important: For the best user experience, when you make a color change, maintain the current brightness setting of the endpoint.\n // For example, if a light bulb is currently set to white at 0.5 brightness, and a user requests a color change to red,\n // the SetColor directive specifies hue = 0, saturation = 1, and brightness = 1. Here, set the hue to 0, the saturation to 1,\n // and ignore the brightness value of 1 in the directive. Instead, maintain the current brightness value of 0.5.\n\n property.currentValue = value;\n } else if (property.propertyName === ColorTemperatureInKelvin.propertyName) {\n await AdapterProvider.setState(property.setId, value ?? 2200);\n property.currentValue = value;\n }\n }\n\n async adjustValue(event: AlexaV3Request, property: PropertiesBase): Promise<AlexaV3DirectiveValue> {\n // extract Alexa delta value from event\n const delta = property.alexaDirectiveValue(event);\n\n // convert delta to iobroker value\n const value = property.value(delta);\n\n // set iobroker state\n await this.setState(property, value);\n\n return value as AlexaV3DirectiveValue;\n }\n\n private composeInitObjectPowerState(): ControlStateInitObject {\n const map = this.statesMap;\n return {\n setState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness]!,\n getState: this.states[map.on] || this.states[map.dimmer] || this.states[map.brightness]!,\n alexaSetter: function (this: PropertiesBase, alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue {\n return alexaValue === PowerState.ON;\n },\n alexaGetter: function (\n this: PropertiesBase,\n value: ioBroker.StateValue | undefined,\n ): AlexaV3DirectiveValue {\n return value ? PowerState.ON : PowerState.OFF;\n },\n };\n }\n\n private composeInitObjectBrightness(): ControlStateInitObject {\n const map = this.statesMap;\n return {\n setState: this.states[map.dimmer] || this.states[map.brightness]!,\n getState: this.states[map.dimmer] || this.states[map.brightness]!,\n alexaSetter: function (this: PropertiesBase, alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue {\n return (\n denormalize_0_100(\n alexaValue as number,\n this.valuesRangeMin as number,\n this.valuesRangeMax as number,\n ) ?? 0\n );\n },\n alexaGetter: function (\n this: PropertiesBase,\n value: ioBroker.StateValue | undefined,\n ): AlexaV3DirectiveValue {\n return normalize_0_100(value as number, this.valuesRangeMin as number, this.valuesRangeMax as number);\n },\n };\n }\n\n private composeInitObjectColor(): ControlStateInitObject {\n const map = this.statesMap;\n return {\n hal: {\n hue: this.states[map.hue]!.id,\n saturation: this.states[map.saturation]?.id,\n brightness: (this.states[map.dimmer] || this.states[map.brightness])?.id,\n },\n };\n }\n\n private composeInitObjectColorTemperature(): ControlStateInitObject {\n const map = this.statesMap;\n\n return {\n setState: this.states[map.temperature]!,\n getState: this.states[map.temperature]!,\n alexaSetter: function (\n this: ColorTemperatureInKelvin,\n alexaValue: AlexaV3DirectiveValue,\n ): ioBroker.StateValue {\n if (alexaValue === 1) {\n // increase directive\n const closest = closestFromList(\n (this.currentValue as number) || this.colorTemperatureTable[0],\n this.colorTemperatureTable,\n );\n let index = this.colorTemperatureTable.indexOf(closest) + 1;\n index = index >= this.colorTemperatureTable.length ? this.colorTemperatureTable.length - 1 : index;\n return this.colorTemperatureTable[index];\n }\n if (alexaValue === -1) {\n // decrease directive\n const closest = closestFromList(\n (this.currentValue as number) || this.colorTemperatureTable[0],\n this.colorTemperatureTable,\n );\n let index = this.colorTemperatureTable.indexOf(closest) - 1;\n index = index < 0 ? 0 : index;\n return this.colorTemperatureTable[index];\n }\n\n return alexaValue as number;\n },\n alexaGetter: function (\n this: PropertiesBase,\n value: ioBroker.StateValue | undefined,\n ): AlexaV3DirectiveValue {\n return value as number;\n },\n };\n }\n}\n"]}
@@ -6,23 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Capabilities_1 = __importDefault(require("../Alexa/Capabilities"));
7
7
  const Control_1 = __importDefault(require("./Control"));
8
8
  class Light extends Control_1.default {
9
+ constructor(detectedControl) {
10
+ super(detectedControl);
11
+ // We support dimmer as enforced capability to allow setting group commands to dim to 0% and to 100%
12
+ // Init enforced capabilities
13
+ const brightnessController = new Capabilities_1.default.BrightnessController(this.brightnessInitObject());
14
+ this._enforced = [brightnessController];
15
+ // Init capabilities
16
+ const powerController = new Capabilities_1.default.PowerController(this.powerStateInitObject());
17
+ this._supported = [powerController];
18
+ }
9
19
  get categories() {
10
20
  return ['LIGHT'];
11
21
  }
12
- initCapabilities() {
13
- const result = [new Capabilities_1.default.PowerController()];
14
- for (const property of result.flatMap(item => item.properties)) {
15
- property.init(this.powerStateInitObject());
16
- }
17
- return result;
18
- }
19
- initEnforcedCapabilities() {
20
- const result = [new Capabilities_1.default.BrightnessController()];
21
- for (const property of result.flatMap(item => item.properties)) {
22
- property.init(this.brightnessInitObject());
23
- }
24
- return result;
25
- }
26
22
  get statesMap() {
27
23
  return {
28
24
  set: 'SET',
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Light.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Light.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AACjD,wDAAgC;AAQhC,MAAqB,KAAM,SAAQ,iBAAO;IACtC,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QAEvB,oGAAoG;QACpG,6BAA6B;QAC7B,MAAM,oBAAoB,GAAG,IAAI,sBAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAChG,IAAI,CAAC,SAAS,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAExC,oBAAoB;QACpB,MAAM,eAAe,GAAG,IAAI,sBAAY,CAAC,eAAe,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,UAAU,GAAG,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED,IAAI,SAAS;QAIT,OAAO;YACH,GAAG,EAAE,KAAK;YACV,MAAM,EAAE,WAAW;SACtB,CAAC;IACN,CAAC;IAEO,oBAAoB;QAMxB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAE3B,OAAO;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAE;YAC/B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAE;YAClC,WAAW,EAAE,UAAU,UAAiC;gBACpD,OAAQ,UAAqB,GAAG,CAAC,CAAC;YACtC,CAAC;YACD,WAAW,EAAE,UAAU,KAAsC;gBACzD,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AA/CD,wBA+CC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport Control from './Control';\nimport type {\n AlexaV3Category,\n AlexaV3DirectiveValue,\n IotExternalDetectorState,\n IotExternalPatternControl,\n} from '../types';\n\nexport default class Light extends Control {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n // We support dimmer as enforced capability to allow setting group commands to dim to 0% and to 100%\n // Init enforced capabilities\n const brightnessController = new Capabilities.BrightnessController(this.brightnessInitObject());\n this._enforced = [brightnessController];\n\n // Init capabilities\n const powerController = new Capabilities.PowerController(this.powerStateInitObject());\n this._supported = [powerController];\n }\n\n get categories(): AlexaV3Category[] {\n return ['LIGHT'];\n }\n\n get statesMap(): {\n set: string;\n actual: string;\n } {\n return {\n set: 'SET',\n actual: 'ON_ACTUAL',\n };\n }\n\n private brightnessInitObject(): {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n } {\n const map = this.statesMap;\n\n return {\n setState: this.states[map.set]!,\n getState: this.states[map.actual]!,\n alexaSetter: function (alexaValue: AlexaV3DirectiveValue): ioBroker.StateValue | undefined {\n return (alexaValue as number) > 0;\n },\n alexaGetter: function (value: ioBroker.StateValue | undefined): AlexaV3DirectiveValue {\n return value ? 100 : 0;\n },\n };\n }\n}\n"]}
@@ -7,16 +7,14 @@ const Capabilities_1 = __importDefault(require("../Alexa/Capabilities"));
7
7
  const Properties_1 = __importDefault(require("../Alexa/Properties"));
8
8
  const Control_1 = __importDefault(require("./Control"));
9
9
  class Lock extends Control_1.default {
10
+ constructor(detectedControl) {
11
+ super(detectedControl);
12
+ const lockController = new Capabilities_1.default.LockController(this.lockStateInitObject());
13
+ this._supported = [lockController];
14
+ }
10
15
  get categories() {
11
16
  return ['SMARTLOCK'];
12
17
  }
13
- initCapabilities() {
14
- const result = [new Capabilities_1.default.LockController()];
15
- for (const property of result.flatMap(item => item.properties)) {
16
- property.init(this.lockStateInitObject());
17
- }
18
- return result;
19
- }
20
18
  lockStateInitObject() {
21
19
  const map = this.statesMap;
22
20
  return {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Lock.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Lock.ts"],"names":[],"mappings":";;;;;AAAA,yEAAiD;AACjD,qEAA6C;AAC7C,wDAAgC;AAQhC,MAAqB,IAAK,SAAQ,iBAAO;IACrC,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QAEvB,MAAM,cAAc,GAAG,IAAI,sBAAY,CAAC,cAAc,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,UAAU,GAAG,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;IAEO,mBAAmB;QAMvB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAC3B,OAAO;YACH,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAE;YAC/B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAE;YAClC,WAAW,EAAE,UAAU,UAAU;gBAC7B,OAAO,UAAU,KAAK,oBAAU,CAAC,SAAS,CAAC,MAAM,CAAC;YACtD,CAAC;YACD,WAAW,EAAE,UAAU,KAAK;gBACxB,OAAO,KAAK,CAAC,CAAC,CAAC,oBAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAU,CAAC,SAAS,CAAC,MAAM,CAAC;YAC/E,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AA9BD,uBA8BC","sourcesContent":["import Capabilities from '../Alexa/Capabilities';\nimport Properties from '../Alexa/Properties';\nimport Control from './Control';\nimport type {\n AlexaV3Category,\n AlexaV3DirectiveValue,\n IotExternalDetectorState,\n IotExternalPatternControl,\n} from '../types';\n\nexport default class Lock extends Control {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n const lockController = new Capabilities.LockController(this.lockStateInitObject());\n this._supported = [lockController];\n }\n\n get categories(): AlexaV3Category[] {\n return ['SMARTLOCK'];\n }\n\n private lockStateInitObject(): {\n setState: IotExternalDetectorState;\n getState: IotExternalDetectorState;\n alexaSetter?: (alexaValue: AlexaV3DirectiveValue) => ioBroker.StateValue | undefined;\n alexaGetter?: (value: ioBroker.StateValue | undefined) => AlexaV3DirectiveValue;\n } {\n const map = this.statesMap;\n return {\n setState: this.states[map.set]!,\n getState: this.states[map.actual]!,\n alexaSetter: function (alexaValue) {\n return alexaValue === Properties.LockState.UNLOCK;\n },\n alexaGetter: function (value) {\n return value ? Properties.LockState.UNLOCKED : Properties.LockState.LOCKED;\n },\n };\n }\n}\n"]}
@@ -6,8 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const MotionSensor_1 = __importDefault(require("../Alexa/Capabilities/MotionSensor"));
7
7
  const ReadOnlyDetector_1 = __importDefault(require("./ReadOnlyDetector"));
8
8
  class Motion extends ReadOnlyDetector_1.default {
9
+ constructor(detectedControl) {
10
+ super(detectedControl);
11
+ this._supported = [this.capability];
12
+ }
9
13
  get capability() {
10
- return new MotionSensor_1.default();
14
+ return new MotionSensor_1.default(this.detectedStateInitObject());
11
15
  }
12
16
  get categories() {
13
17
  return ['MOTION_SENSOR'];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Motion.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Motion.ts"],"names":[],"mappings":";;;;;AACA,sFAA8D;AAC9D,0EAAkD;AAGlD,MAAqB,MAAO,SAAQ,0BAAgB;IAChD,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,sBAAY,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7B,CAAC;CACJ;AAbD,yBAaC","sourcesContent":["import type { AlexaV3Category, IotExternalPatternControl } from '../types';\nimport MotionSensor from '../Alexa/Capabilities/MotionSensor';\nimport ReadOnlyDetector from './ReadOnlyDetector';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\n\nexport default class Motion extends ReadOnlyDetector {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n this._supported = [this.capability];\n }\n\n get capability(): CapabilitiesBase {\n return new MotionSensor(this.detectedStateInitObject());\n }\n\n get categories(): AlexaV3Category[] {\n return ['MOTION_SENSOR'];\n }\n}\n"]}
@@ -6,16 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const AlexaResponse_1 = __importDefault(require("../Alexa/AlexaResponse"));
7
7
  const Control_1 = __importDefault(require("./Control"));
8
8
  class ReadOnlyDetector extends Control_1.default {
9
- get capability() {
10
- return undefined;
11
- }
12
- initCapabilities() {
13
- const result = [this.capability];
14
- for (const property of result.flatMap(item => item.properties)) {
15
- property.init(this.detectedStateInitObject());
16
- }
17
- return result;
18
- }
19
9
  async handle(event) {
20
10
  this.log.error(`Setting value is not supported by ${this.name} control`);
21
11
  // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadOnlyDetector.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.ts"],"names":[],"mappings":";;;;;AAAA,2EAAmD;AACnD,wDAAgC;AAIhC,MAA8B,gBAAiB,SAAQ,iBAAO;IAG1D,KAAK,CAAC,MAAM,CAAC,KAAqB;QAC9B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,qCAAqC,IAAI,CAAC,IAAI,UAAU,CAAC,CAAC;QAEzE,2EAA2E;QAC3E,OAAO,OAAO,CAAC,MAAM,CACjB,uBAAa,CAAC,8BAA8B,CACxC,IAAI,CAAC,IAAI,EACT,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAChC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAChC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,CACxC,CAAC,GAAG,EAAE,CACV,CAAC;IACN,CAAC;CACJ;AAhBD,mCAgBC","sourcesContent":["import AlexaResponse from '../Alexa/AlexaResponse';\nimport Control from './Control';\nimport type { Base as CapabilitiesBase } from '../Alexa/Capabilities/Base';\nimport type { AlexaV3Request } from '../types';\n\nexport default abstract class ReadOnlyDetector extends Control {\n abstract get capability(): CapabilitiesBase;\n\n async handle(event: AlexaV3Request): Promise<AlexaResponse> {\n this.log.error(`Setting value is not supported by ${this.name} control`);\n\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n return Promise.reject(\n AlexaResponse.directiveNotSupportedByControl(\n this.name,\n event.directive.header.namespace,\n event.directive.header.messageId,\n event.directive.header.payloadVersion,\n ).get(),\n );\n }\n}\n"]}
@@ -6,16 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const PowerController_1 = __importDefault(require("../Alexa/Capabilities/PowerController"));
7
7
  const Control_1 = __importDefault(require("./Control"));
8
8
  class Socket extends Control_1.default {
9
+ constructor(detectedControl) {
10
+ super(detectedControl);
11
+ const powerController = new PowerController_1.default(this.powerStateInitObject());
12
+ this._supported = [powerController];
13
+ }
9
14
  get categories() {
10
15
  return ['SMARTPLUG'];
11
16
  }
12
- initCapabilities() {
13
- const result = [new PowerController_1.default()];
14
- for (const property of result.flatMap(item => item.properties)) {
15
- property.init(this.powerStateInitObject());
16
- }
17
- return result;
18
- }
19
17
  }
20
18
  exports.default = Socket;
21
19
  //# sourceMappingURL=Socket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Socket.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Socket.ts"],"names":[],"mappings":";;;;;AACA,4FAAoE;AACpE,wDAAgC;AAEhC,MAAqB,MAAO,SAAQ,iBAAO;IACvC,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QAEvB,MAAM,eAAe,GAAG,IAAI,yBAAe,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,UAAU,GAAG,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;CACJ;AAXD,yBAWC","sourcesContent":["import type { AlexaV3Category, IotExternalPatternControl } from '../types';\nimport PowerController from '../Alexa/Capabilities/PowerController';\nimport Control from './Control';\n\nexport default class Socket extends Control {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n const powerController = new PowerController(this.powerStateInitObject());\n this._supported = [powerController];\n }\n\n get categories(): AlexaV3Category[] {\n return ['SMARTPLUG'];\n }\n}\n"]}
@@ -6,16 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const TemperatureSensor_1 = __importDefault(require("../Alexa/Capabilities/TemperatureSensor"));
7
7
  const Control_1 = __importDefault(require("./Control"));
8
8
  class Temperature extends Control_1.default {
9
+ constructor(detectedControl) {
10
+ super(detectedControl);
11
+ const temperatureSensor = new TemperatureSensor_1.default(this.blankInitObject());
12
+ this._supported = [temperatureSensor];
13
+ }
9
14
  get categories() {
10
15
  return ['TEMPERATURE_SENSOR'];
11
16
  }
12
- initCapabilities() {
13
- const result = [new TemperatureSensor_1.default()];
14
- for (const property of result.flatMap(item => item.properties)) {
15
- property.init(this.blankInitObject());
16
- }
17
- return result;
18
- }
19
17
  }
20
18
  exports.default = Temperature;
21
19
  //# sourceMappingURL=Temperature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Temperature.js","sourceRoot":"","sources":["../../../../src/lib/AlexaSmartHomeV3/Controls/Temperature.ts"],"names":[],"mappings":";;;;;AACA,gGAAwE;AACxE,wDAAgC;AAEhC,MAAqB,WAAY,SAAQ,iBAAO;IAC5C,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QAEvB,MAAM,iBAAiB,GAAG,IAAI,2BAAiB,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QACxE,IAAI,CAAC,UAAU,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClC,CAAC;CACJ;AAXD,8BAWC","sourcesContent":["import type { AlexaV3Category, IotExternalPatternControl } from '../types';\nimport TemperatureSensor from '../Alexa/Capabilities/TemperatureSensor';\nimport Control from './Control';\n\nexport default class Temperature extends Control {\n constructor(detectedControl: IotExternalPatternControl) {\n super(detectedControl);\n\n const temperatureSensor = new TemperatureSensor(this.blankInitObject());\n this._supported = [temperatureSensor];\n }\n\n get categories(): AlexaV3Category[] {\n return ['TEMPERATURE_SENSOR'];\n }\n}\n"]}