@homebridge-plugins/homebridge-tuya 3.0.0-beta.3 → 3.0.0-beta.30

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 (321) hide show
  1. package/README.md +364 -142
  2. package/config.schema.json +1299 -894
  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 +108 -11
  19. package/dist/local/LocalDevice.js.map +1 -1
  20. package/dist/local/LocalDeviceManager.js +362 -177
  21. package/dist/local/LocalDeviceManager.js.map +1 -1
  22. package/dist/local/TuyaDiscovery.js +17 -8
  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 +61 -27
  27. package/dist/local/protocol/ProtocolUtilities.js.map +1 -1
  28. package/dist/local/protocol/ProtocolV31V32.js +61 -11
  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 +17 -6
  35. package/dist/local/protocol/ProtocolV35.js.map +1 -1
  36. package/dist/platform.js +263 -497
  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 +219 -0
  43. package/dist/shared/TuyaHybridDeviceManager.js.map +1 -0
  44. package/dist/shared/accessory/AccessoryFactory.js +359 -0
  45. package/dist/shared/accessory/AccessoryFactory.js.map +1 -0
  46. package/dist/shared/{accessories → accessory}/AirConditionerAccessory.js +129 -23
  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 +47 -97
  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 +9 -3
  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/accessory/CatToiletAccessory.js +130 -0
  58. package/dist/shared/accessory/CatToiletAccessory.js.map +1 -0
  59. package/dist/shared/{accessories → accessory}/ContactSensorAccessory.js.map +1 -1
  60. package/dist/shared/{accessories → accessory}/DehumidifierAccessory.js.map +1 -1
  61. package/dist/shared/{accessories → accessory}/DiffuserAccessory.js.map +1 -1
  62. package/dist/shared/{accessories → accessory}/DimmerAccessory.js.map +1 -1
  63. package/dist/shared/{accessories → accessory}/DoorbellAccessory.js.map +1 -1
  64. package/dist/shared/{accessories → accessory}/ExtractionHoodAccessory.js.map +1 -1
  65. package/dist/shared/{accessories → accessory}/FanAccessory.js +16 -4
  66. package/dist/shared/accessory/FanAccessory.js.map +1 -0
  67. package/dist/shared/{accessories → accessory}/GarageDoorAccessory.js +19 -2
  68. package/dist/shared/accessory/GarageDoorAccessory.js.map +1 -0
  69. package/dist/shared/{accessories → accessory}/HeaterAccessory.js +3 -0
  70. package/dist/shared/accessory/HeaterAccessory.js.map +1 -0
  71. package/dist/shared/{accessories → accessory}/HeaterAccessory_old.js.map +1 -1
  72. package/dist/shared/accessory/HumanPresenceSensorAccessory.js.map +1 -0
  73. package/dist/shared/{accessories → accessory}/HumidifierAccessory.js.map +1 -1
  74. package/dist/shared/accessory/IRAdapter.js +169 -0
  75. package/dist/shared/accessory/IRAdapter.js.map +1 -0
  76. package/dist/shared/{accessories → accessory}/IRAirConditionerAccessory.js +2 -2
  77. package/dist/shared/accessory/IRAirConditionerAccessory.js.map +1 -0
  78. package/dist/shared/accessory/IRControlHubAccessory.js.map +1 -0
  79. package/dist/shared/accessory/IRControlHubSubAccessory.js.map +1 -0
  80. package/dist/shared/accessory/IRFanAccessory.js +109 -0
  81. package/dist/shared/accessory/IRFanAccessory.js.map +1 -0
  82. package/dist/shared/accessory/IRGenericAccessory.js.map +1 -0
  83. package/dist/shared/{accessories → accessory}/LeakSensorAccessory.js.map +1 -1
  84. package/dist/shared/{accessories → accessory}/LightAccessory.js.map +1 -1
  85. package/dist/shared/{accessories → accessory}/LightSensorAccessory.js.map +1 -1
  86. package/dist/shared/{accessories → accessory}/LocationWeatherAccessory.js +9 -36
  87. package/dist/shared/accessory/LocationWeatherAccessory.js.map +1 -0
  88. package/dist/shared/{accessories → accessory}/LockAccessory.js +3 -3
  89. package/dist/shared/{accessories → accessory}/LockAccessory.js.map +1 -1
  90. package/dist/shared/accessory/MotionSensorAccessory.js.map +1 -0
  91. package/dist/shared/accessory/OutletAccessory.js.map +1 -0
  92. package/dist/shared/{accessories → accessory}/PetFeederAccessory.js.map +1 -1
  93. package/dist/shared/accessory/SaunaAccessory.js +134 -0
  94. package/dist/shared/accessory/SaunaAccessory.js.map +1 -0
  95. package/dist/shared/{accessories → accessory}/SceneAccessory.js +1 -1
  96. package/dist/shared/accessory/SceneAccessory.js.map +1 -0
  97. package/dist/shared/accessory/SceneSwitchAccessory.js.map +1 -0
  98. package/dist/shared/{accessories → accessory}/SecuritySystemAccessory.js +4 -4
  99. package/dist/shared/accessory/SecuritySystemAccessory.js.map +1 -0
  100. package/dist/shared/{accessories → accessory}/SmokeSensorAccessory.js.map +1 -1
  101. package/dist/shared/{accessories → accessory}/SwitchAccessory.js +1 -45
  102. package/dist/shared/accessory/SwitchAccessory.js.map +1 -0
  103. package/dist/shared/accessory/TemperatureHumiditySensorAccessory.js.map +1 -0
  104. package/dist/shared/{accessories → accessory}/ThermostatAccessory.js.map +1 -1
  105. package/dist/shared/{accessories → accessory}/TowerRackAccessory.js.map +1 -1
  106. package/dist/shared/{accessories → accessory}/ValveAccessory.js.map +1 -1
  107. package/dist/shared/{accessories → accessory}/VibrationSensorAccessory.js.map +1 -1
  108. package/dist/shared/accessory/WeatherStationAccessory.js.map +1 -0
  109. package/dist/shared/accessory/WetBulbGlobeTemperatureAccessory.js.map +1 -0
  110. package/dist/shared/{accessories → accessory}/WhiteNoiseLightAccessory.js +1 -0
  111. package/dist/shared/accessory/WhiteNoiseLightAccessory.js.map +1 -0
  112. package/dist/shared/accessory/WindowAccessory.js.map +1 -0
  113. package/dist/shared/{accessories → accessory}/WindowCoveringAccessory.js.map +1 -1
  114. package/dist/shared/{accessories → accessory}/WirelessSwitchAccessory.js.map +1 -1
  115. package/dist/shared/accessory/characteristic/Active.js.map +1 -0
  116. package/dist/shared/accessory/characteristic/AirQuality.js.map +1 -0
  117. package/dist/shared/{accessories → accessory}/characteristic/CurrentRelativeHumidity.js +3 -0
  118. package/dist/shared/accessory/characteristic/CurrentRelativeHumidity.js.map +1 -0
  119. package/dist/shared/accessory/characteristic/CurrentTemperature.js.map +1 -0
  120. package/dist/shared/accessory/characteristic/CurrentWeather.js.map +1 -0
  121. package/dist/shared/accessory/characteristic/CurrentWeatherByOpenMeteo.js.map +1 -0
  122. package/dist/shared/{accessories → accessory}/characteristic/CurrentWetBulbGlobeTemperature.js +3 -2
  123. package/dist/shared/accessory/characteristic/CurrentWetBulbGlobeTemperature.js.map +1 -0
  124. package/dist/shared/{accessories → accessory}/characteristic/EnergyUsage.js +0 -5
  125. package/dist/shared/accessory/characteristic/EnergyUsage.js.map +1 -0
  126. package/dist/shared/accessory/characteristic/EnumOn.js +48 -0
  127. package/dist/shared/accessory/characteristic/EnumOn.js.map +1 -0
  128. package/dist/shared/accessory/characteristic/ExtraCharacteristicAdapter.js +197 -0
  129. package/dist/shared/accessory/characteristic/ExtraCharacteristicAdapter.js.map +1 -0
  130. package/dist/shared/{accessories → accessory}/characteristic/Light.js +62 -12
  131. package/dist/shared/accessory/characteristic/Light.js.map +1 -0
  132. package/dist/shared/accessory/characteristic/LightSensor.js.map +1 -0
  133. package/dist/shared/{accessories → accessory}/characteristic/LockPhysicalControls.js +3 -0
  134. package/dist/shared/accessory/characteristic/LockPhysicalControls.js.map +1 -0
  135. package/dist/shared/accessory/characteristic/MotionDetected.js.map +1 -0
  136. package/dist/shared/accessory/characteristic/Name.js.map +1 -0
  137. package/dist/shared/accessory/characteristic/OccupancyDetected.js.map +1 -0
  138. package/dist/shared/{accessories → accessory}/characteristic/On.js +3 -2
  139. package/dist/shared/accessory/characteristic/On.js.map +1 -0
  140. package/dist/shared/accessory/characteristic/OutletInUse.js.map +1 -0
  141. package/dist/shared/accessory/characteristic/ProgrammableSwitchEvent.js.map +1 -0
  142. package/dist/shared/accessory/characteristic/RawOn.js +93 -0
  143. package/dist/shared/accessory/characteristic/RawOn.js.map +1 -0
  144. package/dist/shared/{accessories → accessory}/characteristic/RelativeHumidityDehumidifierThreshold.js +3 -0
  145. package/dist/shared/accessory/characteristic/RelativeHumidityDehumidifierThreshold.js.map +1 -0
  146. package/dist/shared/accessory/characteristic/RotationSpeed.js +157 -0
  147. package/dist/shared/accessory/characteristic/RotationSpeed.js.map +1 -0
  148. package/dist/shared/accessory/characteristic/SecuritySystemState.js.map +1 -0
  149. package/dist/shared/{accessories → accessory}/characteristic/SwingMode.js +3 -0
  150. package/dist/shared/accessory/characteristic/SwingMode.js.map +1 -0
  151. package/dist/shared/accessory/characteristic/TargetTemperature.js.map +1 -0
  152. package/dist/shared/{accessories → accessory}/characteristic/TemperatureDisplayUnits.js +9 -2
  153. package/dist/shared/accessory/characteristic/TemperatureDisplayUnits.js.map +1 -0
  154. package/dist/shared/util/ConfigHash.js +2 -2
  155. package/dist/shared/util/ConfigHash.js.map +1 -1
  156. package/dist/shared/util/ConfigMigrator.js +222 -0
  157. package/dist/shared/util/ConfigMigrator.js.map +1 -0
  158. package/dist/shared/util/FfmpegStreamingProcess.js +62 -0
  159. package/dist/shared/util/FfmpegStreamingProcess.js.map +1 -1
  160. package/dist/shared/util/InfraredTool.js +0 -2
  161. package/dist/shared/util/InfraredTool.js.map +1 -1
  162. package/dist/shared/util/Logger.js +85 -10
  163. package/dist/shared/util/Logger.js.map +1 -1
  164. package/dist/shared/util/TuyaStreamDelegate.js +201 -99
  165. package/dist/shared/util/TuyaStreamDelegate.js.map +1 -1
  166. package/dist/shared/util/color.js +15 -4
  167. package/dist/shared/util/color.js.map +1 -1
  168. package/dist/shared/util/util.js +91 -5
  169. package/dist/shared/util/util.js.map +1 -1
  170. package/docs/ADVANCED_OPTIONS.md +623 -0
  171. package/docs/CONFIG_GUIDE.md +616 -0
  172. package/docs/Get-Local-Keys-for-Your-Devices.md +246 -0
  173. package/{SUPPORTED_DEVICES.md → docs/SUPPORTED_DEVICES.md} +27 -5
  174. package/eslint.config.mjs +0 -1
  175. package/{jest.config.js → jest.config.ts} +5 -2
  176. package/package.json +14 -11
  177. package/test/ConfigMigrator.test.ts +1060 -0
  178. package/test/FanAccessory.test.ts +458 -0
  179. package/test/Light.test.ts +424 -0
  180. package/test/Logger.test.ts +482 -0
  181. package/test/ProtocolV31V32.test.ts +42 -0
  182. package/test/accessoryFactory.data.test.ts +176 -0
  183. package/test/accessoryFactory.test.ts +65 -35
  184. package/test/airConditioner.swing.test.ts +226 -0
  185. package/test/airConditioner.test.ts +770 -0
  186. package/test/color.test.ts +52 -0
  187. package/test/config.test.ts +17 -13
  188. package/test/custom.test.ts +2 -2
  189. package/test/errorHandling.test.ts +12 -12
  190. package/test/fanAccessory.test.ts +458 -0
  191. package/test/home.test.ts +1 -1
  192. package/test/hybridDeviceManager.test.ts +808 -0
  193. package/test/infraredTools.test.ts +67 -0
  194. package/test/light.test.ts +424 -0
  195. package/test/localDevice.test.ts +31 -53
  196. package/test/localDeviceManager.behavior.test.ts +211 -37
  197. package/test/localDeviceManager.test.ts +124 -41
  198. package/test/mqttMessages.test.ts +40 -16
  199. package/test/platform.test.ts +380 -814
  200. package/test/platform.validation.local.test.ts +90 -120
  201. package/test/protocol.test.ts +27 -12
  202. package/test/protocol35Frames.test.ts +204 -0
  203. package/test/rotationSpeed.test.ts +150 -0
  204. package/test/tuyaCustomDeviceManager.test.ts +111 -17
  205. package/test/tuyaDeviceManager.test.ts +655 -645
  206. package/test/tuyaDiscovery.test.ts +21 -33
  207. package/test/tuyaHomeDeviceManager.test.ts +114 -19
  208. package/test/tuyaOpenAPI.test.ts +25 -44
  209. package/test/tuyaOpenMQ.test.ts +15 -23
  210. package/test/util.test.ts +107 -7
  211. package/test/zigbee/LocalDevice.zigbee.test.ts +14 -18
  212. package/test/zigbee/LocalDeviceManager.cloud-discovery.test.ts +19 -20
  213. package/test/zigbee/LocalDeviceManager.zigbee.reconnect.test.ts +19 -20
  214. package/test/zigbee/LocalDeviceManager.zigbee.test.ts +73 -35
  215. package/test/zigbee/ZigbeeGatewayDetection.test.ts +2 -2
  216. package/ADVANCED_OPTIONS.md +0 -267
  217. package/dist/cloud/device/TuyaDeviceManager.js.map +0 -1
  218. package/dist/local/CloudLocalReconciliation.js +0 -180
  219. package/dist/local/CloudLocalReconciliation.js.map +0 -1
  220. package/dist/shared/accessories/AccessoryFactory.js +0 -309
  221. package/dist/shared/accessories/AccessoryFactory.js.map +0 -1
  222. package/dist/shared/accessories/AirConditionerAccessory.js.map +0 -1
  223. package/dist/shared/accessories/AirQualitySensorAccessory.js.map +0 -1
  224. package/dist/shared/accessories/BaseAccessory.js.map +0 -1
  225. package/dist/shared/accessories/CameraAccessory.js.map +0 -1
  226. package/dist/shared/accessories/FanAccessory.js.map +0 -1
  227. package/dist/shared/accessories/GarageDoorAccessory.js.map +0 -1
  228. package/dist/shared/accessories/HeaterAccessory.js.map +0 -1
  229. package/dist/shared/accessories/HumanPresenceSensorAccessory.js.map +0 -1
  230. package/dist/shared/accessories/IRAirConditionerAccessory.js.map +0 -1
  231. package/dist/shared/accessories/IRControlHubAccessory.js.map +0 -1
  232. package/dist/shared/accessories/IRControlHubSubAccessory.js.map +0 -1
  233. package/dist/shared/accessories/IRGenericAccessory.js.map +0 -1
  234. package/dist/shared/accessories/LocationWeatherAccessory.js.map +0 -1
  235. package/dist/shared/accessories/MotionSensorAccessory.js.map +0 -1
  236. package/dist/shared/accessories/OutletAccessory.js.map +0 -1
  237. package/dist/shared/accessories/SceneAccessory.js.map +0 -1
  238. package/dist/shared/accessories/SceneSwitchAccessory.js.map +0 -1
  239. package/dist/shared/accessories/SecuritySystemAccessory.js.map +0 -1
  240. package/dist/shared/accessories/SwitchAccessory.js.map +0 -1
  241. package/dist/shared/accessories/TemperatureHumiditySensorAccessory.js.map +0 -1
  242. package/dist/shared/accessories/WeatherStationAccessory.js.map +0 -1
  243. package/dist/shared/accessories/WetBulbGlobeTemperatureAccessory.js.map +0 -1
  244. package/dist/shared/accessories/WhiteNoiseLightAccessory.js.map +0 -1
  245. package/dist/shared/accessories/WindowAccessory.js.map +0 -1
  246. package/dist/shared/accessories/characteristic/Active.js.map +0 -1
  247. package/dist/shared/accessories/characteristic/AirQuality.js.map +0 -1
  248. package/dist/shared/accessories/characteristic/CurrentRelativeHumidity.js.map +0 -1
  249. package/dist/shared/accessories/characteristic/CurrentTemperature.js.map +0 -1
  250. package/dist/shared/accessories/characteristic/CurrentWeather.js.map +0 -1
  251. package/dist/shared/accessories/characteristic/CurrentWeatherByOpenMeteo.js.map +0 -1
  252. package/dist/shared/accessories/characteristic/CurrentWetBulbGlobeTemperature.js.map +0 -1
  253. package/dist/shared/accessories/characteristic/EnergyUsage.js.map +0 -1
  254. package/dist/shared/accessories/characteristic/Light.js.map +0 -1
  255. package/dist/shared/accessories/characteristic/LightSensor.js.map +0 -1
  256. package/dist/shared/accessories/characteristic/LockPhysicalControls.js.map +0 -1
  257. package/dist/shared/accessories/characteristic/MotionDetected.js.map +0 -1
  258. package/dist/shared/accessories/characteristic/Name.js.map +0 -1
  259. package/dist/shared/accessories/characteristic/OccupancyDetected.js.map +0 -1
  260. package/dist/shared/accessories/characteristic/On.js.map +0 -1
  261. package/dist/shared/accessories/characteristic/OutletInUse.js.map +0 -1
  262. package/dist/shared/accessories/characteristic/ProgrammableSwitchEvent.js.map +0 -1
  263. package/dist/shared/accessories/characteristic/RelativeHumidityDehumidifierThreshold.js.map +0 -1
  264. package/dist/shared/accessories/characteristic/RotationSpeed.js +0 -78
  265. package/dist/shared/accessories/characteristic/RotationSpeed.js.map +0 -1
  266. package/dist/shared/accessories/characteristic/SecuritySystemState.js.map +0 -1
  267. package/dist/shared/accessories/characteristic/SwingMode.js.map +0 -1
  268. package/dist/shared/accessories/characteristic/TargetTemperature.js.map +0 -1
  269. package/dist/shared/accessories/characteristic/TemperatureDisplayUnits.js.map +0 -1
  270. package/test/zigbee/CloudLocalReconciliation.test.ts +0 -284
  271. package/tuya-local-configs/dev-1.hash +0 -1
  272. package/tuya-local-configs/device1.hash +0 -1
  273. package/wiki/Get-Local-Keys-for-Your-Devices.md +0 -85
  274. /package/dist/shared/{accessories → accessory}/AirPurifierAccessory.js +0 -0
  275. /package/dist/shared/{accessories → accessory}/AirQualitySensorAccessory.js +0 -0
  276. /package/dist/shared/{accessories → accessory}/BlindsAccessory.js +0 -0
  277. /package/dist/shared/{accessories → accessory}/CarbonDioxideSensorAccessory.js +0 -0
  278. /package/dist/shared/{accessories → accessory}/CarbonMonoxideSensorAccessory.js +0 -0
  279. /package/dist/shared/{accessories → accessory}/ContactSensorAccessory.js +0 -0
  280. /package/dist/shared/{accessories → accessory}/DehumidifierAccessory.js +0 -0
  281. /package/dist/shared/{accessories → accessory}/DiffuserAccessory.js +0 -0
  282. /package/dist/shared/{accessories → accessory}/DimmerAccessory.js +0 -0
  283. /package/dist/shared/{accessories → accessory}/DoorbellAccessory.js +0 -0
  284. /package/dist/shared/{accessories → accessory}/ExtractionHoodAccessory.js +0 -0
  285. /package/dist/shared/{accessories → accessory}/HeaterAccessory_old.js +0 -0
  286. /package/dist/shared/{accessories → accessory}/HumanPresenceSensorAccessory.js +0 -0
  287. /package/dist/shared/{accessories → accessory}/HumidifierAccessory.js +0 -0
  288. /package/dist/shared/{accessories → accessory}/IRControlHubAccessory.js +0 -0
  289. /package/dist/shared/{accessories → accessory}/IRControlHubSubAccessory.js +0 -0
  290. /package/dist/shared/{accessories → accessory}/IRGenericAccessory.js +0 -0
  291. /package/dist/shared/{accessories → accessory}/LeakSensorAccessory.js +0 -0
  292. /package/dist/shared/{accessories → accessory}/LightAccessory.js +0 -0
  293. /package/dist/shared/{accessories → accessory}/LightSensorAccessory.js +0 -0
  294. /package/dist/shared/{accessories → accessory}/MotionSensorAccessory.js +0 -0
  295. /package/dist/shared/{accessories → accessory}/OutletAccessory.js +0 -0
  296. /package/dist/shared/{accessories → accessory}/PetFeederAccessory.js +0 -0
  297. /package/dist/shared/{accessories → accessory}/SceneSwitchAccessory.js +0 -0
  298. /package/dist/shared/{accessories → accessory}/SmokeSensorAccessory.js +0 -0
  299. /package/dist/shared/{accessories → accessory}/TemperatureHumiditySensorAccessory.js +0 -0
  300. /package/dist/shared/{accessories → accessory}/ThermostatAccessory.js +0 -0
  301. /package/dist/shared/{accessories → accessory}/TowerRackAccessory.js +0 -0
  302. /package/dist/shared/{accessories → accessory}/ValveAccessory.js +0 -0
  303. /package/dist/shared/{accessories → accessory}/VibrationSensorAccessory.js +0 -0
  304. /package/dist/shared/{accessories → accessory}/WeatherStationAccessory.js +0 -0
  305. /package/dist/shared/{accessories → accessory}/WetBulbGlobeTemperatureAccessory.js +0 -0
  306. /package/dist/shared/{accessories → accessory}/WindowAccessory.js +0 -0
  307. /package/dist/shared/{accessories → accessory}/WindowCoveringAccessory.js +0 -0
  308. /package/dist/shared/{accessories → accessory}/WirelessSwitchAccessory.js +0 -0
  309. /package/dist/shared/{accessories → accessory}/characteristic/Active.js +0 -0
  310. /package/dist/shared/{accessories → accessory}/characteristic/AirQuality.js +0 -0
  311. /package/dist/shared/{accessories → accessory}/characteristic/CurrentTemperature.js +0 -0
  312. /package/dist/shared/{accessories → accessory}/characteristic/CurrentWeather.js +0 -0
  313. /package/dist/shared/{accessories → accessory}/characteristic/CurrentWeatherByOpenMeteo.js +0 -0
  314. /package/dist/shared/{accessories → accessory}/characteristic/LightSensor.js +0 -0
  315. /package/dist/shared/{accessories → accessory}/characteristic/MotionDetected.js +0 -0
  316. /package/dist/shared/{accessories → accessory}/characteristic/Name.js +0 -0
  317. /package/dist/shared/{accessories → accessory}/characteristic/OccupancyDetected.js +0 -0
  318. /package/dist/shared/{accessories → accessory}/characteristic/OutletInUse.js +0 -0
  319. /package/dist/shared/{accessories → accessory}/characteristic/ProgrammableSwitchEvent.js +0 -0
  320. /package/dist/shared/{accessories → accessory}/characteristic/SecuritySystemState.js +0 -0
  321. /package/dist/shared/{accessories → accessory}/characteristic/TargetTemperature.js +0 -0
