make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.47k stars 563 forks source link

Request support for EV charger [AFYEEV 32A 22kw] #2108

Closed jmcollin78 closed 2 weeks ago

jmcollin78 commented 5 months ago

Hello, here is new device file for adding a AFYEEV 32A 22kw EV charger. It could be great to integrate it directly into your devices directory.

name: EV charger
products:
  - id: aaaealnecwgwerjl
    name: AFYEEV 32A EV charger
primary_entity:
  entity: sensor
  class: enum
  name: Status
  icon: "mdi:ev-station"
  dps:
    - id: 3
      type: string
      name: sensor
      mapping:
        - dps_val: charger_free
          value: Disconnected
        - dps_val: charger_insert
          value: Connected
        - dps_val: charger_free_fault
          value: Fault (disconnected)
        - dps_val: charger_charging
          value: Charging
        - dps_val: charger_wait
          value: Waiting
        - dps_val: charger_end
          value: Charged
        - dps_val: charger_fault
          value: Fault
        - dps_val: charger_pause
          value: Pause
secondary_entities:
  - entity: number
    name: Set current
    icon: "mdi:ev-plug-type2"
    dps:
      - id: 4
        type: integer
        name: value
        unit: A
        range:
          min: 6
          max: 16
  - entity: sensor
    icon: "mdi:flash"
    name: Single phase power
    class: power
    dps:
      - id: 5
        type: integer
        name: sensor
        unit: W
        class: measurement
        precision: 1
        mapping:
          - scale: 3
  - entity: sensor
    icon: "mdi:flash"
    name: Total power
    class: power
    dps:
      - id: 9
        type: integer
        name: sensor
        unit: W
        class: measurement
        precision: 1
        mapping:
          - scale: 1
  - entity: sensor
    name: Fault reason
    icon: 'mdi:alert-outline'
    class: enum
    dps:
      - id: 10
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: "Ready"
          - dps_val: 1
            value: "Ov2 Cr Fault"
          - dps_val: 2
            value: "OV Vol"
          - dps_val: 4
            value: "Undervoltage alarm"
          - dps_val: 8
            value: "Contactor adhesion"
          - dps_val: 16
            value: "Contactor fault"
          - dps_val: 32
            value: "Earth fault"
          - dps_val: 64
            value: "Meter Hardware alarm"
          - dps_val: 128
            value: "Scram fault"
          - dps_val: 256
            value: "CP fault"
          - dps_val: 512
            value: "Meter Commu fault"
          - dps_val: 1024
            value: "Card reader fault"
          - dps_val: 2048
            value: "Cir short fault"
          - dps_val: 4096
            value: "Adhesion fault"
          - dps_val: 8192
            value: "Self test alarm"
          - dps_val: 16384
            value: "Leakage current fault"
  - entity: select
    name: Working mode
    icon: "mdi:list-box-outline"
    dps:
      - id: 14
        type: string
        name: option
        mapping:
          - dps_val: charge_now
            value: Charge now
          - dps_val: charge_pct
            value: Charge PCT
          - dps_val: charge_energy
            value: Charge energy
          - dps_val: charge_schedule
            value: Charge schedule
          - dps_val: charge_delay
            value: Charge delay
  - entity: switch
    name: Power switch
    icon: "mdi:power"
    dps:
      - id: 18
        type: boolean
        optional: true
        force: true
        name: switch
  - entity: sensor
    class: temperature
    name: Temperature
    # category: diagnostic
    dps:
      - id: 24
        type: integer
        name: sensor
        unit: °C
        class: measurement
        mapping:
          - scale: 1
  - entity: sensor
    name: Charge energy once
    class: energy
    dps:
      - id: 25
        type: integer
        name: sensor
        unit: kWh
        class: total_increasing
        optional: true
        mapping:
          - scale: 2
  - entity: sensor
    class: enum
    name: Online state
    icon: "mdi:wifi"
    dps:
      - id: 27
        optional: true
        type: string
        name: sensor
        mapping:
          - dps_val: offline
            value: Offline
          - dps_val: online
            value: Online
  - entity: number
    name: Timer
    # category: config
    icon: "mdi:car-clock"
    dps:
      - id: 28
        type: integer
        name: value
        unit: h
        optional: true
        range:
          min: 0
          max: 15
nicolas-sora commented 4 months ago

I have almost the same product with a different Product ID and support for 32A. I will open a different request

nicolas-sora commented 4 months ago

I'm not sure if it's the best place to report this I get this error where the integration fails to load from time to time

Logger: custom_components.tuya_local.device Source: custom_components/tuya_local/device.py:546 integration: Tuya Local (documentation, issues) First occurred: 2:08:11 PM (1010 occurrences) Last logged: 7:16:24 PM

Failed to refresh device state for EV charger. Failed to update device dps for EV charger Failed to fetch device status for EV charger

jmcollin78 commented 1 month ago

Thank you ! I will wait for the release

nicolas-sora commented 1 month ago

Thank you ! I hope it perhaps includes my product Id too 🤞

make-all commented 1 month ago

I notice the range on the current is up to 16A, but the title says this is for a 32A charger. The range is currently the only functional difference with the config submitted by @nicolas-sora, so if they both actually go to 32, it would be easier.

jmcollin78 commented 1 month ago

You are right, the correct max value should be 32 A because it is a 32 A chargeur.

max: 32
cerede2000 commented 3 weeks ago

Please correct : dps:

to : dps:

Because temp is divide by 10 :(