Thank you for your answer!!
I have copied the 3 files in my custom_components folder, a new folder “serial”.
Added
# Example configuration.yaml entry
sensor:
- platform: serial
serial_port: /dev/serial0
in the configuration.yaml and restart HA.
After I send something via UART, I get the following Log:
Logger: homeassistant.components.serial.sensor
Source: components/serial/sensor.py:202
Integration: serial (documentation, issues)
First occurred: 01:11:55 (1 occurrences)
Last logged: 01:11:55
Error while reading serial device /dev/serial0: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/serial/sensor.py", line 202, in serial_read
line = await reader.readline()
File "/usr/local/lib/python3.10/asyncio/streams.py", line 525, in readline
line = await self.readuntil(sep)
File "/usr/local/lib/python3.10/asyncio/streams.py", line 617, in readuntil
await self._wait_for_data('readuntil')
File "/usr/local/lib/python3.10/asyncio/streams.py", line 502, in _wait_for_data
await self._waiter
File "/usr/local/lib/python3.10/site-packages/serial_asyncio/__init__.py", line 115, in _read_ready
data = self._serial.read(self._max_read_size)
File "/usr/local/lib/python3.10/site-packages/serial/serialposix.py", line 595, in read
raise SerialException(
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
I found out that the port is already used by nodered.
(My “Integration” is currently in nodered and this used the port).
When I stop nodered (also don’t start with boot), the error ’ device reports readiness to read but returned no data’ isn’t there anymore.
Now I try to find a serial-message I send, but I can’t find it…
(I changed the Baudrate in the sensor.py and the rest of the settings should work for me.)
I think the line CONF_SERIAL_PORT = “serial_port” says, that the serial_port: /dev/serial0 from the configuration.yaml should be used - am I correct?
Could you help me again?