Skip to content

Commit

Permalink
Add HVAC Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mrd0n committed Dec 19, 2024
1 parent 0559ec7 commit 352e526
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions components/tesla_ble_vehicle/tesla_ble_vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -1259,6 +1265,14 @@ namespace esphome
return_code = tesla_ble_client_->buildChargingSetLimitMessage(
static_cast<int32_t>(param), message_buffer, &message_length);
break;
case SET_HVAC_SWITCH:
return_code = tesla_ble_client_->buildHVACMessage(
static_cast<bool>(param), message_buffer, &message_length);
break;
case SET_HVAC_STEERING_HEATER_SWITCH:
return_code = tesla_ble_client_->buildHVACSteeringHeaterMessage(
static_cast<bool>(param), message_buffer, &message_length);
break;
default:
ESP_LOGE(TAG, "Invalid action: %d", static_cast<int>(action));
return 1;
Expand Down
4 changes: 3 additions & 1 deletion components/tesla_ble_vehicle/tesla_ble_vehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 352e526

Please sign in to comment.