gregod / addon-usbhid-to-mqtt

This addon processes tokens from card or barcode readers that use a virtual USB keyboard to type the codes followed by an "Enter" key.
1 stars 1 forks source link

USB Hid to Mqtt stops working #4

Open goose2600 opened 3 years ago

goose2600 commented 3 years ago

Home Assistant: core-2021.5.5, supervisor-2021.04.3 Mosquitto broker: version: 6.0.1 USB Hid to Mqtt: 1.1.0

Few days ago, I noticed that USB Hid to Mqtt stopped working. Unfortunately I can't say exactly when it stopped working.

Apparently it connects to the MQTT broker (using a random client name, as "hbmqtt/>H]\ZKA2K97yvuHR"), and in the log I can see the right token while scanning a RFID tag, anyway the the MQTT broker does not receive any messages. The USB Hid to Mqtt log shows this error: "Input stream read timeout" Here is the full log: https://pastebin.com/nJgbKGBx

Could you please help me to fix the issue?

Thanks

gregod commented 3 years ago

Hi, so this is a timeout within the mqtt client code. My first guess would be either an unstable network connection to the mqtt server or an overloaded server.

Could you first verify that the issue persists when using a different mqtt server? For example: mqtt://test.mosquitto.org as mqtt connection string. (This is a public world-readable server)

goose2600 commented 3 years ago

Hi, sorry for the late reply (I was quite busy at work).

I tried the connection string suggested by you, but I still get the "Input stream read timeout" error.

I am pretty sure that my issue is not related to the network connection (all the things are on the same machine) and the mqtt server is working without any issues.

Full log: https://pastebin.com/Z7FBGHVS

Thanks for your support.

matthias-homee commented 3 years ago

Hi @goose2600,

I try to start this add-on as well.

Currently I receive this error message ERROR:root:Device /dev/input/event0 could not be found. Please check device list above

When I verify this information at supervisor --> system --> hardware, it seems ok

Is there something more to do?

Thank you Matthias

goose2600 commented 2 years ago

I tried another mqtt server, instead of the Home Assistant mqtt addon: I still get the "Input stream read timeout" error, but the mqtt server receive the token number. So, it seems the issue is related to Home Assistant mqtt addon, which is not receiving any message.

This is the log when publishing a message using hbmqtt_pub from command line:

bash-5.1# hbmqtt_pub --url mqtt://user:password@homeassistant -t usbhid/tokens -m 1234567890
[2021-12-20 11:22:41,748] :: INFO - hbmqtt_pub/218-69e9541e-usbhid-to-mqtt Connecting to broker
[2021-12-20 11:22:41,788] :: INFO - Finished processing state new exit callbacks.
[2021-12-20 11:22:41,789] :: INFO - Finished processing state connected enter callbacks.
[2021-12-20 11:22:41,790] :: INFO - hbmqtt_pub/218-69e9541e-usbhid-to-mqtt Publishing to 'usbhid/tokens'
[2021-12-20 11:22:41,796] :: INFO - Finished processing state connected exit callbacks.
[2021-12-20 11:22:41,796] :: INFO - Finished processing state disconnected enter callbacks.
[2021-12-20 11:22:41,797] :: INFO - hbmqtt_pub/218-69e9541e-usbhid-to-mqtt Disconnected from broker