prasad-edlabadka / homebridge-tuya-ir

Allows homebridge to control Tuya Smart IR based devices
Apache License 2.0
50 stars 22 forks source link

updating device status / state on HB restart #25

Closed bkarlson closed 2 years ago

bkarlson commented 2 years ago

First of all, thanks for the plugin, it was very easy to set up and turn all home a/c into HomeKit controlled devices.

One small issue however: seems like default Tuya API for device status returns empty array for IR-controlled devices, and it makes impossible to recover true device status upon HB restart. Example logs from startup:

[10/21/2021, 8:55:16 PM] [TuyaIR] [
  {
    "active_time": 1634647351,
    "biz_type": 0,
    "category": "infrared_ac",
    "create_time": 1634647351,
    "icon": "smart/ir/icon/9knfrm4eawao.png",
    "id": "zzz",
    "ip": "",
    "lat": "123",
    "local_key": "xxx",
    "lon": "123",
    "model": "",
    "name": "Kitchen a/c",
    "node_id": "xxx",
    "online": true,
    "owner_id": "111",
    "product_id": "0000009koq",
    "product_name": "Air Conditioner",
    "status": [],
    "sub": true,
    "time_zone": "+07:00",
    "uid": "xxx",
    "update_time": 1634712606,
    "uuid": "yyy"
  }
]

As you can see, status is [], which is not helpful. In Tuya app I can see correct statuses, but HB and HK don't see them once HB is restarted.

I found another API, but cannot test it easily: https://developer.tuya.com/en/docs/cloud/universal-infrared?id=K9jgsgd7buln4#title-31-Query%20air%20conditioner%20status

Maybe you can query that one for true device status?

Same applies for fans. Not sure about switches.

Thanks in advance!

prasad-edlabadka commented 2 years ago

Please check release v0.1.3

Thanks to @donkeystudio for the updates.