azerty9971 / xtend_tuya

eXtend Tuya's integration
GNU General Public License v3.0
64 stars 7 forks source link

Support for Tuya EV Chargers (i.e. "Vevor") #106

Closed cannondale0815 closed 1 month ago

cannondale0815 commented 2 months ago

Hi Azerty, you mentioned in this discussion that you would look into adding support for Tuya based EV chargers to your HACS extension. Just leaving this here as a formal request :)

Diagnostics:

  "data": {
    "endpoint": "https://apigw.tuyaus.com",
    "terminal_id": "REMOVED -- DO YOU NEED IT?",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "id": "REMOVED -- DO YOU NEED IT?",
    "name": "Car Charger",
    "category": "qccdz",
    "product_id": "w7lvyyxyevpwf20e",
    "product_name": "SS_US_7kW",
    "online": false,
    "sub": false,
    "time_zone": "-04:00",
    "active_time": "2024-09-20T17:33:05+00:00",
    "create_time": "2024-09-20T17:33:05+00:00",
    "update_time": "2024-09-20T17:33:05+00:00",
    "function": {
      "charge_cur_set": {
        "type": "Integer",
        "value": {
          "unit": "A",
          "min": 8,
          "max": 32,
          "scale": 0,
          "step": 1
        }
      },
      "work_mode": {
        "type": "Enum",
        "value": {
          "range": [
            "charge_now",
            "charge_pct",
            "charge_energy",
            "charge_schedule"
          ]
        }
      },
      "clear_energy": {
        "type": "Boolean",
        "value": {}
      },
      "switch": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status_range": {
      "forward_energy_total": {
        "type": "Integer",
        "value": {
          "unit": "kW\u00b7h",
          "min": 0,
          "max": 99999999,
          "scale": 2,
          "step": 1
        }
      },
      "work_state": {
        "type": "Enum",
        "value": {
          "range": [
            "charger_free",
            "charger_insert",
            "charger_free_fault",
            "charger_wait",
            "charger_charging",
            "charger_pause",
            "charger_end",
            "charger_fault"
          ]
        }
      },
      "charge_cur_set": {
        "type": "Integer",
        "value": {
          "unit": "A",
          "min": 8,
          "max": 32,
          "scale": 0,
          "step": 1
        }
      },
      "sigle_phase_power": {
        "type": "Integer",
        "value": {
          "unit": "kW",
          "min": 0,
          "max": 99999999,
          "scale": 3,
          "step": 1
        }
      },
      "power_total": {
        "type": "Integer",
        "value": {
          "unit": "kW",
          "min": 0,
          "max": 99999999,
          "scale": 3,
          "step": 1
        }
      },
      "connection_state": {
        "type": "Enum",
        "value": {
          "range": [
            "controlpi_12v",
            "controlpi_12v_pwm",
            "controlpi_9v",
            "controlpi_9v_pwm",
            "controlpi_6v",
            "controlpi_6v_pwm",
            "controlpi_error"
          ]
        }
      },
      "work_mode": {
        "type": "Enum",
        "value": {
          "range": [
            "charge_now",
            "charge_pct",
            "charge_energy",
            "charge_schedule"
          ]
        }
      },
      "clear_energy": {
        "type": "Boolean",
        "value": {}
      },
      "switch": {
        "type": "Boolean",
        "value": {}
      },
      "temp_current": {
        "type": "Integer",
        "value": {
          "unit": "\u2103",
          "min": -40,
          "max": 200,
          "scale": 0,
          "step": 1
        }
      },
      "charge_energy_once": {
        "type": "Integer",
        "value": {
          "unit": "kW\u00b7h",
          "min": 1,
          "max": 999999,
          "scale": 2,
          "step": 1
        }
      }
    },
    "status": {
      "forward_energy_total": 0,
      "work_state": "charger_free",
      "charge_cur_set": 16,
      "sigle_phase_power": 0,
      "power_total": 0,
      "connection_state": "controlpi_12v",
      "work_mode": "charge_now",
      "clear_energy": true,
      "switch": false,
      "temp_current": 31,
      "charge_energy_once": 942
    },
    "home_assistant": {
      "name": "Car Charger",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": []
    },
    "set_up": false,
    "support_local": true
  }
azerty9971 commented 1 month ago

Hello, By any chance would it be possible to share the device with me? It's way easier for me to implement it this way :).

If that's OK, can you share it with my Tuya/Smartlife account devun999999@gmail.com (you have to do that from the app itself :))

Thanks in advance, Azerty

cannondale0815 commented 1 month ago

Will do -- what's your region/country? SmartLife is asking me for that when trying to share with you.

Also note that the device isn't constantly connected, so you may only see it online sporadically, usually during normal US working hours.

Thanks, I appreciate it!

On Sun, Sep 29, 2024, 07:47 azerty9971 @.***> wrote:

Hello, By any chance would it be possible to share the device with me? It's way easier for me to implement it this way :).

If that's OK, can you share it with my Tuya/Smartlife account @.*** (you have to do that from the app itself :))

Thanks in advance, Azerty

