Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HVAC and Steering Heat Switch #90

Closed
wants to merge 16 commits into from
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 @@ -1224,6 +1224,12 @@ namespace esphome
std::string action_str;
switch (action)
{
case SET_HVAC_SWITCH:
action_str = "setHVACSwitch";
break;
case SET_HVAC_STEERING_HEATER_SWITCH:
action_str = "setHVACSteeringHeatSwitch";
break;
case SET_CHARGING_SWITCH:
action_str = "setChargingSwitch";
break;
Expand All @@ -1247,6 +1253,14 @@ namespace esphome
ESP_LOGI(TAG, "[%s] Building message..", action_str.c_str());
switch (action)
{
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;
case SET_CHARGING_SWITCH:
return_code = tesla_ble_client_->buildChargingSwitchMessage(
static_cast<bool>(param), message_buffer, &message_length);
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
Binary file modified docs/ha-controls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions packages/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,26 @@ sensor:
entity_category: diagnostic

switch:
- platform: template
name: "HVAC switch"
optimistic: true
assumed_state: true # we can't read the state
restore_mode: RESTORE_DEFAULT_OFF
turn_on_action:
- lambda: id(tesla_ble_vehicle_id)->sendCarServerVehicleActionMessage(SET_HVAC_SWITCH, 1);
turn_off_action:
- lambda: id(tesla_ble_vehicle_id)->sendCarServerVehicleActionMessage(SET_HVAC_SWITCH, 0);

- platform: template
name: "Steering Heater switch"
optimistic: true
assumed_state: true # we can't read the state
restore_mode: RESTORE_DEFAULT_OFF
turn_on_action:
- lambda: id(tesla_ble_vehicle_id)->sendCarServerVehicleActionMessage(SET_HVAC_STEERING_HEATER_SWITCH, 1);
turn_off_action:
- lambda: id(tesla_ble_vehicle_id)->sendCarServerVehicleActionMessage(SET_HVAC_STEERING_HEATER_SWITCH, 0);

- platform: template
name: "Charger switch"
optimistic: true
Expand Down
Loading