embyt / enocean-mqtt

Receives messages from an enOcean serial interface (USB) and provides selected messages to an MQTT broker.
GNU General Public License v3.0
42 stars 21 forks source link

Serial port exception #32

Closed asetGem closed 2 years ago

asetGem commented 2 years ago

Hi there,

I am trying to use enocean-mqtt. I installed the package on Raspi OS on a RPi 4, and plugged in an USB300 key. On this RPi, I also installed HA supervized, which runs in a docker. There, I installed and configured Mosquitto broker, and started it. I adapted my configuration file for the enoceanmqtt library, and added the .rules file to get a persistant device name (called enocean). Here is my configuration file:

[CONFIG]
enocean_port    = /dev/enocean
log_packets     = 1
mqtt_host       = *****
mqtt_port       = 1883
mqtt_client_id  = enocean   
mqtt_keepalive  = 50
mqtt_prefix     = enocean/
mqtt_user       = ******
mqtt_pwd        = ******

[inter-sup-salon]
address         = 0xXXXXXXXX (l'ID de l'interrupteur)
rorg            = 0xF6   # BS1
func            = 0x02
type            = 0x02
log_learn       = 1
publish_rssi    = 1

[shutter]
address         = 0xXXXXXXXX (l'ID du module qui contrôle mon VR)
rorg            = 0xD2
func            = 0x05
type            = 0x00

Of course, I put the real username and password for MQTT (and it successfully connects to it so it is not the problem), and I put the correct IDs for the devices.

When I first ran the enoceanmqtt command, everything worked well. Here is some output:

2022-06-17 10:17:43,813 INFO: Loading config file /etc/enoceanmqtt.conf
2022-06-17 10:17:43,814 INFO: Authenticating: mqtt-user
2022-06-17 10:17:43,827 INFO: SerialCommunicator started
2022-06-17 10:17:43,828 WARNING: Replacing Packet.optional with default value.
2022-06-17 10:17:43,829 INFO: Succesfully connected to MQTT broker.
2022-06-17 10:17:43,928 INFO: Sending packet
2022-06-17 10:17:44,030 INFO: got response packet: OK
2022-06-11 12:58:58,803 INFO: received: XX:XX:XX:XX->FF:FF:FF:FF (-61 dBm): 0x01 ['0xa5', '0x0', '0xb', '0x1c', '0xa', '0x5', '0x98', '0x3a', '0xbd', '0x82'] ['0x0', '0xff', '0xff', '0xff', '0xff', '0x3d', '0x0'] OrderedDict()              
2022-06-11 12:58:58,805 INFO: unknown sensor: XX:XX:XX:XX

as sensor with this ID was not in my configuration file, it is ok that it returns "unknown sensor". It did not raise any exception, and then received other telegrams like this.

But a few minutes later, an exception was raised: Serial port exception! (device disconnected or multiple access on port?) , and thus the serial communicator just stopped. I tried to run it again, but I immediately have the error.

I also tried to put the conf file in another place, but still the same error. It is connected to the mqtt server, and receives the test packet, but then it crashes. Here is the output:

2022-06-17 10:17:43,813 INFO: Loading config file /etc/enoceanmqtt.conf
2022-06-17 10:17:43,814 INFO: Authenticating: mqtt-user
2022-06-17 10:17:43,827 INFO: SerialCommunicator started
2022-06-17 10:17:43,828 WARNING: Replacing Packet.optional with default value.
2022-06-17 10:17:43,829 INFO: Succesfully connected to MQTT broker.
2022-06-17 10:17:43,928 INFO: Sending packet
2022-06-17 10:17:44,030 INFO: got response packet: OK
2022-06-17 10:17:44,646 ERROR: Serial port exception! (device disconnected or multiple access on port?)
2022-06-17 10:17:44,647 INFO: SerialCommunicator stopped

Any idea of what could happen and how I could solve this?

Thanks!

romor commented 2 years ago

Unfortunately not, I have no idea what causes this and I have not seen such behavior before.

From my perspective, it cannot be related to issues with the config file or the MQTT connection. It seems to be related to communication problems with your Enocean USB interface.

The exception is raised by the underlying enocean library. You might want to raise the issue there.

romor commented 2 years ago

Closing this as it seems to be related to the underlying enocean library. Feel free to reopen if appropriate.