Skip to content

Instantly share code, notes, and snippets.

@gushcs
Last active January 16, 2025 22:24
Show Gist options
  • Save gushcs/223ca2c61af2d345238d286746617650 to your computer and use it in GitHub Desktop.
Save gushcs/223ca2c61af2d345238d286746617650 to your computer and use it in GitHub Desktop.
solarman inverter definition for SOFAR KTLM G3 to be used with HomeAssistant Solarman integration
#Ps. only "Alert sensor" not working
# Sofar 3.3-12KTLM-G3
# Note: no modbus energy meter connected
requests:
- start: 0x0400
end: 0x042E
mb_functioncode: 0x03
- start: 0x0480
end: 0x04AF
mb_functioncode: 0x03
# - start: 0x0500
# end: 0x041F
# mb_functioncode: 0x03
- start: 0x0580
end: 0x0589
mb_functioncode: 0x03
# - start: 0x0600
# end: 0x060A
# mb_functioncode: 0x03
- start: 0x0680
end: 0x069B
mb_functioncode: 0x03
parameters:
- group: InverterDC
items:
- name: "PV1 Power"
class: "power"
state_class: "measurement"
uom: "W"
scale: 10
rule: 1
registers: [0x0586]
icon: 'mdi:solar-power'
- name: "PV2 Power"
class: "power"
state_class: "measurement"
uom: "W"
scale: 10
rule: 1
registers: [0x0589]
icon: 'mdi:solar-power'
- name: "PV1 Voltage"
class: "voltage"
state_class: "measurement"
uom: "V"
scale: 0.1
rule: 1
registers: [0x0584]
icon: 'mdi:alpha-v-circle-outline'
- name: "PV2 Voltage"
class: "voltage"
state_class: "measurement"
uom: "V"
scale: 0.1
rule: 1
registers: [0x0587]
icon: 'mdi:alpha-v-circle-outline'
- name: "PV1 Current"
class: "current"
state_class: "measurement"
uom: "A"
scale: 0.01
rule: 1
registers: [0x0585]
icon: 'mdi:current-dc'
- name: "PV2 Current"
class: "current"
state_class: "measurement"
uom: "A"
scale: 0.01
rule: 1
registers: [0x0588]
icon: 'mdi:current-dc'
- group: Inverter
items:
- name: "Inverter status"
class: ""
state_class: "measurement"
uom: ""
scale: 1
rule: 1
registers: [0x0404]
lookup:
- key: 0
value: "Waiting"
- key: 1
value: "Detection"
- key: 2
value: "Grid-Connected"
- key: 3
value: "Emergency Power Supply"
- key: 4
value: "Recoverable Fault"
- key: 5
value: "Permanent Fault"
- key: 6
value: "Upgrade"
- key: 7
value: "Self-charging"
icon: 'mdi:wrench'
- name: "Ambient temperature 1"
class: "temperature"
uom: "°C"
scale: 1
rule: 2
registers: [0x0418]
icon: 'mdi:thermometer'
- name: "Module temperature 1"
class: "temperature"
uom: "°C"
scale: 1
rule: 2
registers: [0x0420]
icon: 'mdi:thermometer'
- name: "Radiator temperature 1"
class: "temperature"
uom: "°C"
scale: 1
rule: 2
registers: [0x041A]
icon: 'mdi:thermometer'
- name: "Insulation Resistance"
class: "none"
uom: "kohm"
scale: 1
rule: 1
registers: [0x042B]
icon: "mdi:omega"
- group: OnGridOutput
items:
- name: "Frequency Grid"
class: "frequency"
uom: "Hz"
scale: 0.01
rule: 1
registers: [0x0484]
icon: 'mdi:sine-wave'
- name: "Total Active Power Output"
class: "energy"
uom: "kW"
scale: 0.01
rule: 1
registers: [0x0485]
icon: "mdi:solar-power"
- name: "Grid Voltage L1"
class: "voltage"
uom: "V"
scale: 0.1
rule: 1
registers: [0x048D]
icon: "mdi:alpha-v-circle-outline"
- name: "Grid Current L1"
class: "current"
uom: "A"
scale: 0.01
rule: 1
registers: [0x048E]
icon: "mdi:alpha-a-circle-outline"
- name: "Grid Voltage L2"
class: "voltage"
uom: "V"
scale: 0.1
rule: 1
registers: [0x0498]
icon: "mdi:alpha-v-circle-outline"
- name: "Grid Current L2"
class: "current"
uom: "A"
scale: 0.01
rule: 1
registers: [0x0499]
icon: "mdi:alpha-a-circle-outline"
- name: "Grid Voltage L3"
class: "voltage"
uom: "V"
scale: 0.1
rule: 1
registers: [0x04A3]
icon: "mdi:alpha-v-circle-outline"
- name: "Grid Current L3"
class: "current"
uom: "A"
scale: 0.01
rule: 1
registers: [0x04A4]
icon: "mdi:alpha-a-circle-outline"
- group: Generation
items:
- name: "PV Generation today"
class: "energy"
state_class: "total_increasing"
uom: "kWh"
scale: 0.01
rule: 3
registers: [0x0685,0x0684]
icon: 'mdi:solar-power'
- name: "PV Generation total"
class: "energy"
state_class: "total_increasing"
uom: "kWh"
scale: 0.1
rule: 3
registers: [0x0687,0x0686]
icon: 'mdi:solar-power'
- name: "Load consumption today"
class: "energy"
state_class: "total_increasing"
uom: "kWh"
scale: 0.01
rule: 3
registers: [0x0689,0x0688]
icon: 'mdi:lightning-bolt-outline'
- name: "Load consumption total"
class: "energy"
state_class: "total_increasing"
uom: "kWh"
scale: 0.1
rule: 3
registers: [0x068B,0x068A]
icon: 'mdi:solar-power'
- group: Alert
items:
# - name: "Alert"
# class: ""
# state_class: ""
# uom: ""
# scale: 1
# rule: 6
# registers: [0x0405,0x0406,0x0407,0x0408,0x0409,0x040A,0x040B,0x040C,0x040D,0x040E,0x040F,0x0410]
- name: "Fault 1"
class: ""
state_class: ""
uom: ""
scale: 1
rule: 1
registers: [0x0405]
icon: 'mdi:wrench'
lookup:
- key: 0
value: "No error"
- key: 1
value: "ID01 Grid Over Voltage Protection"
- key: 2
value: "ID02 Grid Under Voltage Protection"
- key: 4
value: "ID03 Grid Over Frequency Protection"
- key: 8
value: "ID04 Grid Under Frequency Protection"
- key: 16
value: "ID05 Leakage current fault"
- key: 32
value: "ID06 High penetration error"
- key: 64
value: "ID07 Low penetration error"
- key: 128
value: "ID08 Islanding error"
- key: 256
value: "ID09 Grid voltage transient value overvoltage 1"
- key: 512
value: "ID10 Grid voltage transient value overvoltage 2"
- key: 1024
value: "ID11 Grid line voltage error"
- key: 2048
value: "ID12 Inverter voltage error"
- key: 4096
value: "ID13 Anti-backflow overload"
- key: 8192
value: "ID14"
- key: 16384
value: "ID15"
- key: 32768
value: "ID16"
- name: "Fault 2"
class: ""
state_class: ""
uom: ""
scale: 1
rule: 1
icon: 'mdi:wrench'
registers: [0x0406]
lookup:
- key: 0
value: "No error"
- key: 1
value: "ID17 Grid current sampling error"
- key: 2
value: "ID18 Grid current DC component sampling error (AC side)"
- key: 4
value: "ID19 Grid voltage sampling error (DC side)"
- key: 8
value: "ID20 Grid voltage sampling error (AC side)"
- key: 16
value: "ID21 Leakage current sampling error (DC side)"
- key: 32
value: "ID22 Leakage current sampling error (AC side)"
- key: 64
value: "ID23 Load voltage DC component sampling error"
- key: 128
value: "ID24 DC input current sampling error"
- key: 256
value: "ID25 DC component sampling error of grid current (DC side)"
- key: 512
value: "ID26 DC input branch current sampling error"
- key: 1024
value: "ID27"
- key: 2048
value: "ID28"
- key: 4096
value: "ID29 Leakage current consistency error"
- key: 8192
value: "ID30 Grid voltage consistency error"
- key: 16384
value: "ID31 DCI consistency error"
- key: 32768
value: "ID32"
- name: "Fault 3"
class: ""
state_class: ""
uom: ""
scale: 1
rule: 1
registers: [0x0407]
lookup:
- key: 0
value: "No error"
- key: 1
value: "ID33 Reserved"
- key: 2
value: "ID34 Reserved"
- key: 4
value: "ID35 Reserved"
- key: 8
value: "ID36 Reserved"
- key: 16
value: "ID37 Reserved"
- key: 32
value: "ID38 Reserved"
- key: 64
value: "ID39 Reserved"
- key: 128
value: "ID40 Reserved"
- key: 256
value: "ID41 Reserved"
- key: 512
value: "ID42 Reserved"
- key: 1024
value: "ID43 Reserved"
- key: 2048
value: "ID44 Reserved"
- key: 4096
value: "ID45 Reserved"
- key: 8192
value: "ID46 Reserved"
- key: 16384
value: "ID47 Reserved"
- key: 32768
value: "ID48 Reserved"
icon: 'mdi:wrench'
- name: "Fault 4"
class: ""
state_class: ""
uom: ""
scale: 1
rule: 1
registers: [0x0408]
lookup:
- key: 0
value: "No error"
- key: 1
value: "ID49 Grid voltage sampling value between master and slave DSP vary widely"
- key: 2
value: "ID50 Grid frequency sampling value between master and slave DSP vary widely"
- key: 4
value: "ID51 DCI sampling value between master and slave DSP vary widely"
- key: 8
value: "ID52 GFCI sampling value between master and slave DSP vary widely"
- key: 16
value: "ID53 Communication failure between master and slave DSP failure"
- key: 32
value: "ID53 Communication failure between slave and communication board"
- key: 64
value: "ID55 Relay fault"
- key: 128
value: "ID56 Insulation resistance between PV array and the earth is too low"
- key: 256
value: "ID57 Inverter temp is too high"
- key: 512
value: "ID58 Boost temp is too high"
- key: 1024
value: "ID59 Environment temp is too high"
- key: 2048
value: "ID60 Brak podłączenie falownika do kabla PE"
- key: 4096
value: "ID61 Reserved"
- key: 8192
value: "ID62 Reserved"
- key: 16384
value: "ID63 Reserved"
- key: 32768
value: "ID64 Reserved"
icon: 'mdi:wrench'
- name: "Fault 5"
class: ""
state_class: ""
uom: ""
scale: 1
rule: 1
registers: [0x0409]
lookup:
- key: 0
value: "No error"
- key: 1
value: "ID65 Grid current is too high and causes unrecoverable fault"
- key: 2
value: "ID66 Bus voltage is too high and causes unrecoverable fault"
- key: 4
value: "ID67 Grid current is unbalanced and causes unrecoverable fault"
- key: 8
value: "ID68 Input current is unbalanced and causes unrecoverable fault"
- key: 16
value: "ID69 Bus voltage is unbalanced and causes unrecoverable fault"
- key: 32
value: "ID70 Grid current is too high and causes unrecoverable fault"
- key: 64
value: "ID65 PV Input Mode Configuration is wrong and causes unrecoverable fault"
- key: 128
value: "ID72 Reserved"
- key: 256
value: "ID73 Reserved"
- key: 512
value: "ID74 Input current is too high and causes unrecoverable fault"
- key: 1024
value: "ID75 Error reading from EEPROM"
- key: 2048
value: "ID76 Error writing to EEPROM"
- key: 4096
value: "ID77 Relay fauilure causes unrecoverable fault"
- key: 8192
value: "ID78 Reserved"
- key: 16384
value: "ID79 Reserved"
- key: 32768
value: "ID80 Reserved"
icon: 'mdi:wrench'
@ghedisejn
Copy link

Thanks a lot for that! How did you found out the information about the registers and so on? I'm missing the total gird consumtion --> in solarman it is shown. I need the sensor to add it so i can see how much i consumed from grid an how much i consumed from PV. Also battery informations are missing... Therefore it would be helpful to know how did you manage to get this information?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment