Hi Everyone,
I’ve been using my HA for in a basic way for a few months now. Now I’m trying to build a factory monitoring system. I want to display power being used and generated with our solar panels. Along with water temp and compressed air pressure of the factory.
I have stand alone ESPHome unils running both the water and compressed air sensors. These seem to work great .
My main issue is my data from my Lechacal RPICT4V3 doesn’t always bring a data feed via the Serial port.
This is my configuartion.yaml file.
sensor:
- platform: serial
name: RPICT
serial_port: /dev/ttyAMA0
baudrate: 38400
- platform: template
sensors:
rpict_ct1:
friendly_name: CT1
unit_of_measurement: "W"
value_template: "{{ states('sensor.RPICT').split(' ')[1] | float }}"
rpict_ct2:
friendly_name: CT2
unit_of_measurement: "W"
value_template: "{{ states('sensor.RPICT').split(' ')[2] | float }}"
rpict_ct3:
friendly_name: CT3
unit_of_measurement: "W"
value_template: "{{ states('sensor.RPICT').split(' ')[3] | float }}"
rpict_irms1:
friendly_name: Irms1
unit_of_measurement: "A"
value_template: "{{ states('sensor.RPICT').split(' ')[4] | float }}"
rpict_irms2:
friendly_name: Irms2
unit_of_measurement: "A"
value_template: "{{ states('sensor.RPICT').split(' ')[5] | float }}"
rpict_irms3:
friendly_name: Irms3
unit_of_measurement: "A"
value_template: "{{ states('sensor.RPICT').split(' ')[6] | float }}"
rpict_irms4:
friendly_name: Irms4
unit_of_measurement: "A"
value_template: "{{ states('sensor.RPICT').split(' ')[7] | float }}"
rpict_voltage1:
friendly_name: V1
unit_of_measurement: "V"
value_template: "{{ states('sensor.RPICT').split(' ')[8] | float }}"
rpict_voltage2:
friendly_name: V2
unit_of_measurement: "V"
value_template: "{{ states('sensor.RPICT').split(' ')[9] | float }}"
rpict_voltage3:
friendly_name: V3
unit_of_measurement: "V"
value_template: "{{ states('sensor.RPICT').split(' ')[10] | float }}"
rpict_average_amps:
friendly_name: Average Amps
unit_of_measurement: "A"
value_template: "{{ ((states('sensor.RPICT').split(' ')[5] |float + states('sensor.RPICT').split(' ')[6] |float + states('sensor.RPICT').split(' ')[7] |float) / 3) | round(0) }}"
rpict_average_voltage:
friendly_name: Average Voltage
unit_of_measurement: "V"
value_template: "{{ ((states('sensor.RPICT').split(' ')[8] |float + states('sensor.RPICT').split(' ')[9] |float + states('sensor.RPICT').split(' ')[10] |float) / 3) | round(0) }}"
rpict_kva:
friendly_name: Current kVA
unit_of_measurement: "kVA"
value_template: "{{ ((3 * ((states('sensor.RPICT').split(' ')[5] | float + states('sensor.RPICT').split(' ')[6] | float + states('sensor.RPICT').split(' ')[7] | float ) / 3)) * ((states('sensor.RPICT').split(' ')[8] | float + states('sensor.RPICT').split(' ')[9] | float + states('sensor.RPICT').split(' ')[10] | float ) / 3 ) / 1000) | round(0) | float }}"
rpict_current_kwh:
friendly_name: Current kWh
unit_of_measurement: "kWh"
unique_id: current:info:kWh
entity_id: sensor.rpict_current_kwh
value_template: "{{ ((((states('sensor.RPICT').split(' ')[2] | float ) + (states('sensor.RPICT').split(' ')[3] | float )) * 1.5 ) / 1000) | round(0) | float }}"
I’m trying to work out how I can get my sensors to show correctly and hold the last value if a nan value is pulled in via the serial port. I’m not great at this coding and looking for a nudge in the correct direction. Any Help would be greatly appreciated…