@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
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,77 @@
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
+ ✅ **Enhanced stability** — Optimized code, reduced API errors
43
49
 
44
- #### Command Line
45
- ```
46
- npm install @homebridge-plugins/homebridge-tuya
47
- ```
50
+ ---
48
51
 
52
+ ## Installation
49
53
 
50
- ## Configuration
54
+ ### Homebridge Web UI (Recommended)
51
55
 
52
- ### Connection Mode
56
+ 1. Open Homebridge UI
57
+ 2. Go to **Plugins** page
58
+ 3. Search for `@homebridge-plugins/homebridge-tuya`
59
+ 4. Click **Install**
60
+ 5. Configure using the Settings UI
53
61
 
54
- Set `mode` in your config to one of:
62
+ ### Command Line
55
63
 
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 |
64
+ ```bash
65
+ npm install @homebridge-plugins/homebridge-tuya
66
+ ```
61
67
 
62
68
  ---
63
69
 
64
- ### Cloud Mode (`mode: "cloud"`)
65
-
66
- Requires a [Tuya IoT Platform](https://iot.tuya.com) account and cloud project:
70
+ ## Getting Started
67
71
 
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).
72
+ ### Step 1: Choose Your Connection Mode
80
73
 
81
- There are two project types:
74
+ Decide between **Cloud**, **Local**, or **Both**:
82
75
 
83
- #### Custom Project (`options.projectType: "1"`)
76
+ - **Cloud only**: Easiest setup, works remotely, but relies on internet
77
+ - **Local only**: Fastest response, no cloud dependency, but limited features
78
+ - **Both**: Recommended — local commands first, cloud as fallback
84
79
 
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 |
80
+ ### Step 2: Configuration
93
81
 
94
- #### Smart Home Project (`options.projectType: "2"`)
82
+ Configuration uses the Homebridge Web UI or `config.json`. See [Configuration Guide](./docs/CONFIG_GUIDE.md) for detailed setup instructions.
95
83
 
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:**
84
+ **Quick example (Cloud mode):**
111
85
  ```json
112
86
  {
113
87
  "platform": "TuyaPlatform",
114
- "name": "Tuya",
115
88
  "mode": "cloud",
116
89
  "options": {
117
90
  "projectType": "2",
@@ -125,112 +98,351 @@ There are two project types:
125
98
  }
126
99
  ```
127
100
 
101
+ **Quick example (Local mode):**
102
+ ```json
103
+ {
104
+ "platform": "TuyaPlatform",
105
+ "mode": "local",
106
+ "local": {
107
+ "autoDiscoverDevices": true,
108
+ "discoverTimeout": 5
109
+ }
110
+ }
111
+ ```
112
+
128
113
  ---
129
114
 
130
- ### Local Mode (`mode: "local"`)
115
+ ## Configuration Modes
116
+
117
+ ### Cloud Mode
131
118
 
132
- Communicates directly with your Tuya devices over LAN — no internet or Tuya Cloud account required after initial key retrieval.
119
+ Connect via Tuya Cloud API with full feature support.
133
120
 
134
121
  **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:**
122
+ - Tuya IoT Platform account
123
+ - Cloud project setup
124
+ - API credentials
125
+ - Subscription to required services
126
+
127
+ **See:** [Cloud Setup Guide](./docs/CONFIG_GUIDE.md#cloud-setup)
128
+
129
+ ### Local Mode
130
+
131
+ Direct LAN communication without cloud dependency faster and more private.
132
+
133
+ **Requirements:**
134
+ - Devices and Homebridge on same network
135
+ - Device local keys
136
+ - UDP broadcast enabled on network
137
+
138
+ **See:** [Local Setup Guide](./docs/CONFIG_GUIDE.md#local-setup) and [Get Local Keys](./docs/Get-Local-Keys-for-Your-Devices.md)
139
+
140
+ ### Both Mode
141
+
142
+ Hybrid mode using local commands with cloud fallback for reliability.
143
+
144
+ **See:** [Both Mode Setup](./docs/CONFIG_GUIDE.md#both-mode)
145
+
146
+ ---
147
+
148
+ ## Documentation
149
+
150
+ | Document | Purpose |
151
+ |----------|---------|
152
+ | [CONFIG_GUIDE.md](./docs/CONFIG_GUIDE.md) | **Detailed configuration reference** — all options explained |
153
+ | [ADVANCED_OPTIONS.md](./docs/ADVANCED_OPTIONS.md) | Device schema overrides, non-standard DPs, custom mappings |
154
+ | [SUPPORTED_DEVICES.md](./docs/SUPPORTED_DEVICES.md) | Complete list of 60+ supported device categories |
155
+ | [Get Local Keys](./docs/Get-Local-Keys-for-Your-Devices.md) | Step-by-step guide to retrieve device local keys |
156
+ | [CHANGELOG.md](./CHANGELOG.md) | Version history and updates |
157
+
158
+ ---
159
+
160
+ ## Supported Devices
161
+
162
+ This plugin supports **60+ device categories** from Tuya's ecosystem:
163
+
164
+ **Lighting:** Lights, ceiling lights, string lights, strip lights, dimmers, motion sensor lights, solar lights, and more
165
+ **Electrical:** Switches, sockets, power strips, curtain switches, dimmer switches, fan switches, wireless switches
166
+ **Climate:** Air conditioners, heaters, thermostats, humidifiers, dehumidifiers
167
+ **Security:** Door locks, door/window sensors, motion sensors, smoke detectors, CO detectors
168
+ **Cameras & Sensors:** Video cameras (with RTSP streaming), temperature/humidity sensors, air quality sensors
169
+ **Other:** IR controllers, garage door openers, fans, robot vacuums, and more
170
+
171
+ **For a complete list:** See [SUPPORTED_DEVICES.md](./docs/SUPPORTED_DEVICES.md)
172
+
173
+
174
+ ## Troubleshooting
175
+
176
+ ### Common Issues
177
+
178
+ #### 1. Authentication Errors (`1106`, `2406`)
179
+
180
+ If you receive these error codes in Cloud mode:
181
+
182
+ 1. Open the Tuya app → **Me** → **Settings** → **Network Diagnosis**
183
+ 2. Start diagnosis and upload logs
184
+ 3. Find the line starting with `Region code:`:
185
+ - `AY` = China
186
+ - `AZ` = West US
187
+ - `EU` = Central Europe
188
+ - `IN` = India
189
+ 4. Manually set `options.endpoint` in your config with the correct region endpoint
190
+
191
+ **For help finding your endpoint:** [Tuya API Endpoints](https://developer.tuya.com/en/docs/iot/api-request?id=Ka4a8uuo1j4t4#title-1-Endpoints)
192
+
193
+ #### 2. Device Not Showing Up
194
+
195
+ **In Cloud mode:**
196
+ - Verify the device is added to your Tuya app
197
+ - Confirm the device category is in the [supported list](./docs/SUPPORTED_DEVICES.md)
198
+ - Check that required APIs are subscribed on your cloud project
199
+
200
+ **In Local mode:**
201
+ - Ensure Homebridge and devices are on the **same network**
202
+ - Disable any network isolation or guest network features
203
+ - Enable UDP broadcast on your router/network
204
+ - Manually add the device with its local key if auto-discovery fails
205
+
206
+ **For both modes:**
207
+ - Check HomeKit accessory cache: `rm -rf ~/.homebridge/persist/AccessoryInfo.${RANDOM}.json`
208
+ - Review logs with `debug: true` enabled
209
+
210
+ #### 3. Non-Standard Device Properties
211
+
212
+ Some devices have non-standard Data Points (DPs) that don't map to the standard schema.
213
+
214
+ **Solution:** Use device schema overrides. See [ADVANCED_OPTIONS.md](./docs/ADVANCED_OPTIONS.md) for examples.
215
+
216
+ **Steps:**
217
+ 1. Enable debug mode and operate the device
218
+ 2. Find `TuyaDeviceList.{uid}.json` path from logs
219
+ 3. Identify the non-standard DP codes
220
+ 4. Add a `deviceOverrides` entry with custom schema mappings
221
+
222
+ #### 4. Local Connection Not Working
223
+
224
+ **Check:**
225
+ - ✅ Homebridge can ping device: `ping <device_ip>`
226
+ - ✅ Device local key is correct (16 characters)
227
+ - ✅ Device protocol version is correct (try auto-detect first)
228
+ - ✅ UDP port 6666 is open (used for discovery)
229
+ - ✅ Network firewall allows local communication
230
+
231
+ #### 5. Cloud API Trial Expired
232
+
233
+ **⚠️ Important:** Tuya IoT Platform API trials expire every 6 months.
234
+
235
+ **To renew:**
236
+ 1. Log in to [Tuya IoT Platform](https://iot.tuya.com)
237
+ 2. Go to **Cloud** → **API** → **IoT Core Cloud Services**
238
+ 3. Click **Extend** to renew trial
239
+ 4. **Set a calendar reminder** for 6 months later
240
+
241
+ **Without renewal,** your plugin will stop working after expiration.
242
+
243
+ ---
244
+
245
+ ## Debug & Support
246
+
247
+ ### Enable Debug Logging
248
+
249
+ Add to your config:
151
250
  ```json
152
251
  {
153
252
  "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
- ]
253
+ "options": {
254
+ "debug": true,
255
+ "debugLevel": "api,mqtt"
168
256
  }
169
257
  }
170
258
  ```
171
259
 
260
+ **Debug levels:**
261
+ - `api` — API call logs
262
+ - `mqtt` — MQTT connection logs
263
+ - `{device_id}` — Specific device logs
264
+
265
+ ### Getting Device Information
266
+
267
+ After a successful connection, the cloud device list is saved at the path shown in Homebridge logs:
268
+ ```
269
+ [TuyaPlatform] Device list saved at /path/to/TuyaDeviceList.{uid}.json
270
+ ```
271
+
272
+ **⚠️ Warning:** Remove sensitive fields (`ip`, `lon`, `lat`, `local_key`) before sharing logs.
273
+
274
+ ### Reporting Issues
275
+
276
+ When reporting issues, include:
277
+ 1. Plugin version (`npm list @homebridge-plugins/homebridge-tuya`)
278
+ 2. Homebridge version and Node version
279
+ 3. Device category and model
280
+ 4. Relevant debug logs (without sensitive data)
281
+ 5. Steps to reproduce
282
+
283
+ **GitHub Issues:** [Create an issue](https://github.com/homebridge-plugins/homebridge-tuya/issues)
284
+
285
+ ---
286
+
287
+ ## FAQ
288
+
289
+ ### Connection Modes
290
+
291
+ **Q: Which mode should I use?**
292
+
293
+ - **Cloud only:** Simple setup, works remotely, but slower
294
+ - **Local only:** Fastest, most private, but limited features
295
+ - **Both (recommended):** Local commands first, cloud fallback for reliability
296
+
297
+ **Q: Can I switch modes later?**
298
+
299
+ Yes. Update the `mode` setting in your config and restart Homebridge.
300
+
301
+ ---
302
+
303
+ ### About Devices
304
+
305
+ **Q: What devices does this plugin support?**
306
+
307
+ This plugin supports 60+ Tuya device categories. See [SUPPORTED_DEVICES.md](./docs/SUPPORTED_DEVICES.md) for the complete list.
308
+
309
+ **Q: My device isn't showing up. What do I do?**
310
+
311
+ See [Troubleshooting → Device Not Showing Up](#2-device-not-showing-up).
312
+
313
+ **Q: Can I customize how my device appears in HomeKit?**
314
+
315
+ Yes. Use device overrides to:
316
+ - Change category type
317
+ - Map non-standard DPs to standard ones
318
+ - Hide specific device properties
319
+ - Enable Adaptive Lighting
320
+ - And more
321
+
322
+ See [ADVANCED_OPTIONS.md](./docs/ADVANCED_OPTIONS.md) for examples.
323
+
172
324
  ---
173
325
 
174
- ### Both Mode (`mode: "both"`)
326
+ ### About Tuya Account
327
+
328
+ **Q: Do I need a Tuya IoT account for Cloud mode?**
329
+
330
+ Yes. You need to create a free trial project on [Tuya IoT Platform](https://iot.tuya.com).
331
+
332
+ **Q: How do I get my local keys?**
333
+
334
+ Follow the step-by-step guide: [Get Local Keys for Your Devices](./docs/Get-Local-Keys-for-Your-Devices.md)
335
+
336
+ **Q: Can I use the same Tuya account for multiple Homebridge instances?**
337
+
338
+ Not recommended. Use separate Tuya app accounts per Homebridge instance to avoid conflicts.
175
339
 
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
340
  ---
183
341
 
184
- ### Advanced Options
185
- See [ADVANCED_OPTIONS.md](./ADVANCED_OPTIONS.md)
342
+ ### About Performance
343
+
344
+ **Q: Why are local commands faster than cloud?**
345
+
346
+ Local commands communicate directly with your devices over LAN (typically <100ms), while cloud commands go through Tuya's servers (typically >1 second).
186
347
 
348
+ **Q: Does the plugin consume a lot of bandwidth?**
349
+
350
+ No. In Local mode, it uses only local network traffic. In Cloud mode, it uses MQTT for efficient subscriptions and status updates.
351
+
352
+ ---
187
353
 
188
354
  ## 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
355
 
356
+ - **Same app account recommendation:** Using the same Tuya account for multiple Homebridge/Home Assistant instances is not recommended. Create separate accounts.
357
+ - **Cloud API trial duration:** API trial must be renewed every 6 months.
358
+ - **Local network requirement:** Local mode requires devices and Homebridge on the same subnet.
359
+ - **Feature support variance:** Some features (Scenes, advanced automations) are only available in Cloud mode.
193
360
 
194
- ## FAQ
361
+ ---
195
362
 
196
- #### About Login Issues
363
+ ## Development
197
364
 
198
- For most users, the data center is auto-detected. If you get error codes `1106` or `2406`:
365
+ ### Prerequisites
199
366
 
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.
367
+ - Node.js 20+ (or 22, 24, 25)
368
+ - npm 10+
205
369
 
206
- #### What is "Standard DP" and "Non-standard DP"?
370
+ ### Build & Test
207
371
 
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.
372
+ ```bash
373
+ # Install dependencies
374
+ npm install
209
375
 
210
- #### Can "Non-standard DP" be supported?
376
+ # Run linter
377
+ npm run lint
211
378
 
212
- Yes override the device schema. See [ADVANCED_OPTIONS.md](./ADVANCED_OPTIONS.md).
379
+ # Fix linting issues
380
+ npm run lint:fix
213
381
 
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.
382
+ # Run tests
383
+ npm test
218
384
 
385
+ # Generate coverage report
386
+ npm run coverage
219
387
 
220
- ## Troubleshooting
388
+ # Build for deployment
389
+ npm run build
390
+
391
+ # Watch mode (auto-rebuild on changes)
392
+ npm run watch
393
+ ```
221
394
 
222
- #### 1. Get Device Information
395
+ ### Project Structure
223
396
 
224
- After a successful start, the cloud device list is saved at the path shown in the Homebridge log:
225
397
  ```
226
- [TuyaPlatform] Device list saved at /path/to/TuyaDeviceList.{uid}.json
398
+ src/
399
+ ├── index.ts # Plugin entry point
400
+ ├── platform.ts # Main platform class
401
+ ├── config.ts # Config interfaces
402
+ ├── settings.ts # Constants
403
+ ├── cloud/ # Cloud/API logic
404
+ │ ├── api/ # Tuya API clients
405
+ │ └── device/ # Cloud device handling
406
+ ├── local/ # Local/LAN logic
407
+ │ ├── protocol/ # Tuya local protocol
408
+ │ └── device/ # Local device handling
409
+ └── shared/ # Shared utilities
410
+ ├── accessory/ # HomeKit accessory factories
411
+ └── util/ # Utilities
412
+
413
+ test/ # Test suite
414
+ docs/ # Documentation
227
415
  ```
228
- **⚠️ Remove sensitive fields (`ip`, `lon`, `lat`, `local_key`, `uid`) before sharing.**
229
416
 
230
- #### 2. Enable Debug Mode
417
+ ### Contributing
418
+
419
+ Contributions are welcome! Please:
420
+
421
+ 1. Fork the repository
422
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
423
+ 3. Make your changes and test thoroughly
424
+ 4. Run `npm run lint:fix` and `npm test`
425
+ 5. Commit with clear messages
426
+ 6. Push to your branch
427
+ 7. Open a Pull Request
428
+
429
+ ---
430
+
431
+ ## License
432
+
433
+ MIT License — see [LICENSE](./LICENSE) file for details
434
+
435
+ ---
436
+
437
+ ## Support
231
438
 
232
- Add `"debug": true` to your `options` block and restart Homebridge.
439
+ - Star this repo if you find it helpful
440
+ - 💖 [Sponsor the project](https://github.com/sponsors/tassy-h)
441
+ - 🐛 [Report issues](https://github.com/homebridge-plugins/homebridge-tuya/issues)
442
+ - 📖 [Documentation](./docs/CONFIG_GUIDE.md)
443
+
444
+ ---
233
445
 
234
- #### 3. Collect Logs
446
+ ## Changelog
235
447
 
236
- With debug enabled, operate your device physically or via the Tuya App and collect the MQTT/local protocol logs from the Homebridge log.
448
+ See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.