make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.35k stars 522 forks source link

Request support for Karst-400 Solar Inverter #2029

Closed Moutmout31 closed 4 months ago

Moutmout31 commented 4 months ago

Log Message


2024-06-20 15:31:47.067 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches hama_radiator_controller with quality of 30%. DPS: {"updated_at": 1718890297.2822084, "2": 3843, "10": 277734, "15": "Karst-400", "16": "A8.2023.0705", "17": "ES20230705E01A", "18": 55, "101": true, "102": 3018, "103": 2777, "105": 100}

Information about DPS mappings

{
    "2":"Total",
    "3":"DC Input",
    "7":"AC Grid",
    "10":"Total power",
    "11":"Alarm",
    "12":"Work mode",
    "13":"Inverter alarm set1",
    "14":"Inverter alarm set2",
    "15":"Inverter type",
    "16":"Inverter ID",
    "17":"imei imsi",
    "18":"Inverter temperature",
    "101":"开关机",
    "102":"光伏功率",
    "103":"交流功率",
    "104":"电量清零",
    "105":"逆变器功率调整"
}

model:
{
    modelId:f4da3c,
    services:
    [{
        actions:[],
    code:,
        description:,
    events:[],
        name:默认服务,
        properties: [
            {abilityId:2,accessMode:rw,code:reverse_energy_total,description:,extensions:{iconName:icon-dp_lightning,attribute:1152},name:反向总有功电量,typeSpec:{type:value,max:99999999,min:0,scale:2,step:1,unit:kW·h}},
            {abilityId:3,accessMode:ro,code:pv1_dc_data,description:1,PV1直流侧电压、电流、功率\\n2,大端模式,HEX格式,共6个字节\\n3,单位精度:电压,2字节,单位0.1V;电流,2字节,单位 0.1A ;功率,2字节,单位0.01kW\\n4,报文格式\\n举例:08 80 00 0B 03 F3 表示PV1侧电压217.6V,电流1.1A,功率10.11KW\\n5,通信逻辑:\\nA情形:配网成功时,MCU上报该数据。\\nB情形:MCU周期定时上报该值。建议:在WIFI模式时,1分钟上报一次。NB模式时,1个小时上报一次该数据。,extensions:{iconName:icon-dp_mode,attribute:1152},name:直流输入,typeSpec:{type:raw,maxlen:128}},
            {abilityId:7,accessMode:ro,code:phase_a,description:1,A相交流电压,电流及功率\\n2,大端模式,HEX格式,共8个字节\\n3,单位精度:电压,2字节,单位0.1V。电流,3字节,单位 0.001A 。A相有功功率,3字节,单位0.001kW\\n4,报文格式\\n举例:08 80 00 03 E8 00 27 10 表示A相217.6V,A相电流1.000A,A相功率10.000KW\\n5,通信逻辑:\\nA 情形:配网成功时,MCU上报该数据。\\nB 逆变器基于一定周期上报数据。建议:在WIFI模式时,1分钟上报一次。NB模式时,1个小时上报一次。,extensions:{iconName:icon-dp_lightning,attribute:1152},name:交流电网,typeSpec:{type:raw,maxlen:128}},
            {abilityId:10,accessMode:ro,code:power_total,description:,extensions:{iconName:icon-dp_lightning,attribute:1152,trigger:direct},name:总功率,typeSpec:{type:value,max:900000,min:0,scale:3,step:1,unit:kW}},
            {abilityId:11,accessMode:ro,code:fault,description:,extensions:{iconName:icon-baojing,attribute:1152},name:告警,typeSpec:{type:bitmap,label:[ov_cr,ov_vol,outage_alarm,freq_abnormal,dc_over_voltage,dc_comp_alarm,fan_alarm,insulat_res_alarm,inverter_temp_alarm,remain_current_alarm,current_leak_alarm,battery_over_voltage,battery_under_vol,battery_temp_alarm,commu_alarm,inverter_body_alarm],maxlen:16}},
            {abilityId:12,accessMode:rw,code:work_mode,description:,extensions:{iconName:icon-dp_mode,attribute:1152},name:供电模式,typeSpec:{type:enum,range:[power_off,inverter_power,grid_power,battery_power]}},
            {abilityId:13,accessMode:rw,code:inverter_alarmset_1,description:1,告警设置1\\n2,HEX格式,大端模式, 总告警的数量*4字节= 设置告警总长度。\\n3,报文格式\\n每个告警由4个字节组成,第1个字节(表示该告警存在);第2个字节(bit0:1告警,0 不告警;bit0:1逆变器动作,0 逆变器不动作; );第3、4字节:暂时保留,设置由逆变器专业APP实现)\\n4,通信逻辑\\nA,配网成功后,按照上面的格式,主动上报给云平台,面板知道哪些告警是逆变器当前支持的。设置不成功,重新配网再上报。\\nB,逆变器上电时,也上报一次。\\nC,面板根据协议下发告警设置。,extensions:{iconName:icon-dp_mode,attribute:1152},name:逆变器告警设置1,typeSpec:{type:raw,maxlen:128}},
            {abilityId:14,accessMode:rw,code:inverter_alarmset_2,description:1,告警设置2\\n2,HEX格式,大端模式, 总告警的数量*4字节= 设置告警总长度。\\n3,报文格式\\n每个告警由4个字节组成,第1个字节(表示该告警存在);第2个字节(bit0:1告警,0 不告警;bit0:1逆变器动作,0 逆变器不动作; );第3、4字节:暂时保留,设置由逆变器专业APP实现)\\n4,通信逻辑\\nA,配网成功后,按照上面的格式,主动上报给云平台,面板知道哪些告警是逆变器当前支持的。设置不成功,重新配网再上报。\\nB,逆变器上电时,也上报一次。\\nC,面板根据协议下发告警设置。,extensions:{iconName:icon-dp_mode,attribute:1152},name:逆变器告警设置2,typeSpec:{type:raw,maxlen:128}},
            {abilityId:15,accessMode:ro,code:inverter_type,description:1,型号\\n2,大端模式,字符串型\\n3,单位精度\\n4,报文格式\\n5,通信逻辑\\nA,配网时上报三次,以确保上报成功。如果配对成功,面板有显示设备号。\\nB,如果配对成功,面板没有显示设备号,需要移除设备,再配置一遍。\\nC,每次逆变器上电,也上报一次。,extensions:{iconName:icon-dp_mode,attribute:1152},name:逆变器型号,typeSpec:{type:string,maxlen:255}},
            {abilityId:16,accessMode:ro,code:inverter_id,description:1,设备ID\\n2,大端模式,字符串型\\n3,单位精度\\n4,报文格式\\n5,通信逻辑\\nA,配网时上报三次,以确保上报成功。如果配对成功,面板有显示设备号。\\nB,如果配对成功,面板没有显示设备号,需要移除设备,再配置一遍。\\nC,每次逆变器上电,也上报一次。,extensions:{iconName:icon-dp_mode,attribute:1152},name:逆变器设备号,typeSpec:{type:string,maxlen:255}},
            {abilityId:17,accessMode:ro,code:imei_imsi,description:1,IMEI号IMSI号\\n2,报文格式\\n  JSON格式\\n  \\IMEI\\: 123456789012345,\\n  \\IMSI\\: 012345678901234\\n3,通信逻辑\\nA,NB通信方式时,选用此功能\\nB,配网时,上报。\\nC,每次逆变器上电,也上报一次。,extensions:{iconName:icon-dp_mode,attribute:1152},name:imei_imsi号,typeSpec:{type:string,maxlen:255}},
            {abilityId:18,accessMode:ro,code:temp_current,description:,extensions:{iconName:icon-dp_c,attribute:1152},name:逆变器温度,typeSpec:{type:value,max:150,min:-40,scale:1,step:1,unit:℃}},
            {abilityId:101,accessMode:rw,code:switch,description:,extensions:{attribute:1},name:开关机,typeSpec:{type:bool}},
            {abilityId:102,accessMode:ro,code:pv_power,description:,name:光伏功率,typeSpec:{type:value,max:9000000,min:0,scale:1,step:1,unit:W}},
            {abilityId:103,accessMode:ro,code:ac_power,description:,extensions:{iconName:icon-dp_lightning,attribute:2},name:交流功率,typeSpec:{type:value,max:900000,min:0,scale:1,step:1,unit:W}},
            {abilityId:104,accessMode:rw,code:energy_clear,description:,name:电量清零,typeSpec:{type:enum,range:[0,1]}},
            {abilityId:105,accessMode:rw,code:power_adj,description:,name:逆变器功率调整,typeSpec:{type:value,max:100,min:0,scale:0,step:1,unit:%}}
        ]
    }]
}

