Integration Home Assistant locale pour borne Tuya en LAN via tinytuya.
Local Home Assistant integration for Tuya EV chargers over LAN using tinytuya.
Repository: https://github.com/lachand/EV_charger
Author: Valentin Lachand Pascal (GitHub: @lachand)
Tested charger reference: de-portable-ev-charger-3-5kw-v2
- Ajoute ce depot dans HACS (
Integrations>Custom repositories> categorieIntegration). - Installe
Tuya EV Charger Localpuis redemarre Home Assistant. - Recupere
host,device_id,local_key(voir section plus bas). - Ajoute l'integration depuis
Parametres>Appareils et services.
- Add this repository in HACS (
Integrations>Custom repositories>Integrationcategory). - Install
Tuya EV Charger Local, then restart Home Assistant. - Collect
host,device_id,local_key(see section below). - Add the integration from
Settings>Devices & Services.
Recommended method (TinyTuya + Tuya IoT Cloud):
- Create a developer account on https://iot.tuya.com.
- Create a Smart Home cloud project.
- Link your Tuya/Smart Life app account to that project.
- Run:
python -m tinytuya wizard- Enter API Key, API Secret and region.
- Read
device_idandlocal_keyfrom output or generateddevices.json.
Notes:
- If you re-pair/reset the device,
local_keycan change. local_keyis a secret.
The surplus UX is intentionally short.
User entities:
switch.charge_sessionnumber.charge_currentswitch.surplus_modebinary_sensor.surplus_regulation_activesensor.surplus_last_decision_reasonsensor.surplus_raw_wsensor.surplus_effective_wsensor.surplus_battery_discharge_over_limit_wsensor.surplus_target_current_anumber.surplus_battery_soc_high_threshold_pctnumber.surplus_battery_soc_low_threshold_pctnumber.surplus_start_threshold_wnumber.surplus_stop_threshold_wnumber.surplus_max_battery_discharge_for_ev_wselect.surplus_profile
classicvszero_injectionis auto-detected:- if curtailed power sensor is configured ->
zero_injection - else ->
classic - Battery hysteresis:
- above high threshold: curtailed/battery contribution allowed
- below low threshold: curtailed/battery contribution blocked
- Optional battery net-discharge guard:
- configurable max discharge budget (W) for EV charging
- discharge above budget is subtracted from available surplus (downshift if possible)
- Forecast is optional and used only as anti-drop guard (avoid stop on short cloud transient).
- Quick profiles:
eco: conservative, avoids battery dischargebalanced: default behaviorfast: reacts faster and starts with lower surplus- The rest is fixed internally (voltage, ramp, delays, cooldowns, protections).
scan_intervalcharger_profilecharger_profile_json(optional)surplus_mode_enabledsurplus_sensor_entity_id+surplus_sensor_invertedsurplus_curtailment_sensor_entity_id+surplus_curtailment_sensor_inverted(optional)surplus_battery_soc_sensor_entity_id(optional)surplus_battery_soc_high_threshold_pctsurplus_battery_soc_low_threshold_pctsurplus_battery_net_discharge_sensor_entity_id+surplus_battery_net_discharge_sensor_inverted(optional)surplus_allow_battery_discharge_for_evsurplus_max_battery_discharge_for_ev_wsurplus_start_threshold_wsurplus_stop_threshold_wsurplus_forecast_sensor_entity_id(optional)
tuya_ev_charger.force_charge_fortuya_ev_charger.pause_surplustuya_ev_charger.profile_assistanttuya_ev_charger.set_surplus_profile
sensor: electrical values, charger state, diagnosticsnumber: current setpoint + battery high/low thresholdsswitch: charge session, NFC, surplus modebinary_sensor: surplus regulation activebutton: reboot charger
A simplified example card is provided:
lovelace/charge_intelligente.yaml
Repository side requirements:
- Add repository description
- Add valid topics
- Provide brand assets or submit brand to Home Assistant brands repo
Integration side requirements:
hacs.jsonmust use valid keysmanifest.jsonmust includeissue_trackermanifest.jsonkeys must be sorted (domain,name, then alphabetical)