jasonacox / tinytuya

Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).
MIT License
868 stars 157 forks source link

IRRemoteControlDevice constructor stuck in forever loop if can't connect to device #403

Closed simon-kuzin closed 7 months ago

simon-kuzin commented 10 months ago

root cause def detect_control_type( self ):

while status: ...
status = self._send_receive(None)

in case of connection failure _send_receive returns

return error_json( sock_result if sock_result else ERR_OFFLINE )

i.e. JSON representation of error which obviously evaluates to "True" in while status: statement

resolution - add proper error handling after status = self._send_receive(None)