Skip to content

Commit

Permalink
Merge pull request #439 from alandtse/dev
Browse files Browse the repository at this point in the history
2022-12-17
  • Loading branch information
alandtse authored Dec 18, 2022
2 parents 3e4a105 + c96e5b0 commit 4109059
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@ The `Tesla` integration offers integration with the [Tesla](https://auth.tesla.c

This integration provides the following entities for vehicles:

- Binary sensors - charger connection, charging status, car online and parking brake.
- Buttons - horn, flash lights, wake up<sup>1</sup>, force data update<sup>1</sup> and trigger HomeLink. **Note:** The HomeLink button is disabled by default as some vehicles don't have this option. Enable via configuration/entities if desired.
- Binary sensors - charger connection, charging status, car online, parking brake, car asleep, and door status.
- Buttons - horn, flash lights, wake up<sup>1</sup>, force data update<sup>1</sup>, trigger HomeLink, and remote start. **Note:** The HomeLink button is disabled by default as some vehicles don't have this option. Enable via configuration/entities if desired.
- Climate - turn HVAC on/off, set target temperature, set preset modes (defrost, keep on, dog mode and camp mode).
- Device tracker - car location<sup>1</sup>.
- Device tracker - car location<sup>1</sup>, and active route destination.
- Cover - Charger door, frunk, trunk, and windows.
- Locks - door lock, and charge port latch lock.
**Note:** Set `state` to `heat_cool` or `off` to enable/disable your Tesla's climate system via a scene.
- Selects - seat heaters and cabin overheat protection<sup>2</sup>. **Note:** Turning on a heated seat will cause the climate to turn on.
- Sensors - battery level, charge rate, energy added, inside/outside temperature, odometer and estimated range.
- Switches - heated steering wheel, charger, sentry mode and polling<sup>1</sup>.
- Sensors - battery level, charge rate, energy added, charger power, inside/outside temperature, odometer, estimated range, time charge complete, TPMS pressure, active route arrival time and distance to arrival.
- Switches - heated steering wheel, charger, sentry mode, polling, and valet mode.<sup>1</sup>.
- Update - software update<sup>2</sup>

<sup>1</sup> *Diagnostics entities.*<br/>
Expand Down
9 changes: 7 additions & 2 deletions custom_components/tesla_custom/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
"third row right": 7,
}

AUTO_SEAT_ID_MAP = {
"left": 1,
"right": 2,
}


async def async_setup_entry(hass: HomeAssistant, config_entry, async_add_entities):
"""Set up the Tesla selects by config_entry."""
Expand Down Expand Up @@ -118,12 +123,12 @@ async def async_select_option(self, option: str, **kwargs):
if self._is_auto_available and option == FRONT_HEATER_OPTIONS[4]:
_LOGGER.debug("Setting %s to %s", SEAT_ID_MAP[self._seat_name], option)
await self._car.remote_auto_seat_climate_request(
SEAT_ID_MAP[self._seat_name], True
AUTO_SEAT_ID_MAP[self._seat_name], True
)
else:
if self.current_option == FRONT_HEATER_OPTIONS[4]:
await self._car.remote_auto_seat_climate_request(
SEAT_ID_MAP[self._seat_name], False
AUTO_SEAT_ID_MAP[self._seat_name], False
)

level: int = HEATER_OPTIONS.index(option)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def test_car_heated_seat_select(hass: HomeAssistant) -> None:
{ATTR_ENTITY_ID: "select.my_model_s_heated_seat_left", "option": "Auto"},
blocking=True,
)
mock_remote_auto_seat_climate_request.assert_awaited_once_with(0, True)
mock_remote_auto_seat_climate_request.assert_awaited_once_with(1, True)
# Test from "Auto" selection
car_mock_data.VEHICLE_DATA["climate_state"]["auto_seat_climate_left"] = True
assert await hass.services.async_call(
Expand All @@ -93,7 +93,7 @@ async def test_car_heated_seat_select(hass: HomeAssistant) -> None:
{ATTR_ENTITY_ID: "select.my_model_s_heated_seat_left", "option": "Low"},
blocking=True,
)
mock_remote_auto_seat_climate_request.assert_awaited_with(0, False)
mock_remote_auto_seat_climate_request.assert_awaited_with(1, False)

with patch("teslajsonpy.car.TeslaCar.set_hvac_mode") as mock_set_hvac_mode:
# Test climate_on check
Expand Down

0 comments on commit 4109059

Please sign in to comment.