The serial sensor platform is using the data provided by a device connected to the serial port of the system where Home Assistant is running. With ser2net and socat would it also work for sensors connected to a remote system.

To check what kind of data is arriving at your serial port, use a command-line tool like minicom or picocom on Linux, on a macOS you can use screen or on Windows putty.

sudo minicom -D /dev/ttyACM0


To setup a serial sensor to your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
  - platform: serial
    serial_port: /dev/ttyACM0

Configuration Variables

serial_port stringRequired

Local serial port where the sensor is connected and access is granted.

name string(Optional)

Friendly name to use for the frontend. Default to “Serial sensor”.

baudrate integer(Optional, default: 9600 Bps)

Baudrate of the serial port.

bytesize integer(Optional, default: 8)

Number of data bits. Possible values: 5=FIVEBITS, 6=SIXBITS, 7=SEVENBITS, 8=EIGHTBITS.

parity string(Optional, default: N)

Enable parity checking. Possible values: N=PARITY_NONE, E=PARITY_EVEN, O=PARITY_ODD, M=PARITY_MARK, S=PARITY_SPACE.

stopbits float(Optional, default: 1)

Number of stop bits. Possible values: 1=STOPBITS_ONE, 1.5=STOPBITS_ONE_POINT_FIVE, 2=STOPBITS_TWO.

xonxoff boolean(Optional, default: false)

Enable software flow control.

rtscts boolean(Optional, default: false)

Enable hardware (RTS/CTS) flow control.

dsrdtr boolean(Optional, default: false)

Enable hardware (DSR/DTR) flow control.

value_template template(Optional)

Defines a template to extract a value from the serial line.

value_template for Template sensor


"{{ (((states('sensor.serial_sensor') | float * 5 / 1024 ) - 0.5) * 100) | round(1) }}"



For controllers of the Arduino family, a possible sketch to read the temperature and the humidity could look like the sample below.The returned data is in JSON format and can be split into the individual sensor values using a template.

#include <ArduinoJson.h>

void setup() {

void loop() {
  StaticJsonDocument<100> jsonBuffer;

  jsonBuffer["temperature"] = analogRead(A0);
  jsonBuffer["humidity"] = analogRead(A1);

  serializeJson(jsonBuffer, Serial);

Devices returning multiple sensors as a text string

For devices that return multiple sensors as a concatenated string of values with a delimiter, (i.e., the returned string is not JSON formatted) you can make several template sensors, all using the same serial response. For example, a stream from the Sparkfun USB Weather Board includes temperature, humidity and barometric pressure within it returned text string. Sample returned data:


To parse this into individual sensors, split using the comma delimiter and then create a template sensor for each item of interest.

# Example configuration.yaml entry
  - platform: serial
    serial_port: /dev/ttyUSB0
    baudrate: 9600

  - platform: template
        friendly_name: Temperature
        unit_of_measurement: "°C"
        value_template: "{{ states('sensor.serial_sensor').split(',')[1] | float }}"
        friendly_name: Humidity
        unit_of_measurement: "%"
        value_template: "{{ states('sensor.serial_sensor').split(',')[2] | float }}"
        friendly_name: Barometer
        unit_of_measurement: "mbar"
        value_template: "{{ states('sensor.serial_sensor').split(',')[4] | float }}"

Digispark USB Development Board

This blog post describes the setup with a Digispark USB Development Board.