@homebridge-plugins/homebridge-tuya 2.0.2-beta.3
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.
- package/.idea/copilot.data.migration.agent.xml +6 -0
- package/.idea/copilot.data.migration.ask.xml +6 -0
- package/.idea/copilot.data.migration.ask2agent.xml +6 -0
- package/.idea/copilot.data.migration.edit.xml +6 -0
- package/.idea/dictionaries/benpotter.xml +3 -0
- package/.idea/homebridge-tuya.iml +8 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/workspace.xml +64 -0
- package/ADVANCED_OPTIONS.md +267 -0
- package/CHANGELOG.md +127 -0
- package/LICENSE +20 -0
- package/README.md +206 -0
- package/SUPPORTED_DEVICES.md +206 -0
- package/config.schema.json +550 -0
- package/dist/accessory/AccessoryFactory.js +274 -0
- package/dist/accessory/AccessoryFactory.js.map +1 -0
- package/dist/accessory/AirConditionerAccessory.js +307 -0
- package/dist/accessory/AirConditionerAccessory.js.map +1 -0
- package/dist/accessory/AirPurifierAccessory.js +90 -0
- package/dist/accessory/AirPurifierAccessory.js.map +1 -0
- package/dist/accessory/AirQualitySensorAccessory.js +30 -0
- package/dist/accessory/AirQualitySensorAccessory.js.map +1 -0
- package/dist/accessory/BaseAccessory.js +295 -0
- package/dist/accessory/BaseAccessory.js.map +1 -0
- package/dist/accessory/CameraAccessory.js +117 -0
- package/dist/accessory/CameraAccessory.js.map +1 -0
- package/dist/accessory/CarbonDioxideSensorAccessory.js +52 -0
- package/dist/accessory/CarbonDioxideSensorAccessory.js.map +1 -0
- package/dist/accessory/CarbonMonoxideSensorAccessory.js +52 -0
- package/dist/accessory/CarbonMonoxideSensorAccessory.js.map +1 -0
- package/dist/accessory/ContactSensorAccessory.js +30 -0
- package/dist/accessory/ContactSensorAccessory.js.map +1 -0
- package/dist/accessory/DehumidifierAccessory.js +68 -0
- package/dist/accessory/DehumidifierAccessory.js.map +1 -0
- package/dist/accessory/DiffuserAccessory.js +55 -0
- package/dist/accessory/DiffuserAccessory.js.map +1 -0
- package/dist/accessory/DimmerAccessory.js +94 -0
- package/dist/accessory/DimmerAccessory.js.map +1 -0
- package/dist/accessory/DoorbellAccessory.js +89 -0
- package/dist/accessory/DoorbellAccessory.js.map +1 -0
- package/dist/accessory/ExtractionHoodAccessory.js +118 -0
- package/dist/accessory/ExtractionHoodAccessory.js.map +1 -0
- package/dist/accessory/FanAccessory.js +123 -0
- package/dist/accessory/FanAccessory.js.map +1 -0
- package/dist/accessory/GarageDoorAccessory.js +69 -0
- package/dist/accessory/GarageDoorAccessory.js.map +1 -0
- package/dist/accessory/HeaterAccessory.js +96 -0
- package/dist/accessory/HeaterAccessory.js.map +1 -0
- package/dist/accessory/HumanPresenceSensorAccessory.js +20 -0
- package/dist/accessory/HumanPresenceSensorAccessory.js.map +1 -0
- package/dist/accessory/HumidifierAccessory.js +135 -0
- package/dist/accessory/HumidifierAccessory.js.map +1 -0
- package/dist/accessory/IRAirConditionerAccessory.js +285 -0
- package/dist/accessory/IRAirConditionerAccessory.js.map +1 -0
- package/dist/accessory/IRControlHubAccessory.js +49 -0
- package/dist/accessory/IRControlHubAccessory.js.map +1 -0
- package/dist/accessory/IRControlHubSubAccessory.js +53 -0
- package/dist/accessory/IRControlHubSubAccessory.js.map +1 -0
- package/dist/accessory/IRGenericAccessory.js +50 -0
- package/dist/accessory/IRGenericAccessory.js.map +1 -0
- package/dist/accessory/LeakSensorAccessory.js +36 -0
- package/dist/accessory/LeakSensorAccessory.js.map +1 -0
- package/dist/accessory/LightAccessory.js +36 -0
- package/dist/accessory/LightAccessory.js.map +1 -0
- package/dist/accessory/LightSensorAccessory.js +32 -0
- package/dist/accessory/LightSensorAccessory.js.map +1 -0
- package/dist/accessory/LocationWeatherAccessory.js +72 -0
- package/dist/accessory/LocationWeatherAccessory.js.map +1 -0
- package/dist/accessory/LockAccessory.js +56 -0
- package/dist/accessory/LockAccessory.js.map +1 -0
- package/dist/accessory/MotionSensorAccessory.js +20 -0
- package/dist/accessory/MotionSensorAccessory.js.map +1 -0
- package/dist/accessory/OutletAccessory.js +23 -0
- package/dist/accessory/OutletAccessory.js.map +1 -0
- package/dist/accessory/PetFeederAccessory.js +139 -0
- package/dist/accessory/PetFeederAccessory.js.map +1 -0
- package/dist/accessory/SceneAccessory.js +32 -0
- package/dist/accessory/SceneAccessory.js.map +1 -0
- package/dist/accessory/SceneSwitchAccessory.js +44 -0
- package/dist/accessory/SceneSwitchAccessory.js.map +1 -0
- package/dist/accessory/SecuritySystemAccessory.js +30 -0
- package/dist/accessory/SecuritySystemAccessory.js.map +1 -0
- package/dist/accessory/SmokeSensorAccessory.js +35 -0
- package/dist/accessory/SmokeSensorAccessory.js.map +1 -0
- package/dist/accessory/SwitchAccessory.js +86 -0
- package/dist/accessory/SwitchAccessory.js.map +1 -0
- package/dist/accessory/TemperatureHumiditySensorAccessory.js +24 -0
- package/dist/accessory/TemperatureHumiditySensorAccessory.js.map +1 -0
- package/dist/accessory/ThermostatAccessory.js +190 -0
- package/dist/accessory/ThermostatAccessory.js.map +1 -0
- package/dist/accessory/ValveAccessory.js +45 -0
- package/dist/accessory/ValveAccessory.js.map +1 -0
- package/dist/accessory/VibrationSensorAccessory.js +42 -0
- package/dist/accessory/VibrationSensorAccessory.js.map +1 -0
- package/dist/accessory/WeatherStationAccessory.js +59 -0
- package/dist/accessory/WeatherStationAccessory.js.map +1 -0
- package/dist/accessory/WetBulbGlobeTemperatureAccessory.js +23 -0
- package/dist/accessory/WetBulbGlobeTemperatureAccessory.js.map +1 -0
- package/dist/accessory/WhiteNoiseLightAccessory.js +59 -0
- package/dist/accessory/WhiteNoiseLightAccessory.js.map +1 -0
- package/dist/accessory/WindowAccessory.js +14 -0
- package/dist/accessory/WindowAccessory.js.map +1 -0
- package/dist/accessory/WindowCoveringAccessory.js +156 -0
- package/dist/accessory/WindowCoveringAccessory.js.map +1 -0
- package/dist/accessory/WirelessSwitchAccessory.js +42 -0
- package/dist/accessory/WirelessSwitchAccessory.js.map +1 -0
- package/dist/accessory/characteristic/Active.js +23 -0
- package/dist/accessory/characteristic/Active.js.map +1 -0
- package/dist/accessory/characteristic/AirQuality.js +75 -0
- package/dist/accessory/characteristic/AirQuality.js.map +1 -0
- package/dist/accessory/characteristic/CurrentRelativeHumidity.js +24 -0
- package/dist/accessory/characteristic/CurrentRelativeHumidity.js.map +1 -0
- package/dist/accessory/characteristic/CurrentTemperature.js +24 -0
- package/dist/accessory/characteristic/CurrentTemperature.js.map +1 -0
- package/dist/accessory/characteristic/CurrentWeather.js +51 -0
- package/dist/accessory/characteristic/CurrentWeather.js.map +1 -0
- package/dist/accessory/characteristic/CurrentWeatherByOpenMeteo.js +81 -0
- package/dist/accessory/characteristic/CurrentWeatherByOpenMeteo.js.map +1 -0
- package/dist/accessory/characteristic/CurrentWetBulbGlobeTemperature.js +50 -0
- package/dist/accessory/characteristic/CurrentWetBulbGlobeTemperature.js.map +1 -0
- package/dist/accessory/characteristic/EnergyUsage.js +103 -0
- package/dist/accessory/characteristic/EnergyUsage.js.map +1 -0
- package/dist/accessory/characteristic/Light.js +269 -0
- package/dist/accessory/characteristic/Light.js.map +1 -0
- package/dist/accessory/characteristic/LightSensor.js +24 -0
- package/dist/accessory/characteristic/LightSensor.js.map +1 -0
- package/dist/accessory/characteristic/LockPhysicalControls.js +22 -0
- package/dist/accessory/characteristic/LockPhysicalControls.js.map +1 -0
- package/dist/accessory/characteristic/MotionDetected.js +23 -0
- package/dist/accessory/characteristic/MotionDetected.js.map +1 -0
- package/dist/accessory/characteristic/Name.js +12 -0
- package/dist/accessory/characteristic/Name.js.map +1 -0
- package/dist/accessory/characteristic/OccupancyDetected.js +20 -0
- package/dist/accessory/characteristic/OccupancyDetected.js.map +1 -0
- package/dist/accessory/characteristic/On.js +26 -0
- package/dist/accessory/characteristic/On.js.map +1 -0
- package/dist/accessory/characteristic/OutletInUse.js +15 -0
- package/dist/accessory/characteristic/OutletInUse.js.map +1 -0
- package/dist/accessory/characteristic/ProgrammableSwitchEvent.js +90 -0
- package/dist/accessory/characteristic/ProgrammableSwitchEvent.js.map +1 -0
- package/dist/accessory/characteristic/RelativeHumidityDehumidifierThreshold.js +29 -0
- package/dist/accessory/characteristic/RelativeHumidityDehumidifierThreshold.js.map +1 -0
- package/dist/accessory/characteristic/RotationSpeed.js +79 -0
- package/dist/accessory/characteristic/RotationSpeed.js.map +1 -0
- package/dist/accessory/characteristic/SecuritySystemState.js +76 -0
- package/dist/accessory/characteristic/SecuritySystemState.js.map +1 -0
- package/dist/accessory/characteristic/SwingMode.js +22 -0
- package/dist/accessory/characteristic/SwingMode.js.map +1 -0
- package/dist/accessory/characteristic/TemperatureDisplayUnits.js +26 -0
- package/dist/accessory/characteristic/TemperatureDisplayUnits.js.map +1 -0
- package/dist/config.js +29 -0
- package/dist/config.js.map +1 -0
- package/dist/core/TuyaOpenAPI.js +314 -0
- package/dist/core/TuyaOpenAPI.js.map +1 -0
- package/dist/core/TuyaOpenMQ.js +182 -0
- package/dist/core/TuyaOpenMQ.js.map +1 -0
- package/dist/device/TuyaCustomDeviceManager.js +65 -0
- package/dist/device/TuyaCustomDeviceManager.js.map +1 -0
- package/dist/device/TuyaDevice.js +37 -0
- package/dist/device/TuyaDevice.js.map +1 -0
- package/dist/device/TuyaDeviceManager.js +447 -0
- package/dist/device/TuyaDeviceManager.js.map +1 -0
- package/dist/device/TuyaHomeDeviceManager.js +64 -0
- package/dist/device/TuyaHomeDeviceManager.js.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/platform.js +466 -0
- package/dist/platform.js.map +1 -0
- package/dist/settings.js +18 -0
- package/dist/settings.js.map +1 -0
- package/dist/util/FfmpegStreamingProcess.js +126 -0
- package/dist/util/FfmpegStreamingProcess.js.map +1 -0
- package/dist/util/InfraredTool.js +396 -0
- package/dist/util/InfraredTool.js.map +1 -0
- package/dist/util/Logger.js +42 -0
- package/dist/util/Logger.js.map +1 -0
- package/dist/util/TuyaRecordingDelegate.js +22 -0
- package/dist/util/TuyaRecordingDelegate.js.map +1 -0
- package/dist/util/TuyaStreamDelegate.js +330 -0
- package/dist/util/TuyaStreamDelegate.js.map +1 -0
- package/dist/util/color.js +24 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/util.js +48 -0
- package/dist/util/util.js.map +1 -0
- package/jest.config.js +5 -0
- package/package.json +74 -0
- package/test/custom.test.ts +101 -0
- package/test/home.test.ts +81 -0
- package/test/util.ts +39 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
|
5
|
+
<orderEntry type="inheritedJdk" />
|
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
+
</component>
|
|
8
|
+
</module>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/homebridge-tuya.iml" filepath="$PROJECT_DIR$/.idea/homebridge-tuya.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="AutoImportSettings">
|
|
4
|
+
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ChangeListManager">
|
|
7
|
+
<list default="true" id="35182aab-1d88-4fa8-b76d-192aa3e7cf72" name="Changes" comment="" />
|
|
8
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
9
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
11
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="Git.Settings">
|
|
14
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
15
|
+
</component>
|
|
16
|
+
<component name="ProjectColorInfo">{
|
|
17
|
+
"associatedIndex": 6
|
|
18
|
+
}</component>
|
|
19
|
+
<component name="ProjectId" id="33FE3I3riNQtEmgCTK2TyHnBMVa" />
|
|
20
|
+
<component name="ProjectViewState">
|
|
21
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
22
|
+
<option name="showLibraryContents" value="true" />
|
|
23
|
+
</component>
|
|
24
|
+
<component name="PropertiesComponent">{
|
|
25
|
+
"keyToString": {
|
|
26
|
+
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
|
27
|
+
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
|
28
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
29
|
+
"RunOnceActivity.git.unshallow": "true",
|
|
30
|
+
"git-widget-placeholder": "develop__2.0.0",
|
|
31
|
+
"node.js.detected.package.eslint": "true",
|
|
32
|
+
"node.js.detected.package.tslint": "true",
|
|
33
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
34
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
35
|
+
"nodejs_package_manager_path": "npm",
|
|
36
|
+
"settings.editor.selected.configurable": "preferences.sourceCode.JavaScript",
|
|
37
|
+
"ts.external.directory.path": "/Applications/WebStorm 2025.3 EAP.app/Contents/plugins/javascript-plugin/jsLanguageServicesImpl/external",
|
|
38
|
+
"vue.rearranger.settings.migration": "true"
|
|
39
|
+
}
|
|
40
|
+
}</component>
|
|
41
|
+
<component name="SharedIndexes">
|
|
42
|
+
<attachedChunks>
|
|
43
|
+
<set>
|
|
44
|
+
<option value="bundled-js-predefined-d6986cc7102b-256f9dae541f-JavaScript-WS-253.22441.34" />
|
|
45
|
+
</set>
|
|
46
|
+
</attachedChunks>
|
|
47
|
+
</component>
|
|
48
|
+
<component name="TaskManager">
|
|
49
|
+
<task active="true" id="Default" summary="Default task">
|
|
50
|
+
<changelist id="35182aab-1d88-4fa8-b76d-192aa3e7cf72" name="Changes" comment="" />
|
|
51
|
+
<created>1758904220063</created>
|
|
52
|
+
<option name="number" value="Default" />
|
|
53
|
+
<option name="presentableId" value="Default" />
|
|
54
|
+
<updated>1758904220063</updated>
|
|
55
|
+
<workItem from="1758904223004" duration="858000" />
|
|
56
|
+
<workItem from="1758905087256" duration="739000" />
|
|
57
|
+
<workItem from="1758969884874" duration="310000" />
|
|
58
|
+
</task>
|
|
59
|
+
<servers />
|
|
60
|
+
</component>
|
|
61
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
62
|
+
<option name="version" value="3" />
|
|
63
|
+
</component>
|
|
64
|
+
</project>
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Advanced Options
|
|
2
|
+
|
|
3
|
+
**During the beta version, the options are unstable, may get changed during updates.**
|
|
4
|
+
|
|
5
|
+
The main function of `deviceOverrides` is to convert "non-standard schema" to "standard schema", making the device compatible with this plugin.
|
|
6
|
+
|
|
7
|
+
Before configuring, you may need to:
|
|
8
|
+
- Have basic programming skills in JavaScript (Only used in `onGet`/`onSet` handlers).
|
|
9
|
+
- Understand the concept of device schema (also known as Data Type): [Tuya IoT Development Platform > Cloud Development > Standard Instruction Set > Data Type](https://developer.tuya.com/en/docs/iot/datatypedescription?id=K9i5ql2jo7j1k)
|
|
10
|
+
- Read the documentation of your device product in [SUPPORTED_DEVICES.md](./SUPPORTED_DEVICES.md).
|
|
11
|
+
- Obtain device info json from `/path/to/persist/TuyaDeviceList.xxx.json` (the full path can be found from logs).
|
|
12
|
+
- Locate any "incorrect schema" in your device info json, and convert it to the "correct schema".
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Configuration
|
|
16
|
+
|
|
17
|
+
`options.deviceOverrides` is an **optional** array of device overriding config objects, which is used for converting "non-standard schema" to "standard schema", making the device compatible with this plugin. The structure of each element in the array is described as follows:
|
|
18
|
+
|
|
19
|
+
- `id` - **required**: Device ID, Product ID, Scene ID, or `global`.
|
|
20
|
+
- `category` - **optional**: Device category code. See [SUPPORTED_DEVICES.md](./SUPPORTED_DEVICES.md). Also you can use `hidden` to hide the device, product, or scene. **⚠️Overriding this property may lead to unexpected behaviors and exceptions, so please remove the accessory cache after making changes.**
|
|
21
|
+
- `unbridged` - **optional**: Unbridge accessories. Defaults to `false`.
|
|
22
|
+
- `adaptiveLighting` - **optional**: Adaptive Lighting. Defaults to `false`. Not all light device support this feature, please use it on demand.
|
|
23
|
+
- `schema` - **optional**: An array of schema overriding config objects, used for describing datapoint (DP). When your device has non-standard DP, you need to transform them manually with configuration. Each element in the schema array is described as follows:
|
|
24
|
+
- `code` - **required**: DP code.
|
|
25
|
+
- `newCode` - **optional**: New DP code.
|
|
26
|
+
- `type` - **optional**: New DP type. One of `Boolean`, `Integer`, `Enum`, `String`, `Json`, or `Raw`.
|
|
27
|
+
- `property` - **optional**: New DP property object. For `Integer` type, the object should contain `min`, `max`, `scale`, and `step`. For `Enum` type, the object should contain `range`. For more information, see `TuyaDeviceSchemaProperty` in [TuyaDevice.ts](./src/device/TuyaDevice.ts).
|
|
28
|
+
- `onGet` - **optional**: A one-line JavaScript code to convert the old value to the new value. The function is called with two arguments: `device` and `value`.
|
|
29
|
+
- `onSet` - **optional**: A one-line JavaScript code to convert the new value to the old value. The function is called with two arguments: `device` and `value`. Returning `undefined` means to skip sending the command.
|
|
30
|
+
- `hidden` - **optional**: Hide the schema. Defaults to `false`.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Change category code
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
{
|
|
39
|
+
"options": {
|
|
40
|
+
// ...
|
|
41
|
+
"deviceOverrides": [{
|
|
42
|
+
"id": "{device_id}",
|
|
43
|
+
"category": "xxx"
|
|
44
|
+
}]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Hide device / scene
|
|
50
|
+
|
|
51
|
+
Just the same way as changing category code.
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
{
|
|
55
|
+
"options": {
|
|
56
|
+
// ...
|
|
57
|
+
"deviceOverrides": [{
|
|
58
|
+
"id": "{device_id_or_scene_id}",
|
|
59
|
+
"category": "hidden"
|
|
60
|
+
}]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Hide DP
|
|
66
|
+
|
|
67
|
+
An example of hide camera's floodlight (`floodlight_switch`):
|
|
68
|
+
```js
|
|
69
|
+
{
|
|
70
|
+
"options": {
|
|
71
|
+
// ...
|
|
72
|
+
"deviceOverrides": [{
|
|
73
|
+
"id": "{device_id}",
|
|
74
|
+
"schema": [{
|
|
75
|
+
"code": "floodlight_switch",
|
|
76
|
+
"hidden": true
|
|
77
|
+
}]
|
|
78
|
+
}]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Enable Adaptive Lighting
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
{
|
|
87
|
+
"options": {
|
|
88
|
+
// ...
|
|
89
|
+
"deviceOverrides": [{
|
|
90
|
+
"id": "{device_id}",
|
|
91
|
+
"adaptiveLighting": true
|
|
92
|
+
}]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Offline as off
|
|
99
|
+
|
|
100
|
+
If you want to display off status when device is offline:
|
|
101
|
+
```js
|
|
102
|
+
{
|
|
103
|
+
"options": {
|
|
104
|
+
// ...
|
|
105
|
+
"deviceOverrides": [{
|
|
106
|
+
"id": "{device_id}",
|
|
107
|
+
"schema": [{
|
|
108
|
+
"code": "{dp_code}",
|
|
109
|
+
"onGet": "(device.online && value)"
|
|
110
|
+
}]
|
|
111
|
+
}]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Change DP code
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
{
|
|
121
|
+
"options": {
|
|
122
|
+
// ...
|
|
123
|
+
"deviceOverrides": [{
|
|
124
|
+
"id": "{device_id}",
|
|
125
|
+
"schema": [{
|
|
126
|
+
"code": "{old_dp_code}",
|
|
127
|
+
"newCode": "{new_dp_code}"
|
|
128
|
+
}]
|
|
129
|
+
}]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
### Convert from enum DP to boolean DP
|
|
136
|
+
|
|
137
|
+
An example of convert `open`/`close` into `true`/`false`:
|
|
138
|
+
```js
|
|
139
|
+
{
|
|
140
|
+
"options": {
|
|
141
|
+
// ...
|
|
142
|
+
"deviceOverrides": [{
|
|
143
|
+
"id": "{device_id}",
|
|
144
|
+
"schema": [{
|
|
145
|
+
"code": "{dp_code}",
|
|
146
|
+
"type": "Boolean",
|
|
147
|
+
"onGet": "(value === 'open') ? true : false;",
|
|
148
|
+
"onSet": "(value === true) ? 'open' : 'close';"
|
|
149
|
+
}]
|
|
150
|
+
}]
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### Adjust integer DP ranges
|
|
157
|
+
|
|
158
|
+
Some odd thermostat stores double of the real value to keep the decimal part (0.5°C).
|
|
159
|
+
|
|
160
|
+
We need override both range and value in order to make it working. (Only override value is not enough, range is required too.)
|
|
161
|
+
|
|
162
|
+
Here's an example of the invalid schema:
|
|
163
|
+
```js
|
|
164
|
+
{
|
|
165
|
+
code: 'temp_set',
|
|
166
|
+
mode: 'rw',
|
|
167
|
+
type: 'Integer',
|
|
168
|
+
property: { unit: '℃', min: 10, max: 70, scale: 1, step: 5 }
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The value `41` actually represents for `20.5°C`, the range `10~70` actually represents for `5.0°C~35.0°C`.
|
|
173
|
+
|
|
174
|
+
To fix this, first we need set scale to `1`, and convert `41` to `205` when getting, convert `205` to `41` when getting, which means `value x 5` when getting, and `value / 5` when setting.
|
|
175
|
+
|
|
176
|
+
Here's the example config:
|
|
177
|
+
```js
|
|
178
|
+
{
|
|
179
|
+
"options": {
|
|
180
|
+
// ...
|
|
181
|
+
"deviceOverrides": [{
|
|
182
|
+
"id": "{device_id}",
|
|
183
|
+
"schema": [{
|
|
184
|
+
"code": "temp_set",
|
|
185
|
+
"onGet": "(value * 5);",
|
|
186
|
+
"onSet": "(value / 5);",
|
|
187
|
+
"property": {
|
|
188
|
+
"min": 50,
|
|
189
|
+
"max": 350,
|
|
190
|
+
"scale": 1,
|
|
191
|
+
"step": 5
|
|
192
|
+
}
|
|
193
|
+
}]
|
|
194
|
+
}]
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
After transform value using `onGet` and `onSet`, and new range in `property`, it should be working now.
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
### Reverse curtain motor's on/off state
|
|
203
|
+
|
|
204
|
+
Most curtain motor have "reverse mode" setting in the Tuya App, if you don't have this, you can reverse `percent_control`/`position` and `percent_state` in the plugin config:
|
|
205
|
+
|
|
206
|
+
```js
|
|
207
|
+
{
|
|
208
|
+
"options": {
|
|
209
|
+
// ...
|
|
210
|
+
"deviceOverrides": [{
|
|
211
|
+
"id": "{device_id}",
|
|
212
|
+
"schema": [{
|
|
213
|
+
"code": "percent_control",
|
|
214
|
+
"onGet": "(100 - value)",
|
|
215
|
+
"onSet": "(100 - value)"
|
|
216
|
+
}, {
|
|
217
|
+
"code": "percent_state",
|
|
218
|
+
"onGet": "(100 - value)",
|
|
219
|
+
"onSet": "(100 - value)"
|
|
220
|
+
}]
|
|
221
|
+
}]
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
### Skip send on/off command when touching brightness/speed slider
|
|
228
|
+
|
|
229
|
+
Some products (dimmer, fan) having issue when sending brightness/speed command with on/off command together. Here's an example of skip on/off command.
|
|
230
|
+
|
|
231
|
+
```js
|
|
232
|
+
{
|
|
233
|
+
"options": {
|
|
234
|
+
// ...
|
|
235
|
+
"deviceOverrides": [{
|
|
236
|
+
"id": "{device_id}",
|
|
237
|
+
"schema": [{
|
|
238
|
+
"code": "switch_led",
|
|
239
|
+
"onSet": "(value === device.status.find(status => status.code === 'switch_led').value) ? undefined : value"
|
|
240
|
+
}]
|
|
241
|
+
}]
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
### Convert Fahrenheit to Celsius
|
|
248
|
+
|
|
249
|
+
F = 1.8 * C + 32
|
|
250
|
+
|
|
251
|
+
C = (F - 32) / 1.8
|
|
252
|
+
|
|
253
|
+
```js
|
|
254
|
+
{
|
|
255
|
+
"options": {
|
|
256
|
+
// ...
|
|
257
|
+
"deviceOverrides": [{
|
|
258
|
+
"id": "{device_id}",
|
|
259
|
+
"schema": [{
|
|
260
|
+
"code": "temp_current",
|
|
261
|
+
"onGet": "Math.round((value - 32) / 1.8);",
|
|
262
|
+
"onSet": "Math.round(1.8 * value + 32);"
|
|
263
|
+
}]
|
|
264
|
+
}]
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
```
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.7.0] - (unreleased)
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Add scene support. (#118)
|
|
7
|
+
- Add Wireless Switch support (`wxkg`).
|
|
8
|
+
- Add Solar Light support (`tyndj`).
|
|
9
|
+
- Add Dehumidifier support (`cs`).
|
|
10
|
+
- Add Scene Switch support (`wxkg`).
|
|
11
|
+
- Add device overriding config support. "Non-standard DP" devices have possibility to be supported now. (#119)
|
|
12
|
+
- Add Camera support (`sp`). Thanks @ErrorErrorError for the contribution
|
|
13
|
+
- Add Air Conditioner support (`kt`). (#160)
|
|
14
|
+
- Add Air Conditioner Controller support (`ktkzq`). (#160)
|
|
15
|
+
- Add Diffuser support (`xxj`). (#175)
|
|
16
|
+
- Add Temperature Control Socket support (`wkcz`).
|
|
17
|
+
- Add Environmental Detector support (`hjjcy`).
|
|
18
|
+
- Add Water Valve Controller support (`sfkzq`).
|
|
19
|
+
- Add IR Remote Control support (`infrared_tv`, `infrared_stb`, `infrared_box`, `infrared_ac`, `infrared_fan`, `infrared_light`, `infrared_amplifier`, `infrared_projector`, `infrared_waterheater`, `infrared_airpurifier`). (#191)
|
|
20
|
+
- Add IR AC Controller support (`hwktwkq`).
|
|
21
|
+
- Add Fingerbot support (`szjqr`).
|
|
22
|
+
- Add Smart Lock support (`ms`, `jtmspro`). (#120) Thanks @pfgimutao for the contribution
|
|
23
|
+
- Add Alarm Host support (`mal`). (#246) Thanks @bFollon for the contribution
|
|
24
|
+
- Add Vibration Sensor support (`zd`). (#262)
|
|
25
|
+
- Add adaptive lighting support. (#272)
|
|
26
|
+
- Add Wireless Doorbell support (`wxml`). (#277)
|
|
27
|
+
- Add IR Remote Control support (`wsdykq`).
|
|
28
|
+
- Add Layout to display schema in sections. (#283) Thanks @donavanbecker for the contribution
|
|
29
|
+
- Add option to make accessory and unbridged accessory (#285) Thanks @donavanbecker for the contribution
|
|
30
|
+
- Add inching button for switches.
|
|
31
|
+
- Add support to 2ch windows covering. (#339) Thanks @CryptoIR for the contribution
|
|
32
|
+
- Add retry when network error happened.
|
|
33
|
+
- Add Pet Feeder support (`cwwsq`). (#483) Thanks @aselekoglu for the contribution
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
- Fix `RotationSpeed` missing one level. (#170)
|
|
38
|
+
- Fix `bright_value` not sent for the `C/CW` lights who doesn't have `work_mode`. (#171)
|
|
39
|
+
- Fix crash when camera sends an invalid status message.
|
|
40
|
+
- Fix incorrect Door and Window Controller state. (#178)
|
|
41
|
+
- Fix Thermostat cold mode not working (#242).
|
|
42
|
+
- Order temp before get the min and max for IRAirConditionerAccessory. (#433) Thanks @tuliocll for the contribution
|
|
43
|
+
- Fix energy usage not updated after homebridge restart. (#268)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
- Support Ceiling Fan icon customize and Floor Fan `lock`, `swing` feature. (#131)
|
|
48
|
+
- Adjust humidity range of dehumidifier and humidifier.
|
|
49
|
+
- Print scene id in logs.
|
|
50
|
+
- Update support for RGB Power Switch (`dj`).
|
|
51
|
+
- Support showing device online status via `StatusActive`. (#172)
|
|
52
|
+
- Update unit and range of `RotationSpeed`, need clean accessory cache to take effect. (#174, #273)
|
|
53
|
+
- Support Diffuser RGB light. (#184)
|
|
54
|
+
- Support Fan light temperature and color. (#184)
|
|
55
|
+
- Support Humidifier light. (#184)
|
|
56
|
+
- Expose energy usage for outlets/switches. (#190) Thanks @lstrojny for the contribution
|
|
57
|
+
- Strict config validate for `deviceOverrides`. (#278)
|
|
58
|
+
- Support AirPurifier air quality.
|
|
59
|
+
- Throw `HapStatusError` when device is offline.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## [1.6.0] - (2022.12.3)
|
|
63
|
+
|
|
64
|
+
This version has been completely rewritten in TypeScript, brings a lot of bug fix and new device support.
|
|
65
|
+
|
|
66
|
+
### New Accessories
|
|
67
|
+
- Add CO Detector support (`cobj`).
|
|
68
|
+
- Add CO2 Detector support (`co2bj`).
|
|
69
|
+
- Add Water Detector support (`sj`).
|
|
70
|
+
- Add Temperature and Humidity Sensor support (`wsdcg`, `wnykq`). Thanks @bimusiek for the contribution
|
|
71
|
+
- Add Light Sensor support (`ldcg`).
|
|
72
|
+
- Add Motion Sensor support (`pir`).
|
|
73
|
+
- Add PM2.5 Detector support (`pm25`).
|
|
74
|
+
- Add Door and Window Controller support (`mc`).
|
|
75
|
+
- Add Curtain Switch support (`clkg`). (#8)
|
|
76
|
+
- Add Human Presence Sensor support (`hps`). (#17)
|
|
77
|
+
- Add Thermostat support (`wk`). (#19) Thanks @burcadoruciprian for the contribution
|
|
78
|
+
- Add Spotlight support (`sxd`). (#21)
|
|
79
|
+
- Add Irrigator support (`ggq`). (#28)
|
|
80
|
+
- Add Scene Light Socket support (`qjdcz`). (#33)
|
|
81
|
+
- Add Ceiling Fan Light support (`fsd`). (#37)
|
|
82
|
+
- Add Thermostat Valve support (`wkf`). (#50)
|
|
83
|
+
- Add Motion Sensor Light support (`gyd`). (#65)
|
|
84
|
+
- Add Multiple Dimmer and Dimmer Switch support (`tgq`, `tgkg`). (#82)
|
|
85
|
+
- Add Humidifier support (`jsq`). (#89) Thanks @akaminsky-net for the contribution
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### Added
|
|
89
|
+
- Add config validation during plugin initialization.
|
|
90
|
+
- Add instruction message for handling API errors.
|
|
91
|
+
- Add debounce in `BaseAccessory.sendCommands()` for better API request peformance.
|
|
92
|
+
- Persist `TuyaDeviceList.{uid}.json` for debugging. (#41)
|
|
93
|
+
- Add `homeWhitelist` option for whitelisting homes. (#84) Thanks @JulianLepinski for the contribution
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Fixed
|
|
97
|
+
- Fix 1004 signature error when url query has more than 2 elements.
|
|
98
|
+
- Fix 1010 token expired error when refresh access_token.
|
|
99
|
+
- Fix 1106 permission error when polling device info list.
|
|
100
|
+
- Fix 1100, 2017 errors when login. (via config validation)
|
|
101
|
+
- Fix Lightbulb `RGBW` and `RGBCW` work mode not switched properly (#12 #56 #59)
|
|
102
|
+
- Fix Lightbulb color temperature not working. (#13)
|
|
103
|
+
- Fix Thermostat temperature units handling. (#20)
|
|
104
|
+
- Fix Thermostat mode handling. (#26)
|
|
105
|
+
- Fix Curtain Switch with no position feature. (#27)
|
|
106
|
+
- Fallback when receiving MQTT message with wrong order. (#35)
|
|
107
|
+
- Fix wrong temperature on sensor. (#38)
|
|
108
|
+
- Fix fan speed issue. (#46 #51)
|
|
109
|
+
- Workaround for Thermostat with wrong schema property (#74)
|
|
110
|
+
- Fix Contact Sensor not working (#75)
|
|
111
|
+
- Fix iOS 16 default accessory name issue. (#85)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Changed
|
|
115
|
+
- Rewritten in TypeScript, brings benefits of type checking, smart code hints, etc.
|
|
116
|
+
- Reimplement accessory logics. More friendly for accessory developers.
|
|
117
|
+
- Update device info list polling logic. Less API errors.
|
|
118
|
+
- Now `Manufactor`, `Serial Number` and `Model` will be correctly displayed in HomeKit.
|
|
119
|
+
- All devices will be shown in HomeKit by default (Including unsupported device).
|
|
120
|
+
- Updated unit test.
|
|
121
|
+
- Updated documentations. Thanks @prabch for the contribution
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Removed
|
|
125
|
+
- Remove `debug` option. Silence logs for users. For debugging, please refer to [troubleshooting](https://github.com/homebridge-plugins/homebridge-tuya#troubleshooting).
|
|
126
|
+
- Remove `lang` option.
|
|
127
|
+
- Remove `username` and `password` options for `Custom` project. User will be created and authorized automatically. (#11)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2021 Tuya Inc.
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
17
|
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
19
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
20
|
+
DEALINGS IN THE SOFTWARE.
|