Changing sensor from serial to usb

Hi all

I have been using this CT clamp device for my energy monitoring which has been working great:
http://lechacal.com/wiki/index.php?title=RPICT3V1

But I wanted to free up my gpio pins to use a fan hat as my rpi gets hot during summer, I purchased this to convert it to USB RPICT USB Adaptor - lechacal

My config right now is

    name: "RPICT"
    serial_port: /dev/ttyAMA0
    baudrate: 384001

With associated sensors, which works great

I have changed the serial port to /dev/ttyUSB0 and I get readings from the ct clamps when I run stty -echo -F /dev/ttyUSB0 raw speed 38400 cat /dev/ttyUSB0

But my sensors are not working, any help would be appreciated!

So it looks like my sensor is pulling the header information from ttyUSB0 which is “RPICT3V1 v2.1”

ValueError: Template error: float got invalid input 'RPICT3V1' when rendering template '- platform: template
    sensors:
      my_goodwe_sensor:
        friendly_name: Goodwe REAL
        unit_of_measurement: "W"
        value_template: "{{ states('sensor.RPICT').split(' ')[1] | float }}"
      my_realpower1_sensor:
        friendly_name: Goodwe Solar
        unit_of_measurement: "W"' but no default was specified

When I use the “cat /dev/ttyUSB0” command plugging in the USB without restarting or changing my sensor to ttyUSB0 i get the header coming up every time. If I restart I can use “cat /dev/ttyUSB0” and the values come straight up without the header. Seems I need to change the way this template works somehow.

Most likely cause is the RPICT card getting a reset on every read from the HA serial interface.
Hence why the RPICT is giving the header instead of the actual data.

Does the HA serial interface have a ‘keep alive’ option?

In other terms can HA makes each reading without triggering the DTR line?

If there are no software solution to get serial keep-alive in HA you could just disconnect the DTR line on the RPICT_USB card. For this just remove the capacitor labelled C4.
Someone has reported this to work efficiently.
This must be a last resort solution as modifying the hardware to solve software fault is not really an elegant way to do things.