From 352e5267d31a634b215b6ca153387b18732c1354 Mon Sep 17 00:00:00 2001 From: mrd0n Date: Wed, 18 Dec 2024 23:40:05 -0700 Subject: [PATCH] Add HVAC Actions --- README.md | 2 ++ components/tesla_ble_vehicle/tesla_ble_vehicle.cpp | 14 ++++++++++++++ components/tesla_ble_vehicle/tesla_ble_vehicle.h | 4 +++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cdb1c45..334f588 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Tested with M5Stack NanoC6 and Tesla firmwares 2024.26.3.1. - [x] Set charging amps - [x] Set charging limit (percent) - [x] Turn on/off charging +- [x] Turn on/off HVAC +- [x] Turn on/off steering heat - [x] BLE information sensors - [x] Asleep / awake - [x] Doors locked / unlocked diff --git a/components/tesla_ble_vehicle/tesla_ble_vehicle.cpp b/components/tesla_ble_vehicle/tesla_ble_vehicle.cpp index 6eada09..5290bff 100644 --- a/components/tesla_ble_vehicle/tesla_ble_vehicle.cpp +++ b/components/tesla_ble_vehicle/tesla_ble_vehicle.cpp @@ -1233,6 +1233,12 @@ namespace esphome case SET_CHARGING_LIMIT: action_str = "setChargingLimit"; break; + case SET_HVAC_SWITCH: + action_str = "setHVACSwitch"; + break; + case SET_HVAC_STEERING_HEATER_SWITCH: + action_str = "setHVACSteeringHeatSwitch"; + break; default: action_str = "setChargingParameters"; break; @@ -1259,6 +1265,14 @@ namespace esphome return_code = tesla_ble_client_->buildChargingSetLimitMessage( static_cast(param), message_buffer, &message_length); break; + case SET_HVAC_SWITCH: + return_code = tesla_ble_client_->buildHVACMessage( + static_cast(param), message_buffer, &message_length); + break; + case SET_HVAC_STEERING_HEATER_SWITCH: + return_code = tesla_ble_client_->buildHVACSteeringHeaterMessage( + static_cast(param), message_buffer, &message_length); + break; default: ESP_LOGE(TAG, "Invalid action: %d", static_cast(action)); return 1; diff --git a/components/tesla_ble_vehicle/tesla_ble_vehicle.h b/components/tesla_ble_vehicle/tesla_ble_vehicle.h index 54fc459..8e23760 100644 --- a/components/tesla_ble_vehicle/tesla_ble_vehicle.h +++ b/components/tesla_ble_vehicle/tesla_ble_vehicle.h @@ -29,7 +29,9 @@ typedef enum BLE_CarServer_VehicleAction_E { SET_CHARGING_SWITCH, SET_CHARGING_AMPS, - SET_CHARGING_LIMIT + SET_CHARGING_LIMIT, + SET_HVAC_SWITCH, + SET_HVAC_STEERING_HEATER_SWITCH } BLE_CarServer_VehicleAction; namespace esphome