-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
default22 device #56
Comments
As you can see from the debug, a payload is generated and an attempt to send to the device happens. It detects the "unvalid" string which indicates the device needs 'device22' type. The retry logic attempts to send the same command payload again but with the 'device22' settings. It could be that it needs more time and I can add a delay, but it could also be that the payload that was generated also includes a timestamp. That device likely sees the same timestamp and responds with a Null. I need to do some testing to see what would be the right way to address that. In the meantime, you can add retry logic to your code to make another get status call if you get a |
I had make it - just retry.But i think its normal that resend must be worked. Tnx - its great work ! |
Hi - i had found problem.
What i do
and inside _send_receive
Its problem only with status, because payload_dict has diffrrent
another command work , its has same payload_dict as default - but need check all. |
Great find and great suggestion... I will work on a fix! In the meantime, the workaround would be to set the device22 setting during initialization instead of letting it detect: d = tinytuya.OutletDevice(ID, IP, KEY, 'device22') |
Ok, I added logic to send back ERR_DEVTYPE when device22 is auto-detected. The status() function now has logic to rebuild the payload and retry. You can _send_receive() # Did we detect a device22 device? Return ERR_DEVTYPE error.
if dev_type != self.dev_type:
log.debug(
"Device22 detected and updated (%s -> %s) - Update payload and try again",
dev_type,
self.dev_type,
)
result = error_json(ERR_DEVTYPE) status() def status(self):
"""Return device status."""
log.debug('status() entry (dev_type is %s)', self.dev_type)
payload = self.generate_payload(DP_QUERY)
data = self._send_receive(payload)
log.debug('status() received data=%r', data)
# Error handling
if 'Err' in data:
if data['Err'] == str(ERR_DEVTYPE):
# Device22 detected and change - resend with new payload
log.debug('status() rebuilding payload for device22')
payload = self.generate_payload(DP_QUERY)
data = self._send_receive(payload)
return data |
Tnx |
@IMCAgro Just to confirm, this is working for you? |
Yes - its works as expected |
Well one of my device is in
Problem :
I am tryinig get_status and its always return None.
But if we call get status again - its normal return data. So re-send data is not working.
I think need some timeout ?
The text was updated successfully, but these errors were encountered: