tuya / tuya-iot-python-sdk

Tuya IoT Python SDK for Tuya Open API.
MIT License
125 stars 48 forks source link

Wrong endpoint url used in get_device_status implementation #71

Open tyge68 opened 1 year ago

tyge68 commented 1 year ago

Currently to get the device status according to Tuya developer API documentation (1) , it need the suffix '/status' Without that suffix it uses another endpoint for device details, which won't return the status for some type of devices (could be also an issue at Tuya itself with 'sub devices').

https://github.com/tuya/tuya-iot-python-sdk/blob/main/tuya_iot/device.py#L592 Fix could be following

    def get_device_status(self, device_id: str) -> dict[str, Any]:
        return self.api.get(f"/v1.0/devices/{device_id}/status")

(1) https://eu.iot.tuya.com/cloud/explorer?id=p1672264192429jq7u3m&groupId=group-home&interfaceId=470224763027537