— Reply to this email directly, view it on GitHub https://github.com/azerty9971/xtend_tuya/issues/106#issuecomment-2381325243, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBRSOXDR6OUEIFGUC3JXDTZY7SEVAVCNFSM6AAAAABOYPQ4CWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBRGMZDKMRUGM . You are receiving this because you authored the thread.Message ID: @.***>

azerty9971 commented 1 month ago

Hello, my country is Belgium :).

No worries, even offline I should be able to get the infos from the cloud ;)

cannondale0815 commented 1 month ago

I just tried and unfortunately it doesn't allow me to share my device with someone in a different region. Can you perhaps create a dummy USA account for yourself?

On Sun, Sep 29, 2024, 19:27 azerty9971 @.***> wrote:

Hello, my country is Belgium :).

No worries, even offline I should be able to get the infos from the cloud ;)

— Reply to this email directly, view it on GitHub https://github.com/azerty9971/xtend_tuya/issues/106#issuecomment-2381650184, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBRSOSLHOC4OND5DBFTMETZZCEG5AVCNFSM6AAAAABOYPQ4CWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBRGY2TAMJYGQ . You are receiving this because you authored the thread.Message ID: @.***>

azerty9971 commented 1 month ago

Hello, Could you retry with: devun999999.us@gmail.com ?

Thanks in advance, Azerty

cannondale0815 commented 1 month ago

That worked and I shared it with you, thank you! Let me know what else I can do to help.

On Mon, Sep 30, 2024, 06:55 azerty9971 @.***> wrote:

Hello, Could you retry with: @.*** ?

Thanks in advance, Azerty

— Reply to this email directly, view it on GitHub https://github.com/azerty9971/xtend_tuya/issues/106#issuecomment-2382855345, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBRSOROSND7IQUMMSSGTADZZEU2DAVCNFSM6AAAAABOYPQ4CWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBSHA2TKMZUGU . You are receiving this because you authored the thread.Message ID: @.***>

cannondale0815 commented 1 month ago

@azerty9971 FYI, the device is online for the next few hours while my wife is charging our 2023 Prius Prime at work. No rush and no pressure from my end at all, just an FYI.

azerty9971 commented 1 month ago

Hello, Really sorry for the delay but last week was super busy :/.

I''ve made the implementation in the latest BETA build, can you please update to it and let me know if everything works as expected?

Also, some texts were quite cryptic to me, so if you have things that are mistranslated don't hesitate to point them out to me and I'll fix them :).

Have a nice day, Azerty

cannondale0815 commented 1 month ago

There is no need to apologize. You are doing voluntary work for the benefit of the community, and that is always appreciated. Thank you so much for this, I will test it today/tomorrow and report back! :)

cannondale0815 commented 1 month ago

Good news, your latest beta 16 added new entities to the device! I haven't plugged in the device yet to observe functionality, but this looks great already! I will report back once we tried charging the car, likely sometime tomorrow. Thank you @azerty9971 !

Screenshot 2024-10-07 102418

cannondale0815 commented 1 month ago

@azerty9971 The device is now plugged in and connected to WiFi. It shows up in the SmartLife app, but in HA, all entities are still showing as unavailable (same as in my previous message). I set up Xtend_Tuya alongside the regular Tuya cloud integration without using additional credentials.

You still have access to it (shared with your US account) in case you want to have a look. It's plugged in now for 12 hours or so, and then probably again sometime tomorrow.

Thanks again for everything!

azerty9971 commented 1 month ago

That is strange, on my side I see them: image

Is it possible that it just took a bit of time to report the online status?

cannondale0815 commented 1 month ago

Oh, I just restarted HA once more and now it's all there! Yay! :)

My wife will try charging tomorrow and I'll keep an eye out for the various charge states and report back -- thank you!!!

cannondale0815 commented 1 month ago

@azerty9971 So we unplugged the device for the past ten hours, but in HA, I still see all the previous entity values. It seems it doesn't update it unless I reboot HA (which is what I had to do yesterday). Should I be using Xtend_Tuya with a different authentication method perhaps (i.e. not alongside Tuya)?

azerty9971 commented 1 month ago

Hello, Before you mess with the credentials, I'd like to test something out :).

Can you update to the latest beta and let me know if the device now correctly shows its online/offline status?

Thanks in advance, Azerty

cannondale0815 commented 1 month ago

Thank you! I installed the new beta 18 and am waiting for my wife to return from work, so I can test it with the charger :) Will report back!

cannondale0815 commented 1 month ago

@azerty9971 So I plugged the charger back into an outlet and I can again see that it shows up in the SmartLife app, but all the entities in HA are still "unavailable" in beta 18. Presumably, once I restart HA, they would show up again.

azerty9971 commented 1 month ago

can we do a small Google Meet to test this together?

azerty9971 commented 1 month ago

https://meet.google.com/svs-jxiy-kay

cannondale0815 commented 1 month ago

Thank you @azerty9971 for the debugging session yesterday! For anyone else who comes here, this particular EV charger is now working well with the Xtend_Tuya integration. One thing that had to be done was to completely disable the native Tuya integration in HA and then 'repair' the Xtend_Tuya authenticaton afterwards.

Here are more details about this particular charger model: