@homebridge-plugins/homebridge-tuya 3.0.0-beta.2 → 3.0.0-beta.21

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 (298) hide show
  1. package/README.md +354 -142
  2. package/config.schema.json +1221 -893
  3. package/dist/cloud/api/TuyaOpenAPI.js +108 -60
  4. package/dist/cloud/api/TuyaOpenAPI.js.map +1 -1
  5. package/dist/cloud/api/TuyaOpenMQ.js +45 -22
  6. package/dist/cloud/api/TuyaOpenMQ.js.map +1 -1
  7. package/dist/cloud/device/{TuyaDeviceManager.js → TuyaCloudDeviceManager.js} +146 -96
  8. package/dist/cloud/device/TuyaCloudDeviceManager.js.map +1 -0
  9. package/dist/cloud/device/TuyaCustomDeviceManager.js +75 -5
  10. package/dist/cloud/device/TuyaCustomDeviceManager.js.map +1 -1
  11. package/dist/cloud/device/TuyaDevice.js.map +1 -1
  12. package/dist/cloud/device/TuyaHomeDeviceManager.js +81 -13
  13. package/dist/cloud/device/TuyaHomeDeviceManager.js.map +1 -1
  14. package/dist/config.js +26 -5
  15. package/dist/config.js.map +1 -1
  16. package/dist/local/DynamicChildDiscovery.js +2 -1
  17. package/dist/local/DynamicChildDiscovery.js.map +1 -1
  18. package/dist/local/LocalDevice.js +16 -3
  19. package/dist/local/LocalDevice.js.map +1 -1
  20. package/dist/local/LocalDeviceManager.js +361 -164
  21. package/dist/local/LocalDeviceManager.js.map +1 -1
  22. package/dist/local/TuyaDiscovery.js +16 -7
  23. package/dist/local/TuyaDiscovery.js.map +1 -1
  24. package/dist/local/ZigbeeGatewayDetection.js +7 -4
  25. package/dist/local/ZigbeeGatewayDetection.js.map +1 -1
  26. package/dist/local/protocol/ProtocolUtilities.js +34 -17
  27. package/dist/local/protocol/ProtocolUtilities.js.map +1 -1
  28. package/dist/local/protocol/ProtocolV31V32.js +4 -2
  29. package/dist/local/protocol/ProtocolV31V32.js.map +1 -1
  30. package/dist/local/protocol/ProtocolV33.js +4 -2
  31. package/dist/local/protocol/ProtocolV33.js.map +1 -1
  32. package/dist/local/protocol/ProtocolV34.js +10 -5
  33. package/dist/local/protocol/ProtocolV34.js.map +1 -1
  34. package/dist/local/protocol/ProtocolV35.js +8 -4
  35. package/dist/local/protocol/ProtocolV35.js.map +1 -1
  36. package/dist/platform.js +253 -493
  37. package/dist/platform.js.map +1 -1
  38. package/dist/settings.js +0 -2
  39. package/dist/settings.js.map +1 -1
  40. package/dist/shared/TuyaDeviceManager.js +147 -0
  41. package/dist/shared/TuyaDeviceManager.js.map +1 -0
  42. package/dist/shared/TuyaHybridDeviceManager.js +215 -0
  43. package/dist/shared/TuyaHybridDeviceManager.js.map +1 -0
  44. package/dist/shared/accessory/AccessoryFactory.js +350 -0
  45. package/dist/shared/accessory/AccessoryFactory.js.map +1 -0
  46. package/dist/shared/{accessories → accessory}/AirConditionerAccessory.js +21 -15
  47. package/dist/shared/accessory/AirConditionerAccessory.js.map +1 -0
  48. package/dist/shared/{accessories → accessory}/AirPurifierAccessory.js.map +1 -1
  49. package/dist/shared/accessory/AirQualitySensorAccessory.js.map +1 -0
  50. package/dist/shared/{accessories → accessory}/BaseAccessory.js +16 -95
  51. package/dist/shared/accessory/BaseAccessory.js.map +1 -0
  52. package/dist/shared/{accessories → accessory}/BlindsAccessory.js.map +1 -1
  53. package/dist/shared/{accessories → accessory}/CameraAccessory.js +2 -2
  54. package/dist/shared/accessory/CameraAccessory.js.map +1 -0
  55. package/dist/shared/{accessories → accessory}/CarbonDioxideSensorAccessory.js.map +1 -1
  56. package/dist/shared/{accessories → accessory}/CarbonMonoxideSensorAccessory.js.map +1 -1
  57. package/dist/shared/{accessories → accessory}/ContactSensorAccessory.js.map +1 -1
  58. package/dist/shared/{accessories → accessory}/DehumidifierAccessory.js.map +1 -1
  59. package/dist/shared/{accessories → accessory}/DiffuserAccessory.js.map +1 -1
  60. package/dist/shared/{accessories → accessory}/DimmerAccessory.js.map +1 -1
  61. package/dist/shared/{accessories → accessory}/DoorbellAccessory.js.map +1 -1
  62. package/dist/shared/{accessories → accessory}/ExtractionHoodAccessory.js.map +1 -1
  63. package/dist/shared/{accessories → accessory}/FanAccessory.js.map +1 -1
  64. package/dist/shared/{accessories → accessory}/GarageDoorAccessory.js +19 -2
  65. package/dist/shared/accessory/GarageDoorAccessory.js.map +1 -0
  66. package/dist/shared/{accessories → accessory}/HeaterAccessory.js.map +1 -1
  67. package/dist/shared/{accessories → accessory}/HeaterAccessory_old.js.map +1 -1
  68. package/dist/shared/accessory/HumanPresenceSensorAccessory.js.map +1 -0
  69. package/dist/shared/{accessories → accessory}/HumidifierAccessory.js.map +1 -1
  70. package/dist/shared/accessory/IRAdapter.js +167 -0
  71. package/dist/shared/accessory/IRAdapter.js.map +1 -0
  72. package/dist/shared/accessory/IRAirConditionerAccessory.js.map +1 -0
  73. package/dist/shared/accessory/IRControlHubAccessory.js.map +1 -0
  74. package/dist/shared/accessory/IRControlHubSubAccessory.js.map +1 -0
  75. package/dist/shared/accessory/IRFanAccessory.js +90 -0
  76. package/dist/shared/accessory/IRFanAccessory.js.map +1 -0
  77. package/dist/shared/accessory/IRGenericAccessory.js.map +1 -0
  78. package/dist/shared/{accessories → accessory}/LeakSensorAccessory.js.map +1 -1
  79. package/dist/shared/{accessories → accessory}/LightAccessory.js.map +1 -1
  80. package/dist/shared/{accessories → accessory}/LightSensorAccessory.js.map +1 -1
  81. package/dist/shared/{accessories → accessory}/LocationWeatherAccessory.js +1 -1
  82. package/dist/shared/accessory/LocationWeatherAccessory.js.map +1 -0
  83. package/dist/shared/{accessories → accessory}/LockAccessory.js +3 -3
  84. package/dist/shared/{accessories → accessory}/LockAccessory.js.map +1 -1
  85. package/dist/shared/accessory/MotionSensorAccessory.js.map +1 -0
  86. package/dist/shared/accessory/OutletAccessory.js.map +1 -0
  87. package/dist/shared/{accessories → accessory}/PetFeederAccessory.js.map +1 -1
  88. package/dist/shared/{accessories → accessory}/SceneAccessory.js +1 -1
  89. package/dist/shared/accessory/SceneAccessory.js.map +1 -0
  90. package/dist/shared/accessory/SceneSwitchAccessory.js.map +1 -0
  91. package/dist/shared/accessory/SecuritySystemAccessory.js.map +1 -0
  92. package/dist/shared/{accessories → accessory}/SmokeSensorAccessory.js.map +1 -1
  93. package/dist/shared/{accessories → accessory}/SwitchAccessory.js +1 -45
  94. package/dist/shared/accessory/SwitchAccessory.js.map +1 -0
  95. package/dist/shared/accessory/TemperatureHumiditySensorAccessory.js.map +1 -0
  96. package/dist/shared/{accessories → accessory}/ThermostatAccessory.js.map +1 -1
  97. package/dist/shared/{accessories → accessory}/TowerRackAccessory.js.map +1 -1
  98. package/dist/shared/{accessories → accessory}/ValveAccessory.js.map +1 -1
  99. package/dist/shared/{accessories → accessory}/VibrationSensorAccessory.js.map +1 -1
  100. package/dist/shared/accessory/WeatherStationAccessory.js.map +1 -0
  101. package/dist/shared/accessory/WetBulbGlobeTemperatureAccessory.js.map +1 -0
  102. package/dist/shared/{accessories → accessory}/WhiteNoiseLightAccessory.js +1 -0
  103. package/dist/shared/accessory/WhiteNoiseLightAccessory.js.map +1 -0
  104. package/dist/shared/accessory/WindowAccessory.js.map +1 -0
  105. package/dist/shared/{accessories → accessory}/WindowCoveringAccessory.js.map +1 -1
  106. package/dist/shared/{accessories → accessory}/WirelessSwitchAccessory.js.map +1 -1
  107. package/dist/shared/accessory/characteristic/Active.js.map +1 -0
  108. package/dist/shared/accessory/characteristic/AirQuality.js.map +1 -0
  109. package/dist/shared/{accessories → accessory}/characteristic/CurrentRelativeHumidity.js +3 -0
  110. package/dist/shared/accessory/characteristic/CurrentRelativeHumidity.js.map +1 -0
  111. package/dist/shared/accessory/characteristic/CurrentTemperature.js.map +1 -0
  112. package/dist/shared/accessory/characteristic/CurrentWeather.js.map +1 -0
  113. package/dist/shared/accessory/characteristic/CurrentWeatherByOpenMeteo.js.map +1 -0
  114. package/dist/shared/{accessories → accessory}/characteristic/CurrentWetBulbGlobeTemperature.js +3 -2
  115. package/dist/shared/accessory/characteristic/CurrentWetBulbGlobeTemperature.js.map +1 -0
  116. package/dist/shared/{accessories → accessory}/characteristic/EnergyUsage.js +0 -5
  117. package/dist/shared/accessory/characteristic/EnergyUsage.js.map +1 -0
  118. package/dist/shared/{accessories → accessory}/characteristic/Light.js +28 -5
  119. package/dist/shared/accessory/characteristic/Light.js.map +1 -0
  120. package/dist/shared/accessory/characteristic/LightSensor.js.map +1 -0
  121. package/dist/shared/{accessories → accessory}/characteristic/LockPhysicalControls.js +3 -0
  122. package/dist/shared/accessory/characteristic/LockPhysicalControls.js.map +1 -0
  123. package/dist/shared/accessory/characteristic/MotionDetected.js.map +1 -0
  124. package/dist/shared/accessory/characteristic/Name.js.map +1 -0
  125. package/dist/shared/accessory/characteristic/OccupancyDetected.js.map +1 -0
  126. package/dist/shared/{accessories → accessory}/characteristic/On.js +1 -0
  127. package/dist/shared/accessory/characteristic/On.js.map +1 -0
  128. package/dist/shared/accessory/characteristic/OutletInUse.js.map +1 -0
  129. package/dist/shared/accessory/characteristic/ProgrammableSwitchEvent.js.map +1 -0
  130. package/dist/shared/{accessories → accessory}/characteristic/RelativeHumidityDehumidifierThreshold.js +3 -0
  131. package/dist/shared/accessory/characteristic/RelativeHumidityDehumidifierThreshold.js.map +1 -0
  132. package/dist/shared/accessory/characteristic/RotationSpeed.js.map +1 -0
  133. package/dist/shared/accessory/characteristic/SecuritySystemState.js.map +1 -0
  134. package/dist/shared/{accessories → accessory}/characteristic/SwingMode.js +3 -0
  135. package/dist/shared/accessory/characteristic/SwingMode.js.map +1 -0
  136. package/dist/shared/accessory/characteristic/TargetTemperature.js.map +1 -0
  137. package/dist/shared/accessory/characteristic/TemperatureDisplayUnits.js.map +1 -0
  138. package/dist/shared/util/ConfigHash.js +2 -2
  139. package/dist/shared/util/ConfigHash.js.map +1 -1
  140. package/dist/shared/util/ConfigMigrator.js +222 -0
  141. package/dist/shared/util/ConfigMigrator.js.map +1 -0
  142. package/dist/shared/util/FfmpegStreamingProcess.js +62 -0
  143. package/dist/shared/util/FfmpegStreamingProcess.js.map +1 -1
  144. package/dist/shared/util/InfraredTool.js +0 -2
  145. package/dist/shared/util/InfraredTool.js.map +1 -1
  146. package/dist/shared/util/Logger.js +85 -10
  147. package/dist/shared/util/Logger.js.map +1 -1
  148. package/dist/shared/util/TuyaStreamDelegate.js +194 -97
  149. package/dist/shared/util/TuyaStreamDelegate.js.map +1 -1
  150. package/dist/shared/util/util.js +59 -4
  151. package/dist/shared/util/util.js.map +1 -1
  152. package/docs/ADVANCED_OPTIONS.md +603 -0
  153. package/docs/CONFIG_GUIDE.md +616 -0
  154. package/docs/Get-Local-Keys-for-Your-Devices.md +246 -0
  155. package/{SUPPORTED_DEVICES.md → docs/SUPPORTED_DEVICES.md} +24 -3
  156. package/eslint.config.mjs +0 -1
  157. package/{jest.config.js → jest.config.ts} +5 -2
  158. package/package.json +12 -9
  159. package/test/ConfigMigrator.test.ts +1060 -0
  160. package/test/Logger.test.ts +482 -0
  161. package/test/accessoryFactory.data.test.ts +172 -0
  162. package/test/accessoryFactory.test.ts +64 -35
  163. package/test/airConditioner.test.ts +742 -0
  164. package/test/config.test.ts +17 -13
  165. package/test/custom.test.ts +2 -2
  166. package/test/errorHandling.test.ts +12 -12
  167. package/test/home.test.ts +1 -1
  168. package/test/hybridDeviceManager.test.ts +808 -0
  169. package/test/light.test.ts +250 -0
  170. package/test/localDevice.test.ts +21 -50
  171. package/test/localDeviceManager.behavior.test.ts +196 -31
  172. package/test/localDeviceManager.test.ts +124 -41
  173. package/test/mqttMessages.test.ts +33 -14
  174. package/test/platform.test.ts +337 -814
  175. package/test/platform.validation.local.test.ts +58 -119
  176. package/test/tuyaCustomDeviceManager.test.ts +106 -16
  177. package/test/tuyaDeviceManager.test.ts +636 -639
  178. package/test/tuyaDiscovery.test.ts +21 -33
  179. package/test/tuyaHomeDeviceManager.test.ts +109 -18
  180. package/test/tuyaOpenAPI.test.ts +25 -44
  181. package/test/tuyaOpenMQ.test.ts +15 -23
  182. package/test/util.test.ts +107 -7
  183. package/test/zigbee/LocalDevice.zigbee.test.ts +14 -18
  184. package/test/zigbee/LocalDeviceManager.cloud-discovery.test.ts +19 -20
  185. package/test/zigbee/LocalDeviceManager.zigbee.reconnect.test.ts +19 -20
  186. package/test/zigbee/LocalDeviceManager.zigbee.test.ts +73 -35
  187. package/test/zigbee/ZigbeeGatewayDetection.test.ts +2 -2
  188. package/ADVANCED_OPTIONS.md +0 -267
  189. package/dist/cloud/device/TuyaDeviceManager.js.map +0 -1
  190. package/dist/local/CloudLocalReconciliation.js +0 -180
  191. package/dist/local/CloudLocalReconciliation.js.map +0 -1
  192. package/dist/shared/AccessoryFactory.js +0 -276
  193. package/dist/shared/AccessoryFactory.js.map +0 -1
  194. package/dist/shared/accessories/AccessoryFactory.js +0 -305
  195. package/dist/shared/accessories/AccessoryFactory.js.map +0 -1
  196. package/dist/shared/accessories/AirConditionerAccessory.js.map +0 -1
  197. package/dist/shared/accessories/AirQualitySensorAccessory.js.map +0 -1
  198. package/dist/shared/accessories/BaseAccessory.js.map +0 -1
  199. package/dist/shared/accessories/CameraAccessory.js.map +0 -1
  200. package/dist/shared/accessories/GarageDoorAccessory.js.map +0 -1
  201. package/dist/shared/accessories/HumanPresenceSensorAccessory.js.map +0 -1
  202. package/dist/shared/accessories/IRAirConditionerAccessory.js.map +0 -1
  203. package/dist/shared/accessories/IRControlHubAccessory.js.map +0 -1
  204. package/dist/shared/accessories/IRControlHubSubAccessory.js.map +0 -1
  205. package/dist/shared/accessories/IRGenericAccessory.js.map +0 -1
  206. package/dist/shared/accessories/LocationWeatherAccessory.js.map +0 -1
  207. package/dist/shared/accessories/MotionSensorAccessory.js.map +0 -1
  208. package/dist/shared/accessories/OutletAccessory.js.map +0 -1
  209. package/dist/shared/accessories/SceneAccessory.js.map +0 -1
  210. package/dist/shared/accessories/SceneSwitchAccessory.js.map +0 -1
  211. package/dist/shared/accessories/SecuritySystemAccessory.js.map +0 -1
  212. package/dist/shared/accessories/SwitchAccessory.js.map +0 -1
  213. package/dist/shared/accessories/TemperatureHumiditySensorAccessory.js.map +0 -1
  214. package/dist/shared/accessories/WeatherStationAccessory.js.map +0 -1
  215. package/dist/shared/accessories/WetBulbGlobeTemperatureAccessory.js.map +0 -1
  216. package/dist/shared/accessories/WhiteNoiseLightAccessory.js.map +0 -1
  217. package/dist/shared/accessories/WindowAccessory.js.map +0 -1
  218. package/dist/shared/accessories/characteristic/Active.js.map +0 -1
  219. package/dist/shared/accessories/characteristic/AirQuality.js.map +0 -1
  220. package/dist/shared/accessories/characteristic/CurrentRelativeHumidity.js.map +0 -1
  221. package/dist/shared/accessories/characteristic/CurrentTemperature.js.map +0 -1
  222. package/dist/shared/accessories/characteristic/CurrentWeather.js.map +0 -1
  223. package/dist/shared/accessories/characteristic/CurrentWeatherByOpenMeteo.js.map +0 -1
  224. package/dist/shared/accessories/characteristic/CurrentWetBulbGlobeTemperature.js.map +0 -1
  225. package/dist/shared/accessories/characteristic/EnergyUsage.js.map +0 -1
  226. package/dist/shared/accessories/characteristic/Light.js.map +0 -1
  227. package/dist/shared/accessories/characteristic/LightSensor.js.map +0 -1
  228. package/dist/shared/accessories/characteristic/LockPhysicalControls.js.map +0 -1
  229. package/dist/shared/accessories/characteristic/MotionDetected.js.map +0 -1
  230. package/dist/shared/accessories/characteristic/Name.js.map +0 -1
  231. package/dist/shared/accessories/characteristic/OccupancyDetected.js.map +0 -1
  232. package/dist/shared/accessories/characteristic/On.js.map +0 -1
  233. package/dist/shared/accessories/characteristic/OutletInUse.js.map +0 -1
  234. package/dist/shared/accessories/characteristic/ProgrammableSwitchEvent.js.map +0 -1
  235. package/dist/shared/accessories/characteristic/RelativeHumidityDehumidifierThreshold.js.map +0 -1
  236. package/dist/shared/accessories/characteristic/RotationSpeed.js.map +0 -1
  237. package/dist/shared/accessories/characteristic/SecuritySystemState.js.map +0 -1
  238. package/dist/shared/accessories/characteristic/SwingMode.js.map +0 -1
  239. package/dist/shared/accessories/characteristic/TargetTemperature.js.map +0 -1
  240. package/dist/shared/accessories/characteristic/TemperatureDisplayUnits.js.map +0 -1
  241. package/test/zigbee/CloudLocalReconciliation.test.ts +0 -284
  242. package/tuya-local-configs/dev-1.hash +0 -1
  243. package/tuya-local-configs/device1.hash +0 -1
  244. package/wiki/Get-Local-Keys-for-Your-Devices.md +0 -85
  245. /package/dist/shared/{accessories → accessory}/AirPurifierAccessory.js +0 -0
  246. /package/dist/shared/{accessories → accessory}/AirQualitySensorAccessory.js +0 -0
  247. /package/dist/shared/{accessories → accessory}/BlindsAccessory.js +0 -0
  248. /package/dist/shared/{accessories → accessory}/CarbonDioxideSensorAccessory.js +0 -0
  249. /package/dist/shared/{accessories → accessory}/CarbonMonoxideSensorAccessory.js +0 -0
  250. /package/dist/shared/{accessories → accessory}/ContactSensorAccessory.js +0 -0
  251. /package/dist/shared/{accessories → accessory}/DehumidifierAccessory.js +0 -0
  252. /package/dist/shared/{accessories → accessory}/DiffuserAccessory.js +0 -0
  253. /package/dist/shared/{accessories → accessory}/DimmerAccessory.js +0 -0
  254. /package/dist/shared/{accessories → accessory}/DoorbellAccessory.js +0 -0
  255. /package/dist/shared/{accessories → accessory}/ExtractionHoodAccessory.js +0 -0
  256. /package/dist/shared/{accessories → accessory}/FanAccessory.js +0 -0
  257. /package/dist/shared/{accessories → accessory}/HeaterAccessory.js +0 -0
  258. /package/dist/shared/{accessories → accessory}/HeaterAccessory_old.js +0 -0
  259. /package/dist/shared/{accessories → accessory}/HumanPresenceSensorAccessory.js +0 -0
  260. /package/dist/shared/{accessories → accessory}/HumidifierAccessory.js +0 -0
  261. /package/dist/shared/{accessories → accessory}/IRAirConditionerAccessory.js +0 -0
  262. /package/dist/shared/{accessories → accessory}/IRControlHubAccessory.js +0 -0
  263. /package/dist/shared/{accessories → accessory}/IRControlHubSubAccessory.js +0 -0
  264. /package/dist/shared/{accessories → accessory}/IRGenericAccessory.js +0 -0
  265. /package/dist/shared/{accessories → accessory}/LeakSensorAccessory.js +0 -0
  266. /package/dist/shared/{accessories → accessory}/LightAccessory.js +0 -0
  267. /package/dist/shared/{accessories → accessory}/LightSensorAccessory.js +0 -0
  268. /package/dist/shared/{accessories → accessory}/MotionSensorAccessory.js +0 -0
  269. /package/dist/shared/{accessories → accessory}/OutletAccessory.js +0 -0
  270. /package/dist/shared/{accessories → accessory}/PetFeederAccessory.js +0 -0
  271. /package/dist/shared/{accessories → accessory}/SceneSwitchAccessory.js +0 -0
  272. /package/dist/shared/{accessories → accessory}/SecuritySystemAccessory.js +0 -0
  273. /package/dist/shared/{accessories → accessory}/SmokeSensorAccessory.js +0 -0
  274. /package/dist/shared/{accessories → accessory}/TemperatureHumiditySensorAccessory.js +0 -0
  275. /package/dist/shared/{accessories → accessory}/ThermostatAccessory.js +0 -0
  276. /package/dist/shared/{accessories → accessory}/TowerRackAccessory.js +0 -0
  277. /package/dist/shared/{accessories → accessory}/ValveAccessory.js +0 -0
  278. /package/dist/shared/{accessories → accessory}/VibrationSensorAccessory.js +0 -0
  279. /package/dist/shared/{accessories → accessory}/WeatherStationAccessory.js +0 -0
  280. /package/dist/shared/{accessories → accessory}/WetBulbGlobeTemperatureAccessory.js +0 -0
  281. /package/dist/shared/{accessories → accessory}/WindowAccessory.js +0 -0
  282. /package/dist/shared/{accessories → accessory}/WindowCoveringAccessory.js +0 -0
  283. /package/dist/shared/{accessories → accessory}/WirelessSwitchAccessory.js +0 -0
  284. /package/dist/shared/{accessories → accessory}/characteristic/Active.js +0 -0
  285. /package/dist/shared/{accessories → accessory}/characteristic/AirQuality.js +0 -0
  286. /package/dist/shared/{accessories → accessory}/characteristic/CurrentTemperature.js +0 -0
  287. /package/dist/shared/{accessories → accessory}/characteristic/CurrentWeather.js +0 -0
  288. /package/dist/shared/{accessories → accessory}/characteristic/CurrentWeatherByOpenMeteo.js +0 -0
  289. /package/dist/shared/{accessories → accessory}/characteristic/LightSensor.js +0 -0
  290. /package/dist/shared/{accessories → accessory}/characteristic/MotionDetected.js +0 -0
  291. /package/dist/shared/{accessories → accessory}/characteristic/Name.js +0 -0
  292. /package/dist/shared/{accessories → accessory}/characteristic/OccupancyDetected.js +0 -0
  293. /package/dist/shared/{accessories → accessory}/characteristic/OutletInUse.js +0 -0
  294. /package/dist/shared/{accessories → accessory}/characteristic/ProgrammableSwitchEvent.js +0 -0
  295. /package/dist/shared/{accessories → accessory}/characteristic/RotationSpeed.js +0 -0
  296. /package/dist/shared/{accessories → accessory}/characteristic/SecuritySystemState.js +0 -0
  297. /package/dist/shared/{accessories → accessory}/characteristic/TargetTemperature.js +0 -0
  298. /package/dist/shared/{accessories → accessory}/characteristic/TemperatureDisplayUnits.js +0 -0
