Hi, i am very new to HA and I am trying to get Information from a PV-String via RS-485 USB-2-Serial adapter from a DC Battery Meter and hope to receive some help here.
To get the Voltage/Ampere/Power/Energy from the Battery Meter i have to send a Read Command like that:
:R50=1,2, 1,
and then parse some of the comma separated values from the reply.
Here’s a description:
Sample reply to above command received:
:r50=1,215,2056,200, 5408,4592,9437,14353 ,134,4112,0,0,162,3068 2,
Description of the received values:
1 represents the communication address;
215 represents the checksum;
2056 represents the voltage of 20.56V;
200 represents current 2.00A;
5408 represents the remaining battery capacity is 5.408Ah;
4593 means the cumulative capacity is 4.593Ah;
9437 represents the watt-hour is 0.09437kw.h;
14353 represents the running time of 14353s;
134 represents the ambient temperature is 34°C;
4112 represents the power of 41.12W;
The rest of the result can be ignored.
I started to code the following config.yaml but I am not sure how to send the command and parse the values and if the rest of the command is ok like this:
# RS-485 serial connection to Junctek KGF-110 Battery Coulemeter to monitor a PV String
sensor:
- platform: serial
- name: rs485usb_KGF-110
type: serial
serial_port: /dev/ttyUSB1
baudrate: 115200
stopbits: 1
bytesize: 8
parity: N
timeout: 1
sensor:
- platform: command_line
name: junctek-KGF-110
scan_interval: 10
command: echo ":R50=1,2,1," >/dev/ttyUSB1
value_template:
- platform: template
sensors:
firstvalue:
value_template:
friendly_name: 'PV1_Voltage'
unit_of_measurement: V
scale: 0.01
device_class: voltage
secondvalue:
value_template:
friendly_name: 'PV1_Current'
unit_of_measurement: A
scale: 0.01
device_class: current
thirdvalue:
value_template:
friendly_name: 'PV1_Power'
unit_of_measurement: A
scale: 0.01
device_class: power
thirdvalue:
value_template:
friendly_name: 'PV1_Energy'
unit_of_measurement: Wh
scale: 0.01
device_class: energy
state_class: total_increasing