tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
878 stars 207 forks source link

Thermostat updates current_temperature only then Smart Life app is opened #971

Open mistrello96 opened 10 months ago

mistrello96 commented 10 months ago

Describe the bug

Thermostat current_temperature is updated only when smart life app is opened on the phone

Expected behavior

The thermostat current_temperature should be updatet regurarly, without the smart life opened on the phone

Diagnostics for integrations and devices

config_entry-tuya-f2e10bb6901610d9d311082b6b9011bd.json.txt

Screenshots

The problem is that the thermostat reports the current temperature only when smart life app is opened. As soon as the app is opened, this call is made to tuya servers Screenshot 2024-01-11 093249 that triggers a new data report from the thermostat. The same call should be done regurarly from the integration to "ask" the updated data from the thermostat

Home Assistant Version

mistrello96 commented 9 months ago

I have found a workaround that works for me.

Using the IOT TUYA API, I have discovered all the device properties and found out that 唤醒通知 is a property called "week_up_btn" (probably misspelled wake).

If you set that property to true, it triggers the device to report the status and then reset to default.

The workaround is setting this property to true every x seconds, making the device report regularly.

I'm not sure if this applies to other devices, but for my thermostat works.

carlossg commented 8 months ago

@mistrello96 which API have you used to see and set the property? I've tried multiple ones and only see the same properties as in android app / HASS

mistrello96 commented 8 months ago

I used the "query things data model" to extract the correct property, should be

Once you identify the property you want to edit, i used the "send property" api to set it/trigger it

carlossg commented 8 months ago

I've tried that but the model for my temperature sensor don't have that property

```json { "modelId": "e8edx0", "services": [ { "actions": [], "code": "", "description": "", "events": [], "name": "默认服务", "properties": [ { "abilityId": 1, "accessMode": "ro", "code": "temp_current", "description": "", "extensions": { "iconName": "icon-dp_temp", "attribute": "1664", "trigger": "direct" }, "name": "温度", "typeSpec": { "max": 600, "min": -99, "scale": 1, "step": 1, "type": "value", "typeDefaultValue": -99, "unit": "℃" } }, { "abilityId": 2, "accessMode": "ro", "code": "humidity_value", "description": "", "extensions": { "iconName": "icon-shidu", "attribute": "1664", "trigger": "direct" }, "name": "湿度", "typeSpec": { "max": 99, "min": 0, "scale": 0, "step": 1, "type": "value", "typeDefaultValue": 0, "unit": "%" } }, { "abilityId": 4, "accessMode": "ro", "code": "battery_percentage", "description": "", "extensions": { "iconName": "icon-dp_battery", "attribute": "1152", "trigger": "direct" }, "name": "电池电量", "typeSpec": { "max": 100, "min": 0, "scale": 0, "step": 1, "type": "value", "typeDefaultValue": 0, "unit": "%" } }, { "abilityId": 9, "accessMode": "rw", "code": "temp_unit_convert", "description": "", "extensions": { "iconName": "icon-dp_mode", "attribute": "1152" }, "name": "温标", "typeSpec": { "range": [ "c", "f" ], "type": "enum", "typeDefaultValue": "c" } }, { "abilityId": 23, "accessMode": "rw", "code": "temp_calibration", "description": "", "extensions": { "iconName": "icon-dp_loop" }, "name": "温度校准", "typeSpec": { "max": 20, "min": -20, "scale": 1, "step": 1, "type": "value", "typeDefaultValue": -20, "unit": "℃" } }, { "abilityId": 24, "accessMode": "rw", "code": "hum_calibration", "description": "", "extensions": { "iconName": "icon-icon-percent" }, "name": "湿度校准", "typeSpec": { "max": 10, "min": -10, "scale": 0, "step": 1, "type": "value", "typeDefaultValue": -10, "unit": "%" } } ] } ] } ```

Tried POST to v2.0/cloud/thing/{{device_id}}/shadow/properties/issue but no luck, got a 501 request fail with unkown error

{
  "properties": {
    "week_up_btn": true
  }
}

@mistrello96 where did you get the low level logs to know what messages are sent when the smart life app is open?

mistrello96 commented 8 months ago

I got them in the device log

Rotaderp45 commented 2 weeks ago

this is still not solved ?

human211 commented 1 week ago

I have the same problem with key holder Lockin L1