@@ -0,0 +1,250 @@
1
+ import { beforeEach, describe, expect, jest, test } from '@jest/globals';
2
+ import Logger, { initLogger } from '../src/shared/util/Logger';
3
+ import { configureLight } from '../src/shared/accessory/characteristic/Light';
4
+ import { TuyaDeviceSchemaType } from '../src/cloud/device/TuyaDevice';
5
+
6
+ // Mock Logger
7
+ const mockLogger: Logger = {
8
+ debug: jest.fn(),
9
+ info: jest.fn(),
10
+ warn: jest.fn(),
11
+ error: jest.fn(),
12
+ log: jest.fn(),
13
+ } as unknown as Logger;
14
+
15
+ describe('Light Characteristic', () => {
16
+ let accessoryMock = {
17
+ getService: jest.fn(),
18
+ addService: jest.fn(),
19
+ removeService: jest.fn(),
20
+ log: mockLogger,
21
+ deviceManager: {
22
+ getDevice: jest.fn(),
23
+ enableAdaptiveLighting: jest.fn(),
24
+ },
25
+ Characteristic: {
26
+ On: jest.fn(),
27
+ Brightness: jest.fn(),
28
+ ColorTemperature: jest.fn(),
29
+ Hue: jest.fn(),
30
+ Saturation: jest.fn(),
31
+ },
32
+ Service: {
33
+ Lightbulb: jest.fn(),
34
+ Switch: jest.fn(),
35
+ },
36
+ } as unknown as any;
37
+ let serviceMock = {
38
+ getCharacteristic: jest.fn().mockReturnValue({
39
+ onGet: jest.fn().mockReturnThis(),
40
+ onSet: jest.fn().mockReturnThis(),
41
+ setProps: jest.fn(),
42
+ }),
43
+ } as unknown as any;
44
+
45
+ beforeEach(() => {
46
+ jest.resetModules();
47
+ initLogger(mockLogger);
48
+ });
49
+
50
+ describe('ensureHSVProperty', () => {
51
+ let spyLogDebug = jest.spyOn(mockLogger, 'debug').mockImplementation(() => {});
52
+
53
+ beforeEach(() => {
54
+ jest.resetModules();
55
+ spyLogDebug.mockClear();
56
+ });
57
+
58
+ test('color schema with defined property', () => {
59
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
60
+ const brightSchema = { code: 'bright', type: TuyaDeviceSchemaType.Integer } as any;
61
+ const tempSchema = { code: 'temp', type: TuyaDeviceSchemaType.Integer } as any;
62
+ const colorSchema = {
63
+ code: 'color',
64
+ type: TuyaDeviceSchemaType.Json,
65
+ property: {
66
+ h: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 360, scale: 0 },
67
+ s: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
68
+ v: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
69
+ },
70
+ } as any;
71
+ const modeSchema = { code: 'mode', type: TuyaDeviceSchemaType.Enum, property: { range: ['colour', 'white'] } } as any;
72
+
73
+ configureLight(accessoryMock, serviceMock, onSchema, brightSchema, tempSchema, colorSchema, modeSchema);
74
+ expect(spyLogDebug).toHaveBeenCalledWith('hsvProperty: %O', colorSchema.property);
75
+ });
76
+
77
+ test('color schema without defined property but mode includes colour', () => {
78
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
79
+ const brightSchema = { code: 'bright', type: TuyaDeviceSchemaType.Integer } as any;
80
+ const tempSchema = { code: 'temp', type: TuyaDeviceSchemaType.Integer } as any;
81
+ const colorSchema = { code: 'color', type: TuyaDeviceSchemaType.Json } as any; // No property
82
+ const modeSchema = { code: 'mode', type: TuyaDeviceSchemaType.Enum, property: { range: ['colour', 'white'] } } as any;
83
+
84
+ configureLight(accessoryMock, serviceMock, onSchema, brightSchema, tempSchema, colorSchema, modeSchema);
85
+ expect(spyLogDebug).toHaveBeenCalledWith('hsvProperty: %O', {
86
+ h: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 360, scale: 0 },
87
+ s: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
88
+ v: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
89
+ });
90
+ expect(colorSchema.property).toEqual({
91
+ h: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 360, scale: 0 },
92
+ s: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
93
+ v: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
94
+ });
95
+ });
96
+
97
+ test('color schema without defined property and mode does not include colour', () => {
98
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
99
+ const brightSchema = { code: 'bright', type: TuyaDeviceSchemaType.Integer } as any;
100
+ const tempSchema = { code: 'temp', type: TuyaDeviceSchemaType.Integer } as any;
101
+ const colorSchema = { code: 'color', type: TuyaDeviceSchemaType.Json } as any; // No property
102
+ const modeSchema = { code: 'mode', type: TuyaDeviceSchemaType.Enum, property: { range: ['white'] } } as any;
103
+
104
+ configureLight(accessoryMock, serviceMock, onSchema, brightSchema, tempSchema, colorSchema, modeSchema);
105
+ expect(spyLogDebug).toHaveBeenCalledWith('hsvProperty: %O', {});
106
+ expect(colorSchema.property).toBeUndefined();
107
+ });
108
+
109
+ test('color schema with non JSON type but with defined property includes colour', () => {
110
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
111
+ const brightSchema = { code: 'bright', type: TuyaDeviceSchemaType.Integer } as any;
112
+ const tempSchema = { code: 'temp', type: TuyaDeviceSchemaType.Integer } as any;
113
+ const colorSchema = {
114
+ code: 'color',
115
+ type: 'unsupported',
116
+ property: {
117
+ h: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 360, scale: 0 },
118
+ s: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
119
+ v: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
120
+ },
121
+ } as any;
122
+ const modeSchema = { code: 'mode', type: TuyaDeviceSchemaType.Enum, property: { range: ['colour', 'white'] } } as any;
123
+
124
+ configureLight(accessoryMock, serviceMock, onSchema, brightSchema, tempSchema, colorSchema, modeSchema);
125
+ expect(spyLogDebug).toHaveBeenCalledWith('hsvProperty: %O', colorSchema.property);
126
+ });
127
+ });
128
+
129
+ describe('getLightType', () => {
130
+ let spyLogInfo = jest.spyOn(mockLogger, 'info').mockImplementation(() => {});
131
+
132
+ beforeEach(() => {
133
+ jest.resetModules();
134
+ spyLogInfo.mockClear();
135
+ });
136
+
137
+ test('Unknown light type when no schemas are provided', () => {
138
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
139
+ const tempSchema = { code: 'temp', type: TuyaDeviceSchemaType.Integer } as any;
140
+ configureLight(accessoryMock, serviceMock, onSchema, undefined, tempSchema);
141
+ expect(spyLogInfo).toHaveBeenCalledWith('Light type: %s', 'Unknown');
142
+ });
143
+
144
+ test('Normal light type when only on schema is provided', () => {
145
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
146
+
147
+ configureLight(accessoryMock, serviceMock, onSchema);
148
+ expect(spyLogInfo).toHaveBeenCalledWith('Light type: %s', 'Normal');
149
+ });
150
+
151
+ test('CW light type when on and temp schemas are provided', () => {
152
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
153
+ const brightSchema = { code: 'bright', type: TuyaDeviceSchemaType.Integer } as any;
154
+ const tempSchema = { code: 'temp', type: TuyaDeviceSchemaType.Integer } as any;
155
+
156
+ configureLight(accessoryMock, serviceMock, onSchema, brightSchema, tempSchema);
157
+ expect(spyLogInfo).toHaveBeenCalledWith('Light type: %s', 'CW');
158
+ });
159
+
160
+ test('RGB light type when on and color schemas are provided', () => {
161
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
162
+ const colorSchema = {
163
+ code: 'color',
164
+ type: TuyaDeviceSchemaType.Json,
165
+ property: {
166
+ h: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 360, scale: 0 },
167
+ s: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
168
+ v: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
169
+ },
170
+ } as any;
171
+
172
+ configureLight(accessoryMock, serviceMock, onSchema, undefined, undefined, colorSchema);
173
+ expect(spyLogInfo).toHaveBeenCalledWith('Light type: %s', 'RGB');
174
+ });
175
+
176
+ test('RGBC light type when on, color, and mode schemas are provided with mode including colour', () => {
177
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
178
+ const brightSchema = { code: 'bright', type: TuyaDeviceSchemaType.Integer } as any;
179
+ const colorSchema = {
180
+ code: 'color',
181
+ type: TuyaDeviceSchemaType.Json,
182
+ property: {
183
+ h: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 360, scale: 0 },
184
+ s: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
185
+ v: { type: TuyaDeviceSchemaType.Integer, min: 0, max: 1000, scale: 0 },
186
+ },
187
+ } as any;
188
+ const modeSchema = { code: 'mode', type: TuyaDeviceSchemaType.Enum, property: { range: ['colour', 'white'] } } as any;
189
+
190
+ configureLight(accessoryMock, serviceMock, onSchema, brightSchema, undefined, colorSchema, modeSchema);
191
+ expect(spyLogInfo).toHaveBeenCalledWith('Light type: %s', 'RGBC');
192
+ });
193
+
194
+ test('RGBCW light type', () => {
195
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
196
+ const brightSchema = { code: 'bright', type: TuyaDeviceSchemaType.Integer } as any;
197
+ const tempSchema = { code: 'temp', type: TuyaDeviceSchemaType.Integer } as any;
198
+ const colorSchema = { code: 'color', type: TuyaDeviceSchemaType.Json, property: { h: {}, s: {}, v: {} } } as any;
199
+ const modeSchema = { code: 'mode', type: TuyaDeviceSchemaType.Enum, property: { range: ['colour', 'white'] } } as any;
200
+
201
+ configureLight(accessoryMock, serviceMock, onSchema, brightSchema, tempSchema, colorSchema, modeSchema);
202
+ expect(spyLogInfo).toHaveBeenCalledWith('Light type: %s', 'RGBCW');
203
+ });
204
+
205
+ test('RGBCW light type with JSON color schema without property but mode includes colour', () => {
206
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
207
+ const brightSchema = { code: 'bright', type: TuyaDeviceSchemaType.Integer } as any;
208
+ const tempSchema = { code: 'temp', type: TuyaDeviceSchemaType.Integer } as any;
209
+ const colorSchema = { code: 'color', type: TuyaDeviceSchemaType.Json } as any; // No property
210
+ const modeSchema = { code: 'mode', type: TuyaDeviceSchemaType.Enum, property: { range: ['colour', 'white'] } } as any;
211
+
212
+ configureLight(accessoryMock, serviceMock, onSchema, brightSchema, tempSchema, colorSchema, modeSchema);
213
+ expect(spyLogInfo).toHaveBeenCalledWith('Light type: %s', 'RGBCW');
214
+ });
215
+
216
+ test('RGBCW light type with JSON color schema without property and mode does not include colour', () => {
217
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
218
+ const brightSchema = { code: 'bright', type: TuyaDeviceSchemaType.Integer } as any;
219
+ const tempSchema = { code: 'temp', type: TuyaDeviceSchemaType.Integer } as any;
220
+ const colorSchema = { code: 'color', type: TuyaDeviceSchemaType.Json } as any; // No property
221
+ const modeSchema = { code: 'mode', type: TuyaDeviceSchemaType.Enum, property: { range: ['white'] } } as any;
222
+
223
+ configureLight(accessoryMock, serviceMock, onSchema, brightSchema, tempSchema, colorSchema, modeSchema);
224
+ expect(spyLogInfo).toHaveBeenCalledWith('Light type: %s', 'CW');
225
+ });
226
+
227
+ test('RGBCW light type with non JSON color schema', () => {
228
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
229
+ const brightSchema = { code: 'bright', type: TuyaDeviceSchemaType.Integer } as any;
230
+ const tempSchema = { code: 'temp', type: TuyaDeviceSchemaType.Integer } as any;
231
+ const colorSchema = { code: 'color', type: 'unsupported' } as any; // Unsupported type
232
+ const modeSchema = { code: 'mode', type: TuyaDeviceSchemaType.Enum, property: { range: ['colour', 'white'] } } as any;
233
+
234
+ configureLight(accessoryMock, serviceMock, onSchema, brightSchema, tempSchema, colorSchema, modeSchema);
235
+ expect(spyLogInfo).toHaveBeenCalledWith('Light type: %s', 'CW');
236
+ });
237
+
238
+ test('RGBCW light type with non JSON with property color schema', () => {
239
+ const onSchema = { code: 'on', type: TuyaDeviceSchemaType.Boolean } as any;
240
+ const brightSchema = { code: 'bright', type: TuyaDeviceSchemaType.Integer } as any;
241
+ const tempSchema = { code: 'temp', type: TuyaDeviceSchemaType.Integer } as any;
242
+ const colorSchema = { code: 'color', type: 'unsupported', property: { h: {}, s: {}, v: {} } } as any; // Unsupported type but has property
243
+ const modeSchema = { code: 'mode', type: TuyaDeviceSchemaType.Enum, property: { range: ['colour', 'white'] } } as any;
244
+
245
+ configureLight(accessoryMock, serviceMock, onSchema, brightSchema, tempSchema, colorSchema, modeSchema);
246
+ expect(spyLogInfo).toHaveBeenCalledWith('Light type: %s', 'RGBCW');
247
+ });
248
+
249
+ });
250
+ });
@@ -3,37 +3,7 @@
3
3
  import { describe, expect, test, beforeEach, afterEach, jest } from '@jest/globals';
4
4
  import EventEmitter from 'events';
5
5
  import LocalDevice, { LocalDeviceContext } from '../src/local/LocalDevice';
6
-
7
- // Mock Logger
8
- jest.mock('../src/shared/util/Logger', () => ({
9
- __esModule: true,
10
- default: class Logger {
11
- log() {}
12
- info() {}
13
- warn() {}
14
- error() {}
15
- debug() {}
16
- },
17
- PrefixLogger: class PrefixLogger {
18
- constructor(public log: any, public prefix: string, public debugMode: boolean) {}
19
- debug(message?: any, ...args: any[]) {
20
- if (this.debugMode) {
21
- this.log.info((this.prefix ? `[${this.prefix}] ` : '') + message, ...args);
22
- } else {
23
- this.log.debug((this.prefix ? `[${this.prefix}] ` : '') + message, ...args);
24
- }
25
- }
26
- info(message?: any, ...args: any[]) {
27
- this.log.info((this.prefix ? `[${this.prefix}] ` : '') + message, ...args);
28
- }
29
- warn(message?: any, ...args: any[]) {
30
- this.log.warn((this.prefix ? `[${this.prefix}] ` : '') + message, ...args);
31
- }
32
- error(message?: any, ...args: any[]) {
33
- this.log.error((this.prefix ? `[${this.prefix}] ` : '') + message, ...args);
34
- }
35
- },
36
- }));
6
+ import { initLogger } from '../src/shared/util/Logger';
37
7
 
