Hey there,
I have this uart config:
uart:
- id: uart_lorawan
baud_rate: 9600
rx_pin: 3
tx_pin: 2
parity: NONE
stop_bits: 1
I’m able to send data through UART but I’m not sure how to read data from UART. I have this light switch that I want to turn off if the value read through UART is “00” :
switch:
- platform: gpio
pin: GPIO2
name: "Light A"
id: light_a
How could I accomplish this?
Thanks.
WallyR
(Wally)
March 5, 2025, 6:39am
2
By far the easiest method.
The UART Bus component provides a write action but no read actions. Typically the UART read is implemented in a custom component that also does the processing. The UART debug sequence can be exploited to act like a call back function whenever there is received data to process. So basically instead of creating a small custom component a large lambda call can be used in the UART debug yaml. This is shared to hopefully help make implementing UART devices a bit easier for average users.
It seems t…
2 Likes