Hello, I have a Home Assistant isnstallation on a Raspbery PI and I am trying to get vallues from a power sensor ( Current Cost ENVI,EnviR) connected with a USB serial interface:
dmesg output:
pl2303 1-1.5:1.0: pl2303 converter detected
usb 1-1.5: pl2303 converter now attached to ttyUSB0
The system work for some time and then stops. I have noticed that the messages arriving in the serial port are in the form:
<msg><src>CC128-v1.48</src><dsb>02191</dsb><time>15:11:19</time><tmpr>23.5</tmpr><sensor>0</sensor><id>01008</id><type>1</type><ch1><watts>00535</watts></ch1></msg>
but some times the sensors send historical data as follows:
<msg><src>CC128-v1.48</src><dsb>02191</dsb><time>15:13:30</time><hist><dsw>02191</dsw><type>1</type><units>kwhr</units><data><sensor>0</sensor><h150>1.057</h150><h148>1.028</h148><h146>0.928</h146><h144>1.101</h144></data><data><sensor>1</sensor><h150>0.000</h150><h148>0.000</h148><h146>0.000</h146><h144>0.000</h144></data><data><sensor>2</sensor><h150>0.000</h150><h148>0.000</h148><h146>0.000</h146><h144>0.000</h144></data><data><sensor>3</sensor><h150>0.000</h150><h148>0.000</h148><h146>0.000</h146><h144>0.000</h144></data><data><sensor>4</sensor><h150>0.000</h150><h148>0.000</h148><h146>0.000</h146><h144>0.000</h144></data><data><sensor>5</sensor><h150>0.000</h150><h148>0.000</h148><h146>0.000</h146><h144>0.000</h144></data><data><sensor>6</sensor><h150>0.000</h150><h148>0.000</h148><h146>0.000</h146><h144>0.000</h144></data><data><sensor>7</sensor><h150>0.000</h150><h148>0.000</h148><h146>0.000</h146><h144>0.000</h144></data><data><sensor>8</sensor><h150>0.000</h150><h148>0.000</h148><h146>0.000</h146><h144>0.000</h144></data><data><sensor>9</sensor><h150>0.000</h150><h148>0.000</h148><h146>0.000</h146><h144>0.000</h144></data></hist></msg>
and I suspect that when this message arrives the sensor stops reading more data… (maybe a buffer overflow???)
my setup for the sensor is:
sensor:
- platform: serial
--my-rx-message-buffer-size=2046
serial_port: /dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0
baudrate: 57600
scan_interval: 0
- platform: template
sensors:
my_power_sensor:
friendly_name: PowerConsumption
unit_of_measurement: "Watt"
value_template: "{{ states('sensor.serial_sensor').split('<watts>')[1].split('</watts>')[0]}}"
my_temperature_sensor:
friendly_name: Temperature
unit_of_measurement: "°C"
value_template: "{{ states('sensor.serial_sensor').split('<tmpr>')[1].split('</tmpr>')[0]}}"
my_sensor_time:
friendly_name: Time
unit_of_measurement: ""
value_template: "{{ states('sensor.serial_sensor').split('<time>')[1].split('</time>')[0]}}"
I have also connected an arduino to send fake data (not historical data) hisin another serial sensor and it works fine.
Also when monitorring the serial port with picocon, all data are recevied to the piccom console!
Any help