38
8
  // Mock Protocol
39
9
  const mockProtocol = {
@@ -71,6 +41,7 @@ describe('LocalDevice', () => {
71
41
  error: jest.fn(),
72
42
  debug: jest.fn(),
73
43
  };
44
+ initLogger(mockLogger);
74
45
 
75
46
  context = {
76
47
  id: 'device_001',
@@ -89,7 +60,7 @@ describe('LocalDevice', () => {
89
60
  mockSocket.destroy = jest.fn();
90
61
  mockSocket.removeAllListeners = jest.fn();
91
62
 
92
- device = new LocalDevice(context, mockLogger);
63
+ device = new LocalDevice(context);
93
64
  });
94
65
 
95
66
  afterEach(() => {
@@ -107,7 +78,7 @@ describe('LocalDevice', () => {
107
78
 
108
79
  test('sets default port if not provided', () => {
109
80
  const contextNoPort = { ...context, port: undefined };
110
- const dev = new LocalDevice(contextNoPort, mockLogger);
81
+ const dev = new LocalDevice(contextNoPort);
111
82
 
112
83
  expect(dev).toBeDefined();
113
84
  expect(dev.connected).toBe(false);
@@ -115,14 +86,14 @@ describe('LocalDevice', () => {
115
86
 
116
87
  test('sets default pingGap if not provided', () => {
117
88
  const contextNoPingGap = { ...context, pingGap: undefined };
118
- const dev = new LocalDevice(contextNoPingGap, mockLogger);
89
+ const dev = new LocalDevice(contextNoPingGap);
119
90
 
120
91
  expect(dev).toBeDefined();
121
92
  });
122
93
 
123
94
  test('sets default connectTimeout if not provided', () => {
124
95
  const contextNoTimeout = { ...context, connectTimeout: undefined };
125
- const dev = new LocalDevice(contextNoTimeout, mockLogger);
96
+ const dev = new LocalDevice(contextNoTimeout);
126
97
 
127
98
  expect(dev).toBeDefined();
128
99
  });
@@ -299,21 +270,21 @@ describe('LocalDevice', () => {
299
270
  describe('protocol handling', () => {
300
271
  test('creates protocol for version 3.5', () => {
301
272
  const ctxV35 = { ...context, version: '3.5' };
302
- const devV35 = new LocalDevice(ctxV35, mockLogger);
273
+ const devV35 = new LocalDevice(ctxV35);
303
274
 
304
275
  expect(devV35['protocol']).toBeDefined();
305
276
  });
306
277
 
307
278
  test('creates protocol for version 3.1', () => {
308
279
  const ctxV31 = { ...context, version: '3.1' };
309
- const devV31 = new LocalDevice(ctxV31, mockLogger);
280
+ const devV31 = new LocalDevice(ctxV31);
310
281
 
311
282
  expect(devV31['protocol']).toBeDefined();
312
283
  });
313
284
 
314
285
  test('creates protocol for version 3.4', () => {
315
286
  const ctxV34 = { ...context, version: '3.4' };
316
- const devV34 = new LocalDevice(ctxV34, mockLogger);
287
+ const devV34 = new LocalDevice(ctxV34);
317
288
 
318
289
  expect(devV34['protocol']).toBeDefined();
319
290
  });
@@ -349,7 +320,7 @@ describe('LocalDevice', () => {
349
320
 
350
321
  test('creates device logger with context', () => {
351
322
  const ctxNoName = { ...context, name: undefined };
352
- const devNoName = new LocalDevice(ctxNoName, mockLogger);
323
+ const devNoName = new LocalDevice(ctxNoName);
353
324
 
354
325
  expect(devNoName.log).toBeDefined();
355
326
  });
@@ -358,21 +329,21 @@ describe('LocalDevice', () => {
358
329
  describe('connection configuration', () => {
359
330
  test('uses custom port if provided', () => {
360
331
  const ctxCustomPort = { ...context, port: 8888 };
361
- const devCustomPort = new LocalDevice(ctxCustomPort, mockLogger);
332
+ const devCustomPort = new LocalDevice(ctxCustomPort);
362
333
 
363
334
  expect(devCustomPort['context'].port).toBe(8888);
364
335
  });
365
336
 
366
337
  test('uses custom pingGap if provided', () => {
367
338
  const ctxCustomPing = { ...context, pingGap: 15 };
368
- const devCustomPing = new LocalDevice(ctxCustomPing, mockLogger);
339
+ const devCustomPing = new LocalDevice(ctxCustomPing);
369
340
 
370
341
  expect(devCustomPing['context'].pingGap).toBe(15);
371
342
  });
372
343
 
373
344
  test('uses custom connectTimeout if provided', () => {
374
345
  const ctxCustomTimeout = { ...context, connectTimeout: 60 };
375
- const devCustomTimeout = new LocalDevice(ctxCustomTimeout, mockLogger);
346
+ const devCustomTimeout = new LocalDevice(ctxCustomTimeout);
376
347
 
377
348
  expect(devCustomTimeout['context'].connectTimeout).toBe(60);
378
349
  });
@@ -381,7 +352,7 @@ describe('LocalDevice', () => {
381
352
  describe('device types', () => {
382
353
  test('handles light device', () => {
383
354
  const lightContext = { ...context, id: 'light_001', name: 'Smart Light' };
384
- const light = new LocalDevice(lightContext, mockLogger);
355
+ const light = new LocalDevice(lightContext);
385
356
 
386
357
  expect(light['context'].id).toBe('light_001');
387
358
  expect(light['context'].name).toBe('Smart Light');
@@ -389,14 +360,14 @@ describe('LocalDevice', () => {
389
360
 
390
361
  test('handles switch device', () => {
391
362
  const switchContext = { ...context, id: 'switch_001', name: 'Smart Switch' };
392
- const switchDev = new LocalDevice(switchContext, mockLogger);
363
+ const switchDev = new LocalDevice(switchContext);
393
364
 
394
365
  expect(switchDev['context'].id).toBe('switch_001');
395
366
  });
396
367
 
397
368
  test('handles outlet device', () => {
398
369
  const outletContext = { ...context, id: 'outlet_001', name: 'Smart Outlet' };
399
- const outlet = new LocalDevice(outletContext, mockLogger);
370
+ const outlet = new LocalDevice(outletContext);
400
371
 
401
372
  expect(outlet['context'].id).toBe('outlet_001');
402
373
  });
@@ -429,8 +400,8 @@ describe('LocalDevice', () => {
429
400
  connectTimeout: 30,
430
401
  };
431
402
 
432
- deviceV34 = new LocalDevice(contextV34, mockLogger);
433
- deviceV35 = new LocalDevice(contextV35, mockLogger);
403
+ deviceV34 = new LocalDevice(contextV34);
404
+ deviceV35 = new LocalDevice(contextV35);
434
405
  });
435
406
 
436
407
  afterEach(() => {
@@ -463,7 +434,7 @@ describe('LocalDevice', () => {
463
434
  const localNonce = Buffer.from('0123456789abcdef');
464
435
  const remoteNonce = Buffer.from('fedcba9876543210');
465
436
  const invalidHmac = Buffer.alloc(32); // all zeros - definitely wrong
466
- const step2Payload = Buffer.concat([remoteNonce, invalidHmac]);
437
+ const step2Payload = Buffer.concat([remoteNonce as Uint8Array, invalidHmac as Uint8Array]);
467
438
 
468
439
  deviceV34['tmpLocalKey'] = localNonce;
469
440
  deviceV34['socket'] = mockSocket;
@@ -543,8 +514,8 @@ describe('LocalDevice', () => {
543
514
  port: 6668,
544
515
  };
545
516
 
546
- deviceV34 = new LocalDevice(contextV34, mockLogger);
547
- deviceV35 = new LocalDevice(contextV35, mockLogger);
517
+ deviceV34 = new LocalDevice(contextV34);
518
+ deviceV35 = new LocalDevice(contextV35);
548
519
  });
549
520
 
550
521
  afterEach(() => {