make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.09k stars 443 forks source link

Request support for Kolanky 3.6kW EV charger #1853

Closed liouma closed 2 days ago

liouma commented 2 months ago

Log Message

{"10": 0, "101": "charing", "102": 244, "105": 96, "109": 23, "110": 385, "112": 2, "113": "Max16A", "114": 10, "115": 10, "118": 0, "119": 0, "120": 1, "124": "WaitOperation"}

As I'm not sure what kind of log you need, I post here:

Log files are attached

-> please see also the file at the bottom of this message. I hope it will save you some time tuya_local-25fc97d6b860c65d62cbd0543b4fc388-Chargeur de voiture-78d349f815a06639910bcb1e40952535.json

Logfile is attached, if you need anything more I'll be happy to provide it.

home-assistant_tuya_local_2024-04-26T08-09-24.277Z.log

Information about DPS mappings

{
  "result": {
    "model": "{\"modelId\":\"eljl98\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":3,\"accessMode\":\"ro\",\"code\":\"work_state\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-zhuangtai\"},\"name\":\"工作状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"charger_free\",\"charger_insert\",\"charger_free_fault\",\"charger_wait\",\"charger_charging\",\"charger_pause\",\"charger_end\",\"charger_fault\"]}},
{\"abilityId\":10,\"accessMode\":\"ro\",\"code\":\"fault\",\"description\":\"10 和 11 为过温错误 \",\"extensions\":{\"iconName\":\"icon-baojing\",\"scope\":\"fault\"},\"name\":\"故障告警\",\"typeSpec\":{\"type\":\"bitmap\",\"label\":[\"err_leak\",\"err_cp\",\"err_temp\",\"warn_a_uvp\",\"warn_b_uvp\",\"warn_c_uvp\",\"err_a_ovp\",\"err_b_ovp\",\"err_c_ovp\",\"err_ocp\",\"err_10\",\"err_11\",\"err_esb\",\"warn_pe_sck\",\"err_leak_sck\",\"err_pe\"],\"maxlen\":16}},
{\"abilityId\":11,\"accessMode\":\"rw\",\"code\":\"alarm_set_1\",\"description\":\"1.1 名称:告警设置1\\n1.2 含义:用于告知面板有哪些告警,对每个告警项进行设置,例如是否动作,动作阈值数值设置。\\n2 格式:HEX格式,大端模式, 总告警的数量*4字节= 设置告警总长度。\\n3,报文格式\\n每个告警由4个字节组成,第1个字节(表示该告警存在);第2个字节(发生此告警时,设备是否告警及保护动作;第3、4字节:设置告警阈值\",\"extensions\":{\"iconName\":\"icon-dp_warming\"},\"name\":\"告警设置1\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":12,\"accessMode\":\"rw\",\"code\":\"alarm_set_2\",\"description\":\"1.1 名称:告警设置2\\n1.2 含义:用于告知面板有哪些告警,对每个告警项进行设置,例如是否动作,动作阈值数值设置。\\n2 格式:HEX格式,大端模式, 总告警的数量*4字节= 设置告警总长度。\\n3,报文格式\\n每个告警由4个字节组成,第1个字节(表示该告警存在);第2个字节(发生此告警时,设备是否告警及保护动作;第3、4字节:设置告警阈值\",\"extensions\":{\"iconName\":\"icon-dp_warming\"},\"name\":\"告警设置2\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":14,\"accessMode\":\"rw\",\"code\":\"work_mode\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"trigger\":\"direct\"},\"name\":\"工作模式\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"charge_now\",\"charge_pct\",\"charge_energy\",\"charge_schedule\"]}},
{\"abilityId\":15,\"accessMode\":\"ro\",\"code\":\"balance_energy\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_lightning\"},\"name\":\"剩余可用电量\",\"typeSpec\":{\"type\":\"value\",\"max\":99999999,\"min\":0,\"scale\":3,\"step\":1,\"unit\":\"kW·h\"}},
{\"abilityId\":16,\"accessMode\":\"rw\",\"code\":\"clear_energy\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_lightning\"},\"name\":\"电量清零\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":18,\"accessMode\":\"rw\",\"code\":\"switch\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power2\",\"trigger\":\"direct\"},\"name\":\"开关\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":23,\"accessMode\":\"ro\",\"code\":\"system_version\",\"description\":\"1.1 名称:充电桩软硬件版本号\\n1.2 含义:硬件、固件等当前版本号\\n2 格式\\n  数据类型: string\\n  功能属性: 最大长度128字节\\n4 报文格式\\n   举例:\\\"HW V1.0,SW V1.0.3\\\"\",\"extensions\":{\"iconName\":\"icon-dp_mode\"},\"name\":\"系统版本\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}},
{\"abilityId\":25,\"accessMode\":\"ro\",\"code\":\"charge_energy_once\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-Ele\",\"attribute\":\"2048\",\"trigger\":\"direct\"},\"name\":\"单次充电量\",\"typeSpec\":{\"type\":\"value\",\"max\":999999,\"min\":1,\"scale\":2,\"step\":1,\"unit\":\"kW·h\"}},
{\"abilityId\":27,\"accessMode\":\"rw\",\"code\":\"online_state\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_updown\"},\"name\":\"在线状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"online\",\"offline\"]}},
{\"abilityId\":101,\"accessMode\":\"ro\",\"code\":\"DeviceState\",\"description\":\"\",\"name\":\"设备状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"no_connet\",\"connect\",\"charing\",\"wait_rfid\",\"finish\",\"wait_charing\",\"error\"]}},
{\"abilityId\":102,\"accessMode\":\"ro\",\"code\":\"A_Voltage\",\"description\":\"\",\"name\":\"输入电压\",\"typeSpec\":{\"type\":\"value\",\"max\":500,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"V\"}},
{\"abilityId\":103,\"accessMode\":\"ro\",\"code\":\"B_Voltage\",\"description\":\"\",\"name\":\"输入电压\",\"typeSpec\":{\"type\":\"value\",\"max\":500,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"V\"}},
{\"abilityId\":104,\"accessMode\":\"ro\",\"code\":\"C_Voltage\",\"description\":\"\",\"name\":\"输入电压\",\"typeSpec\":{\"type\":\"value\",\"max\":500,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"V\"}},
{\"abilityId\":105,\"accessMode\":\"ro\",\"code\":\"A_Current\",\"description\":\"\",\"name\":\"输出电流\",\"typeSpec\":{\"type\":\"value\",\"max\":600,\"min\":0,\"scale\":1,\"step\":1,\"unit\":\"A\"}},
{\"abilityId\":106,\"accessMode\":\"ro\",\"code\":\"B_Current\",\"description\":\"\",\"name\":\"输出电流\",\"typeSpec\":{\"type\":\"value\",\"max\":600,\"min\":0,\"scale\":1,\"step\":1,\"unit\":\"A\"}},
{\"abilityId\":107,\"accessMode\":\"ro\",\"code\":\"C_Current\",\"description\":\"\",\"name\":\"输出电流\",\"typeSpec\":{\"type\":\"value\",\"max\":600,\"min\":0,\"scale\":1,\"step\":1,\"unit\":\"A\"}},
{\"abilityId\":108,\"accessMode\":\"ro\",\"code\":\"PhaseFlag\",\"description\":\"\",\"name\":\"单三相标志\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"Single_phase\",\"Three_phase\",\"No_phase\",\"Phase_err\"]}},
{\"abilityId\":109,\"accessMode\":\"ro\",\"code\":\"DeviceKw\",\"description\":\"\",\"name\":\"设备功率\",\"typeSpec\":{\"type\":\"value\",\"max\":1000,\"min\":0,\"scale\":1,\"step\":1,\"unit\":\"kW\"}},
{\"abilityId\":110,\"accessMode\":\"ro\",\"code\":\"DeviceTemp\",\"description\":\"ID-111 为设备温度2 备用 \",\"name\":\"设备温度\",\"typeSpec\":{\"type\":\"value\",\"max\":1050,\"min\":-300,\"scale\":1,\"step\":1,\"unit\":\"℃\"}},
{\"abilityId\":111,\"accessMode\":\"ro\",\"code\":\"DeviceTemp2\",\"description\":\"设备温度2 备用\",\"name\":\"设备温度2\",\"typeSpec\":{\"type\":\"value\",\"max\":1050,\"min\":-300,\"scale\":1,\"step\":1,\"unit\":\"℃\"}},
{\"abilityId\":112,\"accessMode\":\"ro\",\"code\":\"DeviceKwh\",\"description\":\"一次充电的累计功率,拔枪后清零。\",\"name\":\"累计功率\",\"typeSpec\":{\"type\":\"value\",\"max\":10000,\"min\":0,\"scale\":1,\"step\":1,\"unit\":\"kWh\"}},
{\"abilityId\":113,\"accessMode\":\"ro\",\"code\":\"DeviceMaxSetA\",\"description\":\"\",\"name\":\"最大电流设置\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"Max16A\",\"Max32A\",\"Max40A\",\"Max50A\"]}},
{\"abilityId\":114,\"accessMode\":\"rw\",\"code\":\"Set16A\",\"description\":\"\",\"name\":\"设置电流\",\"typeSpec\":{\"type\":\"value\",\"max\":16,\"min\":6,\"scale\":0,\"step\":1,\"unit\":\"A\"}},
{\"abilityId\":115,\"accessMode\":\"rw\",\"code\":\"Set32A\",\"description\":\"\",\"name\":\"设置电流\",\"typeSpec\":{\"type\":\"value\",\"max\":32,\"min\":8,\"scale\":0,\"step\":1,\"unit\":\"A\"}},
{\"abilityId\":116,\"accessMode\":\"rw\",\"code\":\"Set40A\",\"description\":\"\",\"name\":\"设置电流\",\"typeSpec\":{\"type\":\"value\",\"max\":40,\"min\":12,\"scale\":0,\"step\":1,\"unit\":\"A\"}},
{\"abilityId\":117,\"accessMode\":\"rw\",\"code\":\"Set50A\",\"description\":\"\",\"name\":\"设置电流\",\"typeSpec\":{\"type\":\"value\",\"max\":50,\"min\":12,\"scale\":0,\"step\":1,\"unit\":\"\"}},
{\"abilityId\":118,\"accessMode\":\"rw\",\"code\":\"SetDelayTime\",\"description\":\"\",\"name\":\"预约充电\",\"typeSpec\":{\"type\":\"value\",\"max\":15,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"H\"}},
{\"abilityId\":119,\"accessMode\":\"rw\",\"code\":\"SetDefineTime\",\"description\":\"\",\"name\":\"定时充电\",\"typeSpec\":{\"type\":\"value\",\"max\":15,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"H\"}},
{\"abilityId\":120,\"accessMode\":\"ro\",\"code\":\"Ctime\",\"description\":\"\",\"name\":\"时间\",\"typeSpec\":{\"type\":\"value\",\"max\":480,\"min\":0,\"scale\":1,\"step\":1,\"unit\":\"H\"}},
{\"abilityId\":121,\"accessMode\":\"ro\",\"code\":\"CTime2\",\"description\":\"未使用\",\"name\":\"充电时间\",\"typeSpec\":{\"type\":\"value\",\"max\":480,\"min\":0,\"scale\":1,\"step\":1,\"unit\":\"H\"}},
{\"abilityId\":122,\"accessMode\":\"rw\",\"code\":\"IDVerificationSet\",\"description\":\"\",\"name\":\"身份验证设置\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":123,\"accessMode\":\"rw\",\"code\":\"RFID\",\"description\":\"\",\"extensions\":{\"trigger\":\"direct\"},\"name\":\"刷卡\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":124,\"accessMode\":\"rw\",\"code\":\"ChargingOperation\",\"description\":\"\",\"name\":\"充电操作\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"OpenCharging\",\"CloseCharging\",\"WaitOperation\"]}}]}]}"
  },
  "success": true,
  "t": 1714116683333,
  "tid": "fb9798dc039e11efb2424a20391ad943"
}

Product ID

{ "result": [ { "active_time": 1712815917, "bind_space_id": "40316186", "category": "qccdz", "create_time": 1712815917, "custom_name": "", "icon": "smart/icon/bay16226250696545rLI/4aa9904ab71f8c8baf9131a4467773fb.png", "id": "bf49daa00b00f1e475sd95", "ip": "92.130.66.134", "is_online": true, "lat": "-21.2700", "local_key": "ocM{T.:u$~&q%?u.", "lon": "55.4900", "model": "", "name": "AC charging control box", "product_id": "7bvgooyjhiua1yyq", "product_name": "河南新乡", "sub": false, "time_zone": "+04:00", "update_time": 1712815920, "uuid": "d698029059e38d5c" } ], "success": true, "t": 1714118185689, "tid": "7b10e01003a211efa95c2ed630a352ef" }

Information about how the device functions

Sensors: Charging time ie 1:30 -> display the past charging time Courant ie 11,8 A -> display the current charge current in A Énergie ie 4,3 kWh -> display the energy Puissance -> ie 2,9 kW -> display the power Status ie Charging : display the status

Configuration Charging duration : here you can limit the charging time (1 - 15) hours Charging mode : here you can start or stop the charge. Possible values are:

Diagnostic Température ie 47,5 °C -> display the charger temp Tension : ie 248 V -> display the voltage

There is no other info available in the TUYA app.

I made the following file. Everything is working fine in read only, but I can not set the parameters from the "configuration" section. When I set a parameter, the value is reverted in the GUI and there is no change visible in the tuya app. The settings are read only and I don't understand why. But I never did this before so obviously I forgot something.

EDIT: this file is working fine. The problem disapeared, it was not coming from the device settnig.

name: EV charger products:

secondary_entities:

make-all commented 2 months ago

The log message needed is the one that is output to HA log when you try to add the device using this integration. That contains the exact DPS that were seen at that time, which is important to correctly match the device. The diagnostic log contains all the dps that the device has sent this session, which in most cases will be the same set, but for some devices there are additional dps not sent in that initial connection that cone through later, so I can make a config based on diagnostics but there is no guarantee it will match.

liouma commented 2 months ago

Sorry. Please find the file attached. I removed the device from local tuya and included it back recording logs.

You can look for "EV charger" in the logfile: home-assistant_tuya_local_2024-04-27T06-00-40.707Z.log

I left the yaml file I made for this device in tuya local. If you want, I can remove the file and run the procedure again. I hope this is the log you were expecting, otherwise please ask, I'll be happy to send a new one.

liouma commented 1 month ago

After more testing, it appear that the file I uploaded is working fine. You can control it, make some improvement and validate it. The problems I reported earlier have diseapered, I can set the values.

fabbermen commented 1 week ago

I own a Kolanky 11kW charger (3 phase); when I tried to use the proposed configuration to add the device, it wouldn't recognize it at all (0% match). I had to delete ID 120; after that, device was added and it works great. Logs before and after: Device matches None with quality of 0%. DPS: {"updated_at": 1720516523.7142155, "10": 0, "101": "no_connet", "102": 394, "105": 0, "109": 0, "110": 421, "112": 0, "113": "Max16A", "114": 16, "115": 16, "116": 16, "117": 16, "118": 0, "119": 0, "124": "WaitOperation"} Device matches 11kW_EVSE with quality of 73%. DPS: {"updated_at": 1720516743.2816513, "10": 0, "101": "no_connet", "102": 396, "105": 0, "109": 0, "110": 421, "112": 0, "113": "Max16A", "114": 16, "115": 16, "116": 16, "117": 16, "118": 0, "119": 0, "124": "WaitOperation"} I also placed the ID 120 back as optional, after the device was added. Now charging time is also reported.

make-all commented 1 week ago

Thanks for your feedback, I have made the suggested changes.

liouma commented 1 day ago

Sorry but since last update my kolanky charger 1 phase is not recognized anymore. Before it was working fine with the following file. Is there a 1 phase and a 2 phases versions ??


name: EV charger
products:
  - id: 7bvgooyjhiua1yyq
    name: Kolanky 3.6kW EV charger
primary_entity:
  entity: sensor
  class: enum
  name: Status
  icon: "mdi:ev-station"
  dps:
    - id: 101
      type: string
      name: sensor
      mapping:
        - dps_val: no_connect
          value: Disconnected
        - dps_val: connect
          value: Connected
        - dps_val: charing
          value: Charging
        - dps_val: wait_rfid
          value: Waiting for authorization
        - dps_val: finish
          value: Charged
        - dps_val: wait_charing
          value: Delaying charge
        - dps_val: error
          value: Error

secondary_entities:
  - entity: select
    name: Charging mode
    icon: "mdi:ev-station"
    category: config
    dps:
      - id: 124
        type: string
        name: option
        mapping:
          - dps_val: OpenCharging
            value: Start charging
          - dps_val: CloseCharging
            value: Stop charging
          - dps_val: WaitOperation
            value: No operation
  - entity: number
    name: Set charge current
    category: config
    icon: "mdi:ev-plug-type2"
    dps:
      - id: 114
        type: integer
        name: value
        unit: A
        range:
          min: 6
          max: 16
        mapping:
          - constraint: max_current
            conditions:
              - dps_val: false
                value_redirect: current_16_limit
                range:
                  min: 6
                  max: 16
  - entity: number
    name: Set delay time
    category: config
    icon: "mdi:car-clock"
    dps:
      - id: 118
        type: integer
        name: value
        unit: h
        range:
          min: 0
          max: 15
  - entity: sensor
    class: energy
    dps:
      - id: 112
        type: integer
        name: sensor
        unit: kWh
        class: measurement
        mapping:
          - scale: 10
  - entity: sensor
    class: voltage
    category: diagnostic
    dps:
      - id: 102
        type: integer
        name: sensor
        unit: V
        class: measurement
  - entity: sensor
    class: current
    dps:
      - id: 105
        type: integer
        name: sensor
        unit: A
        class: measurement
        mapping:
          - scale: 10
  - entity: sensor
    class: power
    dps:
      - id: 109
        type: integer
        name: sensor
        unit: kW
        class: measurement
        mapping:
          - scale: 10
  - entity: sensor
    class: temperature
    category: diagnostic
    dps:
      - id: 110
        type: integer
        name: sensor
        unit: C
        class: measurement
        mapping:
          - scale: 10
  - entity: number
    name: Charging duration
    category: config
    icon: "mdi:car-clock"
    dps:
      - id: 119
        type: integer
        name: value
        unit: h
        range:
          min: 0
          max: 15
  - entity: sensor
    name: Charging time
    class: duration
    dps:
      - id: 120
        optional: true
        type: integer
        name: sensor
        unit: min
        mapping:
          - scale: 10
make-all commented 1 day ago

The changes made to support the 11kW version in previous comment did not affect the detection of 3.6kW version, they only made 1 dp optional, and changed one value in a mapping which also matches the info you provided.

Without a log message, it is difficult to say what is happening in your case. EV chargers seem to support many charging modes, and may have different expectations of available DPs depending on what mode they are in.