TuyaAPI / cli

🔧 A CLI for Tuya devices
MIT License
261 stars 44 forks source link

Empty response from tuya-cli get #166

Closed mashedkeyboard closed 10 months ago

mashedkeyboard commented 10 months ago

Hi folks, getting a very strange problem here: tuya-cli get fails with absolutely no response at all from some Tuya smart bulbs I have.

My motivation for looking at this is that I have a Home Assistant setup that's meant to have control over the bulbs, but after a period of time disconnected from the Internet, they seem to just reset themselves and refuse to do anything until reconnected. When they reconnect, they retain the same local key, though - so I'm confused as to why they're dropping.

In any event, running tuya-cli in either state, whether the bulbs are working with Home Assistant or not, returns this output:

$ DEBUG="*" tuya-cli get --ip 10.1.1.74 --key "[correct local key that works with Home Assistant]" --full -s --id [correct ID that works with Home Assistant] --protocol-version 3.3
  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to 10.1.1.74... +14ms
  TuyAPI Socket connected. +103ms
  TuyAPI GET Payload: +12ms
  TuyAPI {
  TuyAPI   gwId: '[correct ID that works with Home Assistant]',
  TuyAPI   devId: '[correct ID that works with Home Assistant]',
  TuyAPI   t: '1691756608',
  TuyAPI   dps: {},
  TuyAPI   uid: '[correct ID that works with Home Assistant]'
  TuyAPI } +1ms
  TuyAPI Socket closed: 10.1.1.74 +90ms
  TuyAPI Disconnect +1ms

I'm struggling to understand why this is happening. I've tried protocol versions 3.1 through 3.3, with no change: I've also tried requesting specific DPIDs, but the dps parameter seems not to change (assuming that's client-side filtered then?).

Any advice or suggestions?

mashedkeyboard commented 10 months ago

...My devices were running protocol version 3.4, and I had totally missed that. This is entirely my own stupid fault - apologies!