Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 96121

Unable to seperate data in serial message

$
0
0

@mishaVee wrote:

Hey all,

Feeling a little confused reading through the serial documentation help:


and

Basically I am using an Arduino to handle all of my sensors, utilising the arduinoJson.h library to output my variables and values over to my Raspberry Pi 4. which is working fine and I get the following:

{
  "Temperature": 23.297,
  "pH": 0,
  "DisolvedOxygen": 6.35
}

Then I added to my configuration.yaml file

sensor:
  - platform: serial
    serial_port: /dev/ttyACM0
    baudrate: 9600

  - platform: template
    sensors:
      Temperature_sensor:
        friendly_name: Temperature
        unit_of_measurement: "°C"
        value_template: "{{ states('sensor.serial_sensor').split(',')[1] | float }}"

        pH_sensor:
        friendly_name: pH
        value_template: "{{ states('sensor.serial_sensor').split(',')[3] | float }}"

        DO_sensor:
        friendly_name: DO
        unit_of_measurement: "mg/L"
        value_template: "{{ states('sensor.serial_sensor').split(',')[5] | float }}"

From my understanding,i have set it so each sensor looks at the value in position 1, 3 and 5 of the string? still getting my head around HA

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 96121

Trending Articles