Coder Social home page Coder Social logo

Comments (6)

matthijsvisser avatar matthijsvisser commented on June 14, 2024

Hi,

Are you sure that you've installed PySerial and not Serial?
pip show pyserial
Should return something like this:
Name: pyserial Version: 3.4

from kamstrup-402-mqtt.

coolnr avatar coolnr commented on June 14, 2024

Yes I am very sure.
Allready checked it before, also did a uninstall and install again.

Here is what pip show pyserial returns:

Name: pyserial Version: 3.5 Summary: Python Serial Port Extension Home-page: https://github.com/pyserial/pyserial Author: Chris Liechti Author-email: [email protected] License: BSD Location: /usr/local/lib/python3.9/dist-packages Requires: Required-by:

from kamstrup-402-mqtt.

matthijsvisser avatar matthijsvisser commented on June 14, 2024

Does pip show serial return anything?

I would expect a stacktrace in the debug.log file if there are any problems with declaring the serial port object. Can you paste those contents?
tail -f debug.log -n 50

from kamstrup-402-mqtt.

coolnr avatar coolnr commented on June 14, 2024

Pip show serial gives package not found

What perhaps could be the issue is that something with USB passtrough is not going right. I have installed this on a container in Proxmox. I will dive into this as well.

Here is my tail -f debug.log -n 50 output:

`root@warmtemeting:~/kamstrup-402-mqtt# tail -f debug.log -n 50
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/kamstrup-402-mqtt/kamstrup_meter.py", line 92, in init
self.serial = serial.Serial(
File "/usr/local/lib/python3.9/dist-packages/serial/serialutil.py", line 244, in init
self.open()
File "/usr/local/lib/python3.9/dist-packages/serial/serialposix.py", line 325, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
[2022-03-02 20:54:39 daemon.py init: 41 - INFO - initializing daemon]
[2022-03-02 20:54:39 mqtt_handler.py connect: 43 - INFO - Connected to MQTT at: 192.168.1.254:1883]
[2022-03-02 20:54:39 mqtt_handler.py connect: 45 - INFO - with username ***, QoS level = 0 and retain = False]
[2022-03-02 20:54:39 kamstrup_meter.py init: 100 - ERROR - [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0']
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/serial/serialposix.py", line 322, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
PermissionError: [Errno 13] Permission denied: '/dev/ttyUSB0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/kamstrup-402-mqtt/kamstrup_meter.py", line 92, in init
self.serial = serial.Serial(
File "/usr/local/lib/python3.9/dist-packages/serial/serialutil.py", line 244, in init
self.open()
File "/usr/local/lib/python3.9/dist-packages/serial/serialposix.py", line 325, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
[2022-03-02 21:02:01 daemon.py init: 41 - INFO - initializing daemon]
[2022-03-02 21:02:01 mqtt_handler.py connect: 43 - INFO - Connected to MQTT at: 192.168.1.254:1883]
[2022-03-02 21:02:01 mqtt_handler.py connect: 45 - INFO - with username ***, QoS level = 0 and retain = False]
[2022-03-02 21:02:01 kamstrup_meter.py init: 100 - ERROR - Could not configure port: (25, 'Inappropriate ioctl for device')]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/serial/serialposix.py", line 398, in _reconfigure_port
orig_attr = termios.tcgetattr(self.fd)
termios.error: (25, 'Inappropriate ioctl for device')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/kamstrup-402-mqtt/kamstrup_meter.py", line 92, in init
self.serial = serial.Serial(
File "/usr/local/lib/python3.9/dist-packages/serial/serialutil.py", line 244, in init
self.open()
File "/usr/local/lib/python3.9/dist-packages/serial/serialposix.py", line 332, in open
self._reconfigure_port(force_update=True)
File "/usr/local/lib/python3.9/dist-packages/serial/serialposix.py", line 401, in _reconfigure_port
raise SerialException("Could not configure port: {}".format(msg))
serial.serialutil.SerialException: Could not configure port: (25, 'Inappropriate ioctl for device')`

from kamstrup-402-mqtt.

coolnr avatar coolnr commented on June 14, 2024

hi @matthijsvisser , i reinstalled everything in a VM (instead of container). And now it's working! So problem was USB passthrough to Debian container, even when USB is listed.....

Thanks for your help, i can now enjoy your work!

image

from kamstrup-402-mqtt.

matthijsvisser avatar matthijsvisser commented on June 14, 2024

Awesome, nice job. Don't forget to star the project for updates!

from kamstrup-402-mqtt.

Related Issues (14)

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.