I am trying to setup the StromPi3 (rev 1.1, firmware 1.72c) under Home Assistant OS (*).
I have enabled PL011 UART as primary serial and switched miniUART to secondary via config.txt:


I have made sure that the serial console is disabled via cmdline.txt (console=serial0,115200 is not present):

dwc_otg.lpm_enable=0 console=tty1

I have started to fiddle with StromPi in HA OS itself (i.e. not in any docker container) as root.
The serial port device in the OS is present (/dev/serial0 -[gt] ttyAMA0).
When I setup the port via

stty -F /dev/serial0 38400 -a

I get:

speed 38400 baud; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = [lt]undef[gt]; eol2 = [lt]undef[gt]; swtch = [lt]undef[gt]; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;
min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

(Which is to a letter the same configuration as under Raspbian OS where the communication works.)

When I try to write to the port via

echo -ne 'status-rpi\x0D' [gt] /dev/serial0

and listen via

cat [lt] /dev/serial0

nothing happens, except for breaking the whole StromPi which then needs to be flashed.
This procedure however works under Raspbian OS.

Can you please advise what could be wrong?
I understand I can switch from HA OS to Raspbian OS, but this is the last resort.
I believe the serial communication should be OS-agnostic, besides Home Assistant is known to communicate with serial peripherals without any troubles.

Thanks a lot



23.07.21 14:50

I was too quick. I came to a conclusion that HA OS reserves the serial port for itself and trying to interfer leads to a collision.

So instead I tried to make HA to communicate with StromPi. This is what you can try in configuration.yaml:

- platform: serial
serial_port: /dev/serial0
name: StromPi Status
baudrate: 38400
bytesize: 8
parity: N
stopbits: 1
- platform: command_line
name: StromPi Handle
scan_interval: 5
command: echo -e -n 'status-rpi\x0D' [gt] /dev/serial0
default: info
homeassistant.components.serial.sensor: debug

Of course it's not useful this way and needs further programming, but it's a proof o working communication.


23.07.21 19:08

Hello Bart,

thank you for sharing your detailed explanation.

We are glad that you could find a way to communicate with the StromPi.

Yours sincerely,

Niklas Tritschler

29.07.21 09:53