Product ID

  "product_id": "0kllybtbzftaee7y",

Information about how the device functions

This Solar Inverter is also known as Avidsen Soria. Installation instructions (in french) is availlable here: https://pim.avidsen.com/documentsproduits/fr/127100-notice-v3.pdf

After collecting all logs asked, I found that Loule-Corro already wrote a yaml config file for this device: https://github.com/Loule-Corro/tuya-local_karst-400/blob/main/Karst-400_solar_inverter.yaml

I tested it successfully - gives basic functionnalities. Some are missing :

Thanks for your great work !

Moutmout31 commented 4 months ago

Hi ! I've tried to customize Loule-Corro's file in order to add missing functionalities. I'll try it tomorrow (the system is down by night..). If it is successfull, I'll try to do a PR.

name: Solar kit 400W
products:
  - id: 0kllybtbzftaee7y
    name: Karst-400
primary_entity:
  entity: sensor
  class: energy
  dps:
    - id: 2
      type: integer
      name: reverse_energy_total
      unit: kWh
      class: measurement
      mapping:
        - scale: 100
    - id: 15
      name: inverter_type
      type: string
    - id: 16
      name: inverter_id
      type: string
    - id: 17
      name: imei_imsi
      type: string
secondary_entities:
  - entity: switch
    name: Inverter switch
    category: config
    dps:
      - id: 101
        type: boolean
        name: switch
        optional: true
  - entity: select
    name: Work mode
    category: config
    dps:
      - id: 12
        type: string
        name: option
        mapping:
          - dps_val: "power_off"
            icon: "mdi:power-off"
            value: Power off
          - dps_val: "converter_power"
            icon: "mdi:solar-power"
            value: Solar power
          - dps_val: "grid-power"
            icon: "mdi:transmission-tower"
            value: Grid power
          - dps_val: "battery_power"
            icon: "mdi:battery-charging"
            value: Battery power
  - entity: number
    name: Power Adjustement
    category: config
    dps:
      - id: 105
        type: integer
        class: power_factor
        name: value
        range:
          min: 0
          max: 100
        unit: "%"
  - entity: button
    name: Reset energy meter
    category: config
    dps:
      - id: 104
        type: string
        name: button
        class: restart
        mapping:
          - dps_val: "1"
            value: true
  - entity: sensor
    name: Power Adjustement
    dps:
      - id: 105
        name: sensor
        type: integer
        class: power_factor

  - entity: sensor
    name: AC Power
    class: power
    dps:
      - id: 103
        type: integer
        name: sensor
        unit: W
        force: true
        class: measurement
        mapping:
          - scale: 10
  - entity: sensor
    class: power
    name : Total Power
    dps:
      - id: 10
        type: integer
        name: sensor
        unit: W
        optional: true
        class: measurement
        mapping:
          - scale: 1000
  - entity: sensor
    name: PV Power
    class: power
    dps:
      - id: 102
        type: integer
        name: sensor
        unit: W
        force: true
        class: measurement
        mapping:
          - scale: 10
  - entity: sensor
    name: PV DC Voltage
    class: voltage
    category: diagnostic
    dps:
      - id: 3
        type: base64
        name: sensor
        unit: V
        force: true
        mapping:
          - mask: "FFFF00000000"
            scale: 10
  - entity: sensor
    name: PV DC Current
    class: current
    category: diagnostic
    dps:
      - id: 3
        type: base64
        name: sensor
        unit: A
        force: true
        mapping:
          - mask: "0000FFFF0000"
            scale: 10
  - entity: sensor
    name: PV DC Power
    class: power
    category: diagnostic
    dps:
      - id: 3
        type: base64
        name: sensor
        unit: kW
        force: true
        mapping:
          - mask: "00000000FFFF"
            scale: 100
  - entity: sensor
    name: AC Voltage
    class: voltage
    category: diagnostic
    dps:
      - id: 7
        type: base64
        name: sensor
        unit: V
        force: true
        mapping:
          - mask: "FFFF000000000000"
            scale: 10
  - entity: sensor
    name: AC Current
    class: current
    category: diagnostic
    dps:
      - id: 7
        type: base64
        name: sensor
        unit: A
        force: true
        mapping:
          - mask: "0000FFFFFF000000"
            scale: 1000
  - entity: sensor
    name: AC active power
    class: power
    category: diagnostic
    dps:
      - id: 7
        type: base64
        name: sensor
        unit: kW
        force: true
        mapping:
          - mask: "0000000000FFFFFF"
            scale: 1000

  - entity: sensor
    name: Energy out
    class: energy
    dps:
      - id: 2
        type: integer
        name: sensor
        unit: kWh
        class: total
        mapping:
          - scale: 100
  - entity: sensor
    name: Temperature
    class: temperature
    category: diagnostic
    dps:
      - id: 18
        name: sensor
        type: integer
        class: temperature
        unit: °C
Moutmout31 commented 4 months ago

Support added with PR https://github.com/make-all/tuya-local/pull/2043