Skip to content
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

New version don't working stable with WiFi devices #238

Closed
Der-Nax opened this issue Sep 21, 2022 · 11 comments
Closed

New version don't working stable with WiFi devices #238

Der-Nax opened this issue Sep 21, 2022 · 11 comments

Comments

@Der-Nax
Copy link

Der-Nax commented Sep 21, 2022

Hi,
I installed new version 0.19.0.
All my WiFi Tuya devices stop working stable.
Generally all my devices - unavailable. Time to time one or two param get info.
See screenshots
TuyaLocalError1
TuyaLocalError2
After downgrade back to 0.18.2 - all devices working properly.
Please check new version.
How I may help you?

@evlo
Copy link

evlo commented Sep 22, 2022

Same with Kogan Wi-Fi convection panel heaters - KAHTP and KAWFHTP models

Integration seems to be able to get data from the device until integration tries to do any set, then device become unavailable.

Probably this, but i'm not sure

Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/tinytuya/core.py", line 490, in _get_socket
    self.socket.connect((self.address, self.port))
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/tuya_local/device.py", line 240, in _retry_on_failed_connection
    func()
  File "/config/custom_components/tuya_local/device.py", line 221, in <lambda>
    lambda: self._send_payload(payload), "Failed to update device state."
  File "/config/custom_components/tuya_local/device.py", line 227, in _send_payload
    self._api._send_receive(payload)
  File "/usr/local/lib/python3.10/site-packages/tinytuya/core.py", line 581, in _send_receive
    if not self._get_socket(False):
  File "/usr/local/lib/python3.10/site-packages/tinytuya/core.py", line 506, in _get_socket
    self.socket.close()
AttributeError: 'NoneType' object has no attribute 'close'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.10/threading.py", line 1378, in run
    self.function(*self.args, **self.kwargs)
  File "/config/custom_components/tuya_local/device.py", line 220, in _send_pending_updates
    self._retry_on_failed_connection(
  File "/config/custom_components/tuya_local/device.py", line 250, in _retry_on_failed_connection
    self._rotate_api_protocol_version()
  File "/config/custom_components/tuya_local/device.py", line 279, in _rotate_api_protocol_version
    self._api.set_version(new_version)
  File "/usr/local/lib/python3.10/site-packages/tinytuya/core.py", line 825, in set_version
    self.dps_to_request = self.detect_available_dps()
  File "/usr/local/lib/python3.10/site-packages/tinytuya/core.py", line 803, in detect_available_dps
    if "dps" in data:
TypeError: argument of type 'NoneType' is not iterable

I did not found anything better in log then this :(

device.py was last changed 10 months ago so maybe the tinytuya actually?

Affected device is

    "api_version": 3.3,

@make-all
Copy link
Owner

Thanks for this info. There are some changes upstream since the tinytuya 1.6.6 release regarding closing and reopening of sockets, so hopefully the next release will fix it.

@make-all
Copy link
Owner

For now I've marked the last release as a beta to avoid deploying it further until the cause and solution have been found.

@make-all make-all added the awaiting confirmation Wating for confirmation the issue is solved label Sep 23, 2022
@make-all
Copy link
Owner

I have released 0.19.1 with the changes previously made for #195 reverted. I think this is the most likely cause of the problem, based on information here and on #237, and I think I reproduced the problem on 0.19.0 with one of my devices, but the same steps work OK on 0.19.1. Please let me know if 0.19.1 is working OK for you.

@Der-Nax
Copy link
Author

Der-Nax commented Sep 23, 2022

I updated my installation.
It look fine after update.
I'll check for 1-2 days.

@evlo
Copy link

evlo commented Sep 23, 2022

Looks ok so far.


BTW for my Kogan Wi-Fi convection panel heaters - KAHTP and KAWFHTP models I still becomes unavailable for minute or so, after any change, it was doing it even on 18.2 and older. I think it works a bit better with tuya cloud, but it is tuya cloud. I think it might be time to flash esphome on it finally as luckily it is year old and does have espressif chip. Although i noticed Poland made some great progress at open sourcing new tuya arm espressif chip rellacements.

@mverbnyak
Copy link

Hello. you can add this thermostat. pleaseimage

@Der-Nax
Copy link
Author

Der-Nax commented Sep 23, 2022

Hello. you can add this thermostat. pleaseimage

Please open new issue.
Also you may try to do it by yourself.
Anyway it is nessasary more detailed information about you device.

@evlo
Copy link

evlo commented Sep 23, 2022

Failed to refresh device state for glass panel heater koupeln

Last logged: 10:46:44 PM
First occurred: 10:30:35 PM (22 occurrences)
Integration: Tuya Local ([documentation](https://github.com/make-all/tuya-local), [issues](https://github.com/make-all/tuya-local/issues))
Source: custom_components/tuya_local/device.py:132
Logger: custom_components.tuya_local.device
Logger: homeassistant.components.climate
Source: helpers/entity_platform.py:796
Integration: Climate ([documentation](https://www.home-assistant.io/integrations/climate), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+climate%22))
First occurred: 10:32:37 PM (7 occurrences)
Last logged: 10:48:37 PM
Logger: homeassistant.components.lock
Source: helpers/entity_platform.py:796
Integration: Lock ([documentation](https://www.home-assistant.io/integrations/lock), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+lock%22))
First occurred: 10:31:37 PM (26 occurrences)
Last logged: 10:48:37 PM

Updating tuya_local lock took longer than the scheduled update interval 0:00:30
Updating tuya_local climate took longer than the scheduled update interval 0:01:00
Logger: homeassistant.components.number
Source: helpers/entity_platform.py:796
Integration: Number ([documentation](https://www.home-assistant.io/integrations/number), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+number%22))
First occurred: 10:31:37 PM (26 occurrences)
Last logged: 10:48:37 PM

Updating tuya_local number took longer than the scheduled update interval 0:00:30

with 1.8.2 it becomes unavailable, but after while it comes back, with 1.9.1 nope

Integration is better than 1.9.0 in that entity does not become unavailable so often/randomly, but integration never picks device up after it becomes unavailable for whatever (tuya weird) reason

@Der-Nax
Copy link
Author

Der-Nax commented Sep 23, 2022

I updated my installation.
It look fine after update.
I'll check for 1-2 days.

I'm sorry. New version didn't solve the problem. The same trouble. Don't work properly.

make-all added a commit that referenced this issue Sep 24, 2022
Attempt at resolving issues #237, #238
@make-all
Copy link
Owner

1.9.2 reverts the tinytuya library to the previous version. This seems to be working so far for other users.

@Der-Nax Der-Nax closed this as completed Oct 2, 2022
@make-all make-all removed the awaiting confirmation Wating for confirmation the issue is solved label Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants