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

Blank version in device file causes issue. #4

Open
psmedley opened this issue May 29, 2024 · 8 comments
Open

Blank version in device file causes issue. #4

psmedley opened this issue May 29, 2024 · 8 comments

Comments

@psmedley
Copy link

psmedley commented May 29, 2024

With python 3.11, I'm seeing the following when running server.py:

Exception in thread Thread-3 (start_device_monitor):
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/home/psmedley/tuya_mqtt/./server.py", line 708, in start_device_monitor
    dm = DeviceMonitor(device_info)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/psmedley/tuya_mqtt/./server.py", line 53, in __init__
    self.version = float(device_info["version"])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: ''
@psmedley
Copy link
Author

OK... this is due to my blinds having:
"version": ""
in devices.json

@spinza
Copy link
Owner

spinza commented May 29, 2024

Have you connected your blinds to tuya online for more than a day or two. Some of that stuff only populates after some time?

If so then I'd suggest you just replace "" with "0.1" or something (in that file). It's not critical. Will make a fix for it if you confirm that your devices has been connected to the paltform long enough.

@psmedley
Copy link
Author

psmedley commented May 29, 2024

they've only been connected for 24 hours or so. I did regenerate devices.json this evening. I did change it to "0" and the error went away, but now I'm seeing:

2024-05-29 19:34:27,753 - tuya_mqtt - INFO - Starting tuya_mqtt...
2024-05-29 19:34:27,753 - tuya_mqtt - INFO - Creating device threads...
2024-05-29 19:34:27,753 - tuya_mqtt - INFO - Starting device threads...
2024-05-29 19:34:27,754 - tuya_mqtt - INFO - Initialising device instance for Gateway...
2024-05-29 19:34:27,754 - tuya_mqtt - INFO - Gateway connecting to mqtt...
2024-05-29 19:34:27,755 - tuya_mqtt - INFO - Connecting to Gateway...
2024-05-29 19:34:27,755 - tuya_mqtt - INFO - Gateway connected to MQTT...
2024-05-29 19:34:29,595 - tuya_mqtt - ERROR - Cound not connect to Gateway
2024-05-29 19:34:32,754 - tuya_mqtt - INFO - Initialising device instance for Paul's Blind...
2024-05-29 19:34:32,754 - tuya_mqtt - INFO - Paul's Blind connecting to mqtt...
2024-05-29 19:34:32,755 - tuya_mqtt - INFO - Connecting to Paul's Blind...
2024-05-29 19:34:32,755 - tuya_mqtt - INFO - Paul's Blind connected to MQTT...
2024-05-29 19:34:37,755 - tuya_mqtt - INFO - Initialising device instance for Julie's Blind...
2024-05-29 19:34:37,755 - tuya_mqtt - INFO - Julie's Blind connecting to mqtt...
2024-05-29 19:34:37,756 - tuya_mqtt - INFO - Connecting to Julie's Blind...
2024-05-29 19:34:37,756 - tuya_mqtt - INFO - Julie's Blind connected to MQTT...
2024-05-29 19:34:37,756 - tuya_mqtt - ERROR - Cound not connect to Julie's Blind
2024-05-29 19:34:50,757 - tuya_mqtt - ERROR - Cound not connect to Paul's Blind

Is it connecting using the cloud api or local? the blinds don't have a local IP address, only the gateway does.

@spinza spinza changed the title Error with Python 3.11 Blank version in device file causes issue. May 29, 2024
@spinza
Copy link
Owner

spinza commented May 29, 2024

Renamed this issue. Can you make a separate issue for the 2nd part please.

@spinza
Copy link
Owner

spinza commented May 29, 2024

Actually try update your devices file again. Or set version to 3.1. It's actually important.

@psmedley
Copy link
Author

I think both these issues are related. These are zigbee blinds - so support RF and zigbee control. They don't have a local IP address (and hence (I think) don't have a protocol version).

i'm assuming you're using local control, which may not work with these blinds as they don't have IP addresses. In my case, I'll need to use cloud control. I'll take a look at server.py over the weekend...

@spinza
Copy link
Owner

spinza commented May 29, 2024

Yes, I have started to agree. If the devices don't support local control (via local connections) it's not going to work. I've set this project up to use local connections as connecting via cloud is slow and the number of API requests are limited.

Check if the gateway doesn't expose controls for the attached devices? Also fetch the devices file again after a day or two. Maybe you're lucky.

I'll probably change the code to not connect if the device doesn't have a valid version.

@spinza
Copy link
Owner

spinza commented May 29, 2024

Actually also look at this:
jasonacox/tinytuya#117

Try the different scan options and check those.

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

2 participants