Coder Social home page Coder Social logo

tuya_mqtt's People

Contributors

spinza avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

tuya_mqtt's Issues

Blank version in device file causes issue.

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: ''

Docker

Great project! I'd like to make a request for a docker version please :)

NOT WORK

Always have error

2024-03-21 02:27:49,836 - tuya_mqtt - INFO - Starting tuya_mqtt...
2024-03-21 02:27:49,837 - tuya_mqtt - ERROR - Device file not found.
(.venv) root@spruthub:/opt/tuya_mqtt# ls -al
total 88
drwxr-xr-x 4 root root  4096 Mar 21 02:10 .
drwxr-xr-x 5 root root  4096 Mar 21 01:55 ..
-rw-r--r-- 1 root root   989 Mar 21 01:55 config_defaults.py
-rw-r--r-- 1 root root   529 Mar 21 01:55 config.py
-rw-r--r-- 1 root root  2682 Mar 21 02:16 devices.json
-rw-r--r-- 1 root root  1223 Mar 21 01:55 .gitignore
drwxr-xr-x 2 root root  4096 Mar 21 01:58 __pycache__
-rw-r--r-- 1 root root  2018 Mar 21 01:55 README.md
-rw-r--r-- 1 root root   299 Mar 21 01:58 requirements.txt
-rwxr-xr-x 1 root root 28729 Mar 21 02:25 server.py
-rw-r--r-- 1 root root   938 Mar 21 02:16 snapshot.json
-rw-r--r-- 1 root root   161 Mar 21 01:55 tinytuya.json
-rw-r--r-- 1 root root   499 Mar 21 01:55 tuya_mqtt.service
-rw-r--r-- 1 root root  2116 Mar 21 02:06 tuya-raw.json
drwxr-xr-x 7 root root  4096 Mar 21 01:55 .venv
(.venv) root@spruthub:/opt/tuya_mqtt# ./server.py
2024-03-21 02:27:53,416 - tuya_mqtt - INFO - Starting tuya_mqtt...
2024-03-21 02:27:53,417 - tuya_mqtt - ERROR - Device file not found.

TypeError creating data node and formatting homie id

When setting up your server to connect a Tuya NWT Dehumidifiert to MQTT, I get the following exception. Looks like the server is for some reason unable to create a homie id. Any idea what might go wrong?

2023-08-08 12:07:48,441 - tuya_mqtt - INFO - Starting tuya_mqtt...
2023-08-08 12:07:48,441 - tuya_mqtt - DEBUG - Loading device file devices.json...
2023-08-08 12:07:48,442 - tuya_mqtt - INFO - Creating device threads...
2023-08-08 12:07:48,442 - tuya_mqtt - INFO - Starting device threads...
2023-08-08 12:07:48,443 - tuya_mqtt - INFO - Initialising device instance for NWT Dehumidifier...
2023-08-08 12:07:48,444 - tuya_mqtt - INFO - Connecting to NWT Dehumidifier...
2023-08-08 12:07:52,013 - tuya_mqtt - INFO - Fetched status of NWT Dehumidifier...
2023-08-08 12:07:52,014 - tuya_mqtt - INFO - Connected to NWT Dehumidifier...
2023-08-08 12:07:52,014 - tuya_mqtt - INFO - NWT Dehumidifier connecting to mqtt...
2023-08-08 12:07:52,017 - tuya_mqtt - INFO - NWT Dehumidifier connected to mqtt.
Exception in thread Thread-1 (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 "/opt/tuya_mqtt/./server.py", line 553, in start_device_monitor
    dm = DeviceMonitor(device_info)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/tuya_mqtt/./server.py", line 84, in __init__
    self.homie_init()
  File "/opt/tuya_mqtt/./server.py", line 470, in homie_init
    self.create_homie_device_info()
  File "/opt/tuya_mqtt/./server.py", line 379, in create_homie_device_info
    self.create_data_node()
  File "/opt/tuya_mqtt/./server.py", line 335, in create_data_node
    "__topic__": format_homie_id(dp.name),
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/tuya_mqtt/./server.py", line 43, in format_homie_id
    return re.sub(r"[\W_]", "", s).lower()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 185, in sub
    return _compile(pattern, flags).sub(repl, string, count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.