|
8 | 8 | * - Required : Create one http controler per device to control your tuya devices |
9 | 9 | * [VAR1] : id of device (go to smart life app, edit device go to device infos, id is value on "virtual id" |
10 | 10 | * Values : |
11 | | - * OFF : value 0, url http://localhost/script/?exec=tuya_smart_life.php&actionDeviceId=[VAR1]&actionDeviceValue=0 |
12 | | - * ON : value 100, url http://localhost/script/?exec=tuya_smart_life.php&actionDeviceId=[VAR1]&actionDeviceValue=1 |
| 11 | + * Off : value 0, url http://localhost/script/?exec=tuya_smart_life.php&actionDeviceId=[VAR1]&actionDeviceValue=0 |
| 12 | + * On : value 100, url http://localhost/script/?exec=tuya_smart_life.php&actionDeviceId=[VAR1]&actionDeviceValue=1 |
| 13 | + * Offline : masqué, value 200, url http://localhost/script/?exec=tuya_smart_life.php&actionDeviceId=[VAR1] |
13 | 14 | * - Optional : Create one http sensor to update status of your controlers if you use smart life app to control your tuya devices too |
14 | 15 | * Url : http://localhost/script/?exec=tuya_smart_life.php&refreshDevices=true |
15 | 16 | * XPath : /root/status |
|
34 | 35 | ); |
35 | 36 | // Mapping tuya id to eedomus id |
36 | 37 | $devicesAssoc = array( |
37 | | - '111222333' => '123', |
38 | | - '444555666' => '456', |
| 38 | + '123123123' => '321321', |
| 39 | + '456456456' => '654654', |
39 | 40 | ); |
40 | 41 |
|
41 | 42 |
|
@@ -213,6 +214,7 @@ function sdk_action($url, $token, $deviceId, $deviceValue) { |
213 | 214 | foreach ($devicesAssoc as $tuya => $eedomus) { |
214 | 215 | $value = getValue($eedomus); |
215 | 216 | $newValue = $devices[$tuya]['data']['state'] ? 100 : 0; |
| 217 | + $newValue = $devices[$tuya]['data']['online'] ? $newValue : 200; |
216 | 218 | if ($value['value'] != $newValue) { |
217 | 219 | setValue($eedomus, $newValue, false, true); |
218 | 220 | } |
|
0 commit comments