Raspberry pi serial port

Hi

Om new with home assistant.

I have a “control panel” with button that i want to Control my rpi.

I Can read the serial data with ssh and send commands back to the control panel.

But how do i make home assistant read the serial gate? And then toggle a switch ?

Hope someone Can help me

There is a serial sensor. You could try to read the state and control your device with a command_line switch.

Thanks for your reply.

Can you try to give a basic example ?

Like

If serial = “switch1”
{
toogle switch1
}
if serial = “switch2”
{
toogle switch2
}

Hard to do that without knowing the details. After you have setup your sensor and your switch check

So i have this in my configuration.yaml now:

automation:
  trigger:
    platform: template
    value_template: "{% if is_state('sensor.serial_sensor', 'poweron') %}true{% endif %}"
  action:
    service: switch.toggle
    entity_id: switch.r4

i have the control panel send “poweron” over serial. i can verify this with
sudo minicom -D /dev/ttyAMA0

over ssh.

But the automation is not triggered. i can manually trigger the automation and the relay (R4) is toggled.
So what have i done wrong ? :slight_smile:

Is there really No one who can help me with this ?

If you can control the switch via the frontend then is your automation rule wrong.