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

Serial text string problem

$
0
0

@pirpy wrote:

Hello
I’m trying to receive data string from my powermeter in my hassio with serial sensor

the power meter sends this string

490.74,235.27,3.05,0.68, 726.72,233.05,3.67,0.85, 208.93,235.24,1.14,0.78, 17864.96,84042.15
every second


  - platform: serial
    serial_port: /dev/ttyUSB0
    baudrate: 115200

  - platform: template
    sensors:

      my_powermeter_sensor_l1w:
        friendly_name: L1_W
        unit_of_measurement: "W"
        value_template: "{{ states('sensor.serial_sensor').split(',')[1] | float }}"
      my_powermeter_sensor_l1v:
        friendly_name: L1_V
        unit_of_measurement: "V"
        value_template: "{{ states('sensor.serial_sensor').split(',')[2] | float }}"
      my_powermeter_sensor_l1a:
        friendly_name: L1_A
        unit_of_measurement: "A"
        value_template: "{{ states('sensor.serial_sensor').split(',')[3] | float }}"
      my_powermeter_sensor_l1cosphi:
        friendly_name: L1_cosphi
        unit_of_measurement: "Q"
        value_template: "{{ states('sensor.serial_sensor').split(',')[4] | float }}"   
      my_powermeter_sensor_l2w:
        friendly_name: L2_W
        unit_of_measurement: "W"
        value_template: "{{ states('sensor.serial_sensor').split(',')[5] | float }}"
      my_powermeter_sensor_l2v:
        friendly_name: L2_V
        unit_of_measurement: "V"
        value_template: "{{ states('sensor.serial_sensor').split(',')[6] | float }}"
      my_powermeter_sensor_l2a:
        friendly_name: L2_A
        unit_of_measurement: "A"
        value_template: "{{ states('sensor.serial_sensor').split(',')[7] | float }}"
      my_powermeter_sensor_l2cosphi:
        friendly_name: L2_cosphi
        unit_of_measurement: "Q"
        value_template: "{{ states('sensor.serial_sensor').split(',')[8] | float }}"        
      my_powermeter_sensor_l3w:
        friendly_name: L3_W
        unit_of_measurement: "W"
        value_template: "{{ states('sensor.serial_sensor').split(',')[9] | float }}"
      my_powermeter_sensor_l3v:
        friendly_name: L3_V
        unit_of_measurement: "V"
        value_template: "{{ states('sensor.serial_sensor').split(',')[10] | float }}"
      my_powermeter_sensor_l3a:
        friendly_name: L3_A
        unit_of_measurement: "A"
        value_template: "{{ states('sensor.serial_sensor').split(',')[11] | float }}"
      my_powermeter_sensor_l3cosphi:
        friendly_name: L3_cosphi
        unit_of_measurement: "Q"
        value_template: "{{ states('sensor.serial_sensor').split(',')[12] | float }}" 
      my_powermeter_sensor_whout:
        friendly_name: WH_out
        unit_of_measurement: "Wh"
        value_template: "{{ states('sensor.serial_sensor').split(',')[13] | float }}"
      my_powermeter_sensor_whin:
        friendly_name: Wh_in
        unit_of_measurement: "Wh"
        value_template: "{{ states('sensor.serial_sensor').split(',')[14] | float }}"  

but in the states all I get is an unavailable
log:
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L2_A: UndefinedError: list object has no element 7
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template Wh_in: UndefinedError: list object has no element 14
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L2_cosphi: UndefinedError: list object has no element 8
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L3_W: UndefinedError: list object has no element 9
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L1_A: UndefinedError: list object has no element 3
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L1_W: UndefinedError: list object has no element 1
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L3_V: UndefinedError: list object has no element 10
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L3_A: UndefinedError: list object has no element 11
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L1_cosphi: UndefinedError: list object has no element 4
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L2_W: UndefinedError: list object has no element 5
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L3_cosphi: UndefinedError: list object has no element 12
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template WH_out: UndefinedError: list object has no element 13
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L2_V: UndefinedError: list object has no element 6
2020-03-26 15:58:10 ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template L1_V: UndefinedError: list object has no element 2

thank you

Posts: 8

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 95451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>