Serial json communication with arduino

Hello,

I have an arduino nano plugged to my RPI3B+. It is searching for RF433 code and IR and I put a lot of lpayoads like IR sender, RF433 sender, servo mouvement, PIR sensor, etc…

I can call the function with a json like that sent in the serial command

{“function_name” : “send_433”, “code”: 12345, “pin”: 13, “pulselength”: 24}

It return what i want {“recieved”, “433RF”, “12345”}

So it’s really cool and customizable. look here https://github.com/billonalex/Gladys/tree/master/server/services/arduino

How can I integrate this arduino serial communication with HA? I need to send stuff in serial

I’m really new with that. I just stopped using GladysAssistant because it’s not really what i’m looking for.

Thanks everybody, I’ve heard this community is really active,i hope i will be able to be a part of that.

I found this:

And try to configure my configuration.yaml with the serial

sensor:

  - platform: serial

    serial_port: /dev/ttyUSB0

    baudrate: 9600

I still need some guidline if somebody knows how to configue it.

I receive in development tools:
sensor.serial_sensor:

function_name: recv_433
parameters:
value: 2992537
friendly_name: Serial Sensor

This is the code of a RF433 remote control. Now I need this to be a template (i think?) telling that this code means “button of the remote control is pressed”

If somebody has clue about that I’d would be happy. I didn’t find clear tutorial of my setup.

What do you want to do when “button of the remote control is pressed” ?

You can create a binary sensor that is on when pressed and off if not pressed.
You can fire an automation if pressed.

It all depends on your use case.

Actually I’m using a button as a test, or manual trigger, but it will be replaced by a RF433 PIR sensor eventually.

In fact: I have lots of entities: PIR sensor, door sensor, remote ctl.
I have 2992537 = button1.ON
XXXXXXX= button1.OFF
YYYYYYY= front_door.open
ZZZZZZZZ= PIR_room1.movement
etc …

So it could be just on my dashboard: “button pressed” or “mvt detected” in order to trigger some automation after that.

Besides, I’ll need to understand the mechanism to create RF433 send code to trigger an alarm and IR send.

So I just don’t understand how to convert a serial incoming into a device state and how to transform a device into a serial sent.

By the way i understand I’m working with HassOs and my yaml configuration has’nt all the customization text working. I think I should switch with Hassio with a standard distribution but I don’t find any of this. A bad yaml file crashed all my set up.

To send, you will need to use shell commands

To receive, the serial sensor will do, but you will have to create a template for each command.