package/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # @homebridge-plugins/homebridge-tuya
2
2
 
3
+ <div align="center">
4
+
3
5
  [![verified-by-homebridge](https://img.shields.io/badge/homebridge-verified-blueviolet?color=%23491F59&style=for-the-badge&logoColor=%23FFFFFF&logo=homebridge)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
4
6
 
5
7
  ![node](https://badgen.net/npm/node/@homebridge-plugins/homebridge-tuya)
6
- ![homebridge](https://img.shields.io/github/package-json/dependency-version/homebridge-plugins/homebridge-tuya/dev/homebridge)
8
+ ![homebridge](https://img.shields.io/github/package-json/dependency-version/homebridge-plugins/homebridge-tuya/peer/homebridge)
7
9
 
8
10
  [![Sponsor](https://img.shields.io/badge/Sponsor-❤-ff69b4)](https://github.com/sponsors/tassy-h)
9
11
  [![version](https://badgen.net/npm/v/@homebridge-plugins/homebridge-tuya)](https://npmjs.com/package/@homebridge-plugins/homebridge-tuya)
@@ -12,106 +14,78 @@
12
14
  [![mit-license](https://badgen.net/npm/license/@homebridge-plugins/homebridge-tuya)](https://github.com/homebridge-plugins/homebridge-tuya/blob/main/LICENSE)
13
15
  [![Build and Lint](https://github.com/homebridge-plugins/homebridge-tuya/actions/workflows/build.yml/badge.svg)](https://github.com/homebridge-plugins/homebridge-tuya/actions/workflows/build.yml)
14
16
 
15
- Unified Homebridge plugin for Tuya smart devices — supports **Tuya Cloud** (REST/MQTT) and **Tuya Local** (direct LAN/TCP) communication, or both simultaneously.
17
+ **A unified Homebridge plugin for Tuya smart devices**
16
18
 
17
- ---
19
+ Supports **Tuya Cloud** (REST/MQTT) and **Tuya Local** (direct LAN/TCP) communication — or both simultaneously.
18
20
 
19
- ## Features
21
+ </div>
20
22
 
21
- - **Three connection modes**: Cloud, Local (LAN), or Both simultaneously.
22
- - Optimized and improved code for better readability and maintainability.
23
- - Enhanced stability and reduced API errors.
24
- - Local LAN communication using the Tuya local protocol (v3.1–v3.5), no cloud connection required.
25
- - Automatic UDP device discovery on the local network.
26
- - Supports Tuya Scenes (Tap-to-Run) in Cloud mode.
27
- - Device configuration overrides for non-standard DPs.
28
- - Supports 60+ device categories including lights, switches, sensors, cameras, locks, IR remotes, and more.
23
+ ---
29
24
 
25
+ ## Overview
30
26
 
31
- ## Supported Tuya Devices
32
- See [SUPPORTED_DEVICES.md](./SUPPORTED_DEVICES.md)
27
+ This plugin integrates Tuya smart home devices with Apple HomeKit through Homebridge. Choose your connection method based on your needs:
33
28
 
29
+ | Mode | Features | Requirements |
30
+ |------|----------|--------------|
31
+ | **Cloud** | Full features, remote access, scenes, automations | Tuya IoT account, internet |
32
+ | **Local** | Fast response, no cloud dependency, privacy-focused | Devices & Homebridge on same network |
33
+ | **Both** | Best of both worlds — local-first with cloud fallback | Both configurations |
34
34
 
35
- ## Changelogs
36
- See [CHANGELOG.md](./CHANGELOG.md)
35
+ **Supports 60+ device categories**: Lights, switches, sockets, outlets, fans, air conditioners, thermostats, door locks, cameras, sensors, garage doors, curtains, and more.
37
36
 
37
+ ---
38
38
 
39
- ## Installation
39
+ ## Quick Features
40
40
 
41
- #### Homebridge Web UI
42
- Search for `@homebridge-plugins/homebridge-tuya` on the Plugins page and install it.
41
+ ✅ **Three connection modes** — Cloud, Local, or Both simultaneously
42
+ ✅ **60+ device categories** — Comprehensive device support
43
+ ✅ **Automatic discovery** — UDP broadcast discovery for local devices
44
+ ✅ **Tuya Scenes** — Support for Tap-to-Run scenes in Cloud mode
45
+ ✅ **Protocol support** — Tuya local protocol v3.1–v3.5
46
+ ✅ **Device overrides** — Custom schema mapping for non-standard devices
47
+ ✅ **Adaptive Lighting** — Supported on compatible light accessories
48
+ ✅ **NonStandard DP support** — Expose non-standard DP as extra HomeKit services.
49
+ ✅ **Enhanced stability** — Optimized code, reduced API errors
43
50
 
44
- #### Command Line
45
- ```
46
- npm install @homebridge-plugins/homebridge-tuya
47
- ```
51
+ ---
48
52
 
53
+ ## Installation
49
54
 
50
- ## Configuration
55
+ ### Homebridge Web UI (Recommended)
51
56
 
52
- ### Connection Mode
57
+ 1. Open Homebridge UI
58
+ 2. Go to **Plugins** page
59
+ 3. Search for `@homebridge-plugins/homebridge-tuya`
60
+ 4. Click **Install**
61
+ 5. Configure using the Settings UI
53
62
 
54
- Set `mode` in your config to one of:
63
+ ### Command Line
55
64
 
56
- | Mode | Description |
57
- |------|-------------|
58
- | `cloud` | Connect via Tuya Cloud API (default, backward-compatible) |
59
- | `local` | Connect directly over LAN — no cloud needed |
60
- | `both` | Cloud + Local simultaneously |
65
+ ```bash
66
+ npm install @homebridge-plugins/homebridge-tuya
67
+ ```
61
68
 
62
69
  ---
63
70
 
64
- ### Cloud Mode (`mode: "cloud"`)
65
-
66
- Requires a [Tuya IoT Platform](https://iot.tuya.com) account and cloud project:
71
+ ## Getting Started
67
72
 
68
- 1. Create a cloud project and select your data center. See [Mappings Between OEM App Accounts and Data Centers](https://developer.tuya.com/en/docs/iot/oem-app-data-center-distributed?id=Kafi0ku9l07qb).
69
- 2. On the Project Page > Devices Panel > Link Tuya App Account, link your Tuya app account.
70
- 3. On the Project Page > Service API > Go to Authorize, subscribe to:
71
- - Authorization Token Management
72
- - Device Status Notification
73
- - IoT Core
74
- - IoT Video Live Stream *(for cameras)*
75
- - Industry Project Client Service *(Custom project only)*
76
- - IR Control Hub Open Service *(for IR devices)*
77
- - Smart Home Scene Linkage *(for scenes)*
78
- - Smart Lock Open Service *(for locks)*
79
- 4. **⚠️ Extend the API trial every 6 months** at [IoT Core Cloud Services](https://iot.tuya.com/cloud/products/detail?abilityId=1442730014117204014&id=p1668587814138nv4h3n&abilityAuth=0&tab=1).
73
+ ### Step 1: Choose Your Connection Mode
80
74
 
81
- There are two project types:
75
+ Decide between **Cloud**, **Local**, or **Both**:
82
76
 
83
- #### Custom Project (`options.projectType: "1"`)
77
+ - **Cloud only**: Easiest setup, works remotely, but relies on internet
78
+ - **Local only**: Fastest response, no cloud dependency, but limited features
79
+ - **Both**: Recommended — local commands first, cloud as fallback
84
80
 
85
- | Field | Required | Description |
86
- |-------|----------|-------------|
87
- | `options.projectType` | ✅ | `"1"` |
88
- | `options.endpoint` | ✅ | Endpoint URL from [API Reference > Endpoints](https://developer.tuya.com/en/docs/iot/api-request?id=Ka4a8uuo1j4t4#title-1-Endpoints) |
89
- | `options.accessId` | ✅ | Access ID from [Tuya IoT Platform](https://iot.tuya.com/cloud) |
90
- | `options.accessKey` | ✅ | Access Secret from [Tuya IoT Platform](https://iot.tuya.com/cloud) |
91
- | `options.debug` | ➖ | Enable debug logging (default: `false`) |
92
- | `options.debugLevel` | ➖ | Comma-separated log filter: `api`, `mqtt`, or a device ID |
81
+ ### Step 2: Configuration
93
82
 
94
- #### Smart Home Project (`options.projectType: "2"`)
83
+ Configuration uses the Homebridge Web UI or `config.json`. See [Configuration Guide](./docs/CONFIG_GUIDE.md) for detailed setup instructions.
95
84
 
96
- | Field | Required | Description |
97
- |-------|----------|-------------|
98
- | `options.projectType` | ✅ | `"2"` |
99
- | `options.accessId` | ✅ | Access ID |
100
- | `options.accessKey` | ✅ | Access Secret |
101
- | `options.countryCode` | ✅ | Country code of your app account's region |
102
- | `options.username` | ✅ | Tuya/Smart Life app username |
103
- | `options.password` | ✅ | App password (MD5 salted hash also accepted) |
104
- | `options.appSchema` | ✅ | `"tuyaSmart"` or `"smartlife"` |
105
- | `options.endpoint` | ➖ | Override endpoint (auto-detected from countryCode) |
106
- | `options.homeWhitelist` | ➖ | Array of Home IDs to include; blank = all homes |
107
- | `options.debug` | ➖ | Enable debug logging (default: `false`) |
108
- | `options.debugLevel` | ➖ | Comma-separated log filter |
109
-
110
- **Example cloud config:**
85
+ **Quick example (Cloud mode):**
111
86
  ```json
112
87
  {
113
88
  "platform": "TuyaPlatform",
114
- "name": "Tuya",
115
89
  "mode": "cloud",
116
90
  "options": {
117
91
  "projectType": "2",
@@ -125,112 +99,360 @@ There are two project types:
125
99
  }
126
100
  ```
127
101
 
102
+ **Quick example (Local mode):**
103
+ ```json
104
+ {
105
+ "platform": "TuyaPlatform",
106
+ "mode": "local",
107
+ "local": {
108
+ "autoDiscoverDevices": true,
109
+ "discoverTimeout": 5
110
+ }
111
+ }
112
+ ```
113
+
128
114
  ---
129
115
 
130
- ### Local Mode (`mode: "local"`)
116
+ ## Configuration Modes
131
117
 
132
- Communicates directly with your Tuya devices over LAN — no internet or Tuya Cloud account required after initial key retrieval.
118
+ ### Cloud Mode
119
+
120
+ Connect via Tuya Cloud API with full feature support.
133
121
 
134
122
  **Requirements:**
135
- - Your Homebridge host and Tuya devices must be on the same network.
136
- - Each device's **local key** (16-character AES key). You can retrieve your local keys from the [Tuya IoT Platform](https://iot.tuya.com) — see [Get Local Keys](https://github.com/homebridge-plugins/homebridge-tuya/wiki/Get-Local-Keys-for-Your-Devices) for a guide.
137
-
138
- | Field | Required | Description |
139
- |-------|----------|-------------|
140
- | `local.autoDiscoverDevices` | ➖ | Auto-discover devices via UDP broadcast (default: `true`) |
141
- | `local.discoverTimeout` | ➖ | Discovery listen time in seconds (default: `5`) |
142
- | `local.devices` | ➖ | Optional list of known devices with their keys |
143
- | `local.devices[].tuyaDeviceId` | ✅ | Tuya device ID |
144
- | `local.devices[].tuyaKey` | ➖ | Local AES key (16 chars) |
145
- | `local.devices[].ip` | ➖ | Fixed IP address (optional; otherwise auto-discovered) |
146
- | `local.devices[].name` | ➖ | Friendly name |
147
- | `local.devices[].category` | ➖ | Category code (e.g. `light`, `switch`) to pick the right accessory handler |
148
- | `local.devices[].protocolVersion` | ➖ | Protocol version (e.g. `3.3`, `3.4`); auto-detected when blank |
149
-
150
- **Example local config:**
123
+ - Tuya IoT Platform account
124
+ - Cloud project setup
125
+ - API credentials
126
+ - Subscription to required services
127
+
128
+ **See:** [Cloud Setup Guide](./docs/CONFIG_GUIDE.md#cloud-setup)
129
+
130
+ ### Local Mode
131
+
132
+ Direct LAN communication without cloud dependency — faster and more private.
133
+
134
+ **Requirements:**
135
+ - Devices and Homebridge on same network
136
+ - Device local keys
137
+ - UDP broadcast enabled on network
138
+
139
+ **See:** [Local Setup Guide](./docs/CONFIG_GUIDE.md#local-setup) and [Get Local Keys](./docs/Get-Local-Keys-for-Your-Devices.md)
140
+
141
+ ### Both Mode
142
+
143
+ Hybrid mode using local commands with cloud fallback for reliability.
144
+
145
+ **See:** [Both Mode Setup](./docs/CONFIG_GUIDE.md#both-mode)
146
+
147
+ ---
148
+
149
+ ## Documentation
150
+
151
+ | Document | Purpose |
152
+ |----------|---------|
153
+ | [CONFIG_GUIDE.md](./docs/CONFIG_GUIDE.md) | **Detailed configuration reference** — all options explained |
154
+ | [ADVANCED_OPTIONS.md](./docs/ADVANCED_OPTIONS.md) | Device schema overrides, non-standard DPs, custom mappings |
155
+ | [SUPPORTED_DEVICES.md](./docs/SUPPORTED_DEVICES.md) | Complete list of 60+ supported device categories |
156
+ | [Get Local Keys](./docs/Get-Local-Keys-for-Your-Devices.md) | Step-by-step guide to retrieve device local keys |
157
+ | [CHANGELOG.md](./CHANGELOG.md) | Version history and updates |
158
+
159
+ ---
160
+
161
+ ## Supported Devices
162
+
163
+ This plugin supports **60+ device categories** from Tuya's ecosystem:
164
+
165
+ **Lighting:** Lights, ceiling lights, string lights, strip lights, dimmers, motion sensor lights, solar lights, and more
166
+ **Electrical:** Switches, sockets, power strips, curtain switches, dimmer switches, fan switches, wireless switches
167
+ **Climate:** Air conditioners, heaters, thermostats, humidifiers, dehumidifiers
168
+ **Security:** Door locks, door/window sensors, motion sensors, smoke detectors, CO detectors
169
+ **Cameras & Sensors:** Video cameras (with RTSP streaming), temperature/humidity sensors, air quality sensors
170
+ **Other:** IR controllers, garage door openers, fans, robot vacuums, and more
171
+
172
+ **For a complete list:** See [SUPPORTED_DEVICES.md](./docs/SUPPORTED_DEVICES.md)
173
+
174
+
175
+ ## Troubleshooting
176
+
177
+ ### Common Issues
178
+
179
+ #### 1. Authentication Errors (`1106`, `2406`)
180
+
181
+ If you receive these error codes in Cloud mode:
182
+
183
+ 1. Open the Tuya app → **Me** → **Settings** → **Network Diagnosis**
184
+ 2. Start diagnosis and upload logs
185
+ 3. Find the line starting with `Region code:`:
186
+ - `AY` = China
187
+ - `AZ` = West US
188
+ - `EU` = Central Europe
189
+ - `IN` = India
190
+ 4. Manually set `options.endpoint` in your config with the correct region endpoint
191
+
192
+ **For help finding your endpoint:** [Tuya API Endpoints](https://developer.tuya.com/en/docs/iot/api-request?id=Ka4a8uuo1j4t4#title-1-Endpoints)
193
+
194
+ #### 2. Device Not Showing Up
195
+
196
+ **In Cloud mode:**
197
+ - Verify the device is added to your Tuya app
198
+ - Confirm the device category is in the [supported list](./docs/SUPPORTED_DEVICES.md)
199
+ - Check that required APIs are subscribed on your cloud project
200
+
201
+ **In Local mode:**
202
+ - Ensure Homebridge and devices are on the **same network**
203
+ - Disable any network isolation or guest network features
204
+ - Enable UDP broadcast on your router/network
205
+ - Manually add the device with its local key if auto-discovery fails
206
+
207
+ **For both modes:**
208
+ - Check HomeKit accessory cache: `rm -rf ~/.homebridge/persist/AccessoryInfo.${RANDOM}.json`
209
+ - Review logs with `debug: true` enabled
210
+
211
+ #### 3. Non-Standard Device Properties
212
+
213
+ Some devices have non-standard Data Points (DPs) that don't map to the standard schema.
214
+
215
+ **Solution:** Use device schema overrides. See [ADVANCED_OPTIONS.md](./docs/ADVANCED_OPTIONS.md) for examples.
216
+
217
+ **Steps:**
218
+ 1. Enable debug mode and operate the device
219
+ 2. Find `TuyaDeviceList.{uid}.json` path from logs
220
+ 3. Identify the non-standard DP codes
221
+ 4. Add a `deviceOverrides` entry with custom schema mappings
222
+
223
+ #### 4. Local Connection Not Working
224
+
225
+ **Check:**
226
+ - ✅ Homebridge can ping device: `ping <device_ip>`
227
+ - ✅ Device local key is correct (16 characters)
228
+ - ✅ Device protocol version is correct (try auto-detect first)
229
+ - ✅ UDP port 6666 is open (used for discovery)
230
+ - ✅ Network firewall allows local communication
231
+
232
+ #### 5. Cloud API Trial Expired
233
+
234
+ **⚠️ Important:** Tuya IoT Platform API trials expire every 6 months.
235
+
236
+ **To renew:**
237
+ 1. Log in to [Tuya IoT Platform](https://iot.tuya.com)
238
+ 2. Go to **Cloud** → **API** → **IoT Core Cloud Services**
239
+ 3. Click **Extend** to renew trial
240
+ 4. **Set a calendar reminder** for 6 months later
241
+
242
+ **Without renewal,** your plugin will stop working after expiration.
243
+
244
+ ---
245
+
246
+ ## Debug & Support
247
+
248
+ ### Enable Debug Logging
249
+
250
+ Add to your config:
151
251
  ```json
152
252
  {
153
253
  "platform": "TuyaPlatform",
154
- "name": "Tuya",
155
- "mode": "local",
156
- "local": {
157
- "autoDiscoverDevices": true,
158
- "discoverTimeout": 5,
159
- "devices": [
160
- {
161
- "tuyaDeviceId": "abcdef1234567890",
162
- "tuyaKey": "0123456789abcdef",
163
- "ip": "192.168.1.100",
164
- "name": "Living Room Light",
165
- "category": "light"
166
- }
167
- ]
254
+ "options": {
255
+ "debug": true,
256
+ "debugLevel": "api,mqtt"
168
257
  }
169
258
  }
170
259
  ```
171
260
 
261
+ **Debug levels:**
262
+ - `api` — API call logs
263
+ - `mqtt` — MQTT connection logs
264
+ - `{device_id}` — Specific device logs
265
+
266
+ ### Getting Device Information
267
+
268
+ After a successful connection, the cloud device list is saved at the path shown in Homebridge logs:
269
+ ```
270
+ [TuyaPlatform] Device list saved at /path/to/TuyaDeviceList.{uid}.json
271
+ ```
272
+
273
+ **⚠️ Warning:** Remove sensitive fields (`ip`, `lon`, `lat`, `local_key`) before sharing logs.
274
+
275
+ ### Reporting Issues
276
+
277
+ When reporting issues, include:
278
+ 1. Plugin version (`npm list @homebridge-plugins/homebridge-tuya`)
279
+ 2. Homebridge version and Node version
280
+ 3. Device category and model
281
+ 4. Relevant debug logs (without sensitive data)
282
+ 5. Steps to reproduce
283
+
284
+ **GitHub Issues:** [Create an issue](https://github.com/homebridge-plugins/homebridge-tuya/issues)
285
+
286
+ ---
287
+
288
+ ## FAQ
289
+
290
+ ### Connection Modes
291
+
292
+ **Q: Which mode should I use?**
293
+
294
+ - **Cloud only:** Simple setup, works remotely, but slower
295
+ - **Local only:** Fastest, most private, but limited features
296
+ - **Both (recommended):** Local commands first, cloud fallback for reliability
297
+
298
+ **Q: Can I switch modes later?**
299
+
300
+ Yes. Update the `mode` setting in your config and restart Homebridge.
301
+
302
+ ---
303
+
304
+ ### About Devices
305
+
306
+ **Q: What devices does this plugin support?**
307
+
308
+ This plugin supports 60+ Tuya device categories. See [SUPPORTED_DEVICES.md](./docs/SUPPORTED_DEVICES.md) for the complete list.
309
+
310
+ **Q: My device isn't showing up. What do I do?**
311
+
312
+ See [Troubleshooting → Device Not Showing Up](#2-device-not-showing-up).
313
+
314
+ **Q: Can I customize how my device appears in HomeKit?**
315
+
316
+ Yes. Use device overrides to:
317
+ - Change category type
318
+ - Map non-standard DPs to standard ones
319
+ - Hide specific device properties
320
+ - Enable Adaptive Lighting
321
+ - And more
322
+
323
+ See [ADVANCED_OPTIONS.md](./docs/ADVANCED_OPTIONS.md) for examples.
324
+
172
325
  ---
173
326
 
174
- ### Both Mode (`mode: "both"`)
327
+ ### About Tuya Account
328
+
329
+ **Q: Do I need a Tuya IoT account for Cloud mode?**
330
+
331
+ Yes. You need to create a free trial project on [Tuya IoT Platform](https://iot.tuya.com).
332
+
333
+ **Q: How do I get my local keys?**
334
+
335
+ Follow the step-by-step guide: [Get Local Keys for Your Devices](./docs/Get-Local-Keys-for-Your-Devices.md)
336
+
337
+ **Q: Can I use the same Tuya account for multiple Homebridge instances?**
338
+
339
+ Not recommended. Use separate Tuya app accounts per Homebridge instance to avoid conflicts.
175
340
 
176
- Uses cloud + local simultaneously. Provide both `options` (cloud) and `local` blocks.
177
- - Local LAN commands are attempted first when the device is available locally.
178
- - The cloud connection remains active as a fallback.
179
- - This fallback is only used when a local command does not receive confirmation within 10 seconds; normal local commands remain local.
180
- - If a local command does not receive confirmation within 10 seconds, the plugin automatically retries it via cloud.
181
- - Cloud status updates can also satisfy pending local commands so the device does not get double-sent commands.
182
341
  ---
183
342
 
184
- ### Advanced Options
185
- See [ADVANCED_OPTIONS.md](./ADVANCED_OPTIONS.md)
343
+ ### About Performance
344
+
345
+ **Q: Why are local commands faster than cloud?**
186
346
 
347
+ Local commands communicate directly with your devices over LAN (typically <100ms), while cloud commands go through Tuya's servers (typically >1 second).
348
+
349
+ **Q: Does the plugin consume a lot of bandwidth?**
350
+
351
+ No. In Local mode, it uses only local network traffic. In Cloud mode, it uses MQTT for efficient subscriptions and status updates.
352
+
353
+ ---
187
354
 
188
355
  ## Limitations
189
- - Using the same app account for multiple Homebridge/HomeAssistant instances is not recommended. Use separate app accounts per instance.
190
- - **⚠️ Cloud API trial expires every 6 months** — set a calendar reminder to renew.
191
- - Local mode requires devices and Homebridge to be on the same subnet.
192
356
 
357
+ - **Same app account recommendation:** Using the same Tuya account for multiple Homebridge/Home Assistant instances is not recommended. Create separate accounts.
358
+ - **Cloud API trial duration:** API trial must be renewed every 6 months.
359
+ - **Local network requirement:** Local mode requires devices and Homebridge on the same subnet.
360
+ - **Feature support variance:** Some features (Scenes, advanced automations) are only available in Cloud mode.
193
361
 
194
- ## FAQ
362
+ ---
195
363
 
196
- #### About Login Issues
364
+ ## Development
197
365
 
198
- For most users, the data center is auto-detected. If you get error codes `1106` or `2406`:
366
+ ### Prerequisites
199
367
 
200
- 1. Open the Tuya app → Me → Settings → Network Diagnosis.
201
- 2. Start diagnosis, select Upload Log → Copy the Log to Clipboard.
202
- 3. Find the line beginning with `Region code:`:
203
- - `AY` = China, `AZ` = West US, `EU` = Central Europe, `IN` = India.
204
- 4. Manually set `options.endpoint` in your config.
368
+ - Node.js 20+ (or 22, 24, 25)
369
+ - npm 10+
205
370
 
206
- #### What is "Standard DP" and "Non-standard DP"?
371
+ ### Build & Test
207
372
 
208
- "Standard DP" refers to device properties defined in [Tuya Standard Instruction Set](https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq) (e.g. `switch_led`, `bright_value`). If your device works in the Tuya app but not this plugin, it likely has non-standard DPs.
373
+ ```bash
374
+ # Install dependencies
375
+ npm install
209
376
 
210
- #### Can "Non-standard DP" be supported?
377
+ # Run linter
378
+ npm run lint
211
379
 
212
- Yes — override the device schema. See [ADVANCED_OPTIONS.md](./ADVANCED_OPTIONS.md).
380
+ # Fix linting issues
381
+ npm run lint:fix
213
382
 
214
- Steps:
215
- 1. On the Tuya Platform → Your Project → Devices → All Devices → View by Product.
216
- 2. Click the pencil icon next to your product → select **DP Instruction** → save.
217
- 3. Add a `deviceOverrides` entry with schema mappings in the plugin config.
383
+ # Run tests
384
+ npm test
218
385
 
386
+ # Generate coverage report
387
+ npm run coverage
219
388
 
220
- ## Troubleshooting
389
+ # Build for deployment
390
+ npm run build
391
+
392
+ # Watch mode (auto-rebuild on changes)
393
+ npm run watch
394
+ ```
221
395
 
222
- #### 1. Get Device Information
396
+ ### Project Structure
223
397
 
224
- After a successful start, the cloud device list is saved at the path shown in the Homebridge log:
225
398
  ```
226
- [TuyaPlatform] Device list saved at /path/to/TuyaDeviceList.{uid}.json
399
+ src/
400
+ ├── index.ts # Plugin entry point
401
+ ├── platform.ts # Main platform class
402
+ ├── config.ts # Config interfaces
403
+ ├── settings.ts # Constants
404
+ ├── cloud/ # Cloud/API logic
405
+ │ ├── api/ # Tuya API clients
406
+ │ └── device/ # Cloud device handling
407
+ ├── local/ # Local/LAN logic
408
+ │ ├── protocol/ # Tuya local protocol
409
+ │ └── device/ # Local device handling
410
+ └── shared/ # Shared utilities
411
+ ├── accessory/ # HomeKit accessory factories
412
+ └── util/ # Utilities
413
+
414
+ test/ # Test suite
415
+ docs/ # Documentation
227
416
  ```
228
- **⚠️ Remove sensitive fields (`ip`, `lon`, `lat`, `local_key`, `uid`) before sharing.**
229
417
 
230
- #### 2. Enable Debug Mode
418
+ ### Contributing
419
+
420
+ Contributions are welcome! Please:
421
+
422
+ 1. Fork the repository
423
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
424
+ 3. Make your changes and test thoroughly
425
+ 4. Run `npm run lint:fix` and `npm test`
426
+ 5. Commit with clear messages
427
+ 6. Push to your branch
428
+ 7. Open a Pull Request
429
+
430
+ ---
431
+
432
+ ## License
433
+
434
+ MIT License — see [LICENSE](./LICENSE) file for details
435
+
436
+ ---
437
+
438
+ ## Support
439
+
440
+ - ⭐ Star this repo if you find it helpful
441
+ - 💖 [Sponsor the project](https://github.com/sponsors/tassy-h)
442
+ - 🐛 [Report issues](https://github.com/homebridge-plugins/homebridge-tuya/issues)
443
+ - 📖 [Documentation](./docs/CONFIG_GUIDE.md)
444
+
445
+ ---
446
+
447
+ ## Changelog
448
+
449
+ See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
450
+
451
+ ## Sponsors
231
452
 
232
- Add `"debug": true` to your `options` block and restart Homebridge.
453
+ <img class="circle avatar-user" src="https://avatars.githubusercontent.com/u/314622938?s=52&amp;v=4" width="26" height="26" alt="@mlm-it">
233
454
 
234
- #### 3. Collect Logs
455
+ This project is supported by generous sponsors on GitHub Sponsors.
456
+ Thank you for helping me continue improving and maintaining this software!
235
457
 
236
- With debug enabled, operate your device physically or via the Tuya App and collect the MQTT/local protocol logs from the Homebridge log.
458
+ [![Sponsor me](https://img.shields.io/badge/Sponsor%20me-❤-ff69b4)](https://github.com/sponsors/tassy-h)