In the pi shell I can see the device and after setting the correct baud rate etc with:
stty -F /dev/ttyUSB0 9600 -parodd cs7 -cstopb parenb -ixoff -crtscts -hupcl -ixon -opost -onlcr -isig -icanon -iexten -echo -echoe -echoctl -echoke
sensor:
- platform: serial
name: Smart Meter Raw
serial_port: /dev/ttyUSB0
baudrate: 9600
bytesize: 7
parity: O
stopbits: 1
- platform: template
sensors:
total_power_consumption:
value_template: >
{{ states('sensor.smart_meter_raw') | regex_findall_index('1-0:1.8.0\*255\((\d+\.\d+)\*kWh\)') }}
unit_of_measurement: 'kWh'
friendly_name: 'Total Power Consumption'
With this I can read the total power consumption. But it is flickering in the UI view under settings => devices & scenes => Entities => Total power Consumption
I can see the coorect value for a small amount of time and afterwards Unavailable within a second periodically. I guess this is because the Smart Meter is sending the data every second.
1.) How can I fix this problem? I guess this is a common problem with serial data. What would be the best practice in this case?
2.) Where and how can I visualize this data in my dashboard or somewhere else?