Skip to content

Commit

Permalink
style: auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 9, 2024
1 parent 2e34f3b commit a6ff3b5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Pull actions

on:
pull_request:

jobs:
validate:
runs-on: "ubuntu-latest"
Expand Down
34 changes: 28 additions & 6 deletions custom_components/tesla_custom/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ async def async_setup_entry(hass: HomeAssistant, config_entry, async_add_entitie
entities.append(TeslaCarHeatedSteeringWheel(car, coordinator))
for seat_name in SEAT_ID_MAP:
# car.rear_seat_heaters does not return value when car is asleep. Won't initialize seat if integration loaded when car is asleep
if "rear" in seat_name and car.get_seat_heater_status(SEAT_ID_MAP[seat_name]) is not None:
if (
"rear" in seat_name
and car.get_seat_heater_status(SEAT_ID_MAP[seat_name]) is not None
):
continue
# Check for str "None" (car does not have third row seats)
# or None (car is asleep)
Expand Down Expand Up @@ -227,7 +230,11 @@ def current_option(self):
self._car, "is_auto_seat_climate_" + self._seat_name
):
current_value = 4
_LOGGER.debug("Current setting for %s is %s", self.name, FRONT_HEATER_OPTIONS[current_value])
_LOGGER.debug(
"Current setting for %s is %s",
self.name,
FRONT_HEATER_OPTIONS[current_value],
)
return FRONT_HEATER_OPTIONS[current_value]
# If heated seats only
elif not self._car.has_seat_cooling:
Expand All @@ -237,11 +244,19 @@ def current_option(self):
# If heater is off
if current_value is None:
current_value = 0
_LOGGER.debug("Current setting for %s is %s", self.name, HEATER_OPTIONS[current_value])
_LOGGER.debug(
"Current setting for %s is %s",
self.name,
HEATER_OPTIONS[current_value],
)
return HEATER_OPTIONS[current_value]
# If heater is on
else:
_LOGGER.debug("Current setting for %s is %s", self.name, HEATER_OPTIONS[current_value])
_LOGGER.debug(
"Current setting for %s is %s",
self.name,
HEATER_OPTIONS[current_value],
)
return HEATER_OPTIONS[current_value]
# If cooling/heating front seats
else:
Expand All @@ -257,8 +272,14 @@ def current_option(self):
current_value = 0
else:
# Low is 2 but is item 5 on select list
current_value = current_value - (FRONT_COOL_HEAT_OPTIONS.index("Cool Low") - 2)
_LOGGER.debug("Current setting for Cooling/%s is %s", self.name, FRONT_COOL_HEAT_OPTIONS[current_value])
current_value = current_value - (
FRONT_COOL_HEAT_OPTIONS.index("Cool Low") - 2
)
_LOGGER.debug(
"Current setting for Cooling/%s is %s",
self.name,
FRONT_COOL_HEAT_OPTIONS[current_value],
)
return FRONT_COOL_HEAT_OPTIONS[current_value]

@property
Expand All @@ -271,6 +292,7 @@ def options(self):
else:
return HEATER_OPTIONS


class TeslaCarHeatedSteeringWheel(TeslaCarEntity, SelectEntity):
"""Representation of a Tesla car heated steering wheel select."""

Expand Down

0 comments on commit a6ff3b5

Please sign in to comment.