Skip to content

Commit

Permalink
Merge pull request #386 from alandtse/dev
Browse files Browse the repository at this point in the history
feat: add remote start button (#385)
  • Loading branch information
alandtse authored Dec 1, 2022
2 parents 740f201 + 42b7117 commit 7217e5a
Show file tree
Hide file tree
Showing 5 changed files with 1,153 additions and 169 deletions.
20 changes: 20 additions & 0 deletions custom_components/tesla_custom/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry, async_add_entitie
entities.append(TeslaCarWakeUp(hass, car, coordinator))
entities.append(TeslaCarForceDataUpdate(hass, car, coordinator))
entities.append(TeslaCarTriggerHomelink(hass, car, coordinator))
entities.append(TeslaCarRemoteStart(hass, car, coordinator))

async_add_entities(entities, True)

Expand Down Expand Up @@ -142,3 +143,22 @@ def available(self) -> bool:
async def async_press(self):
"""Send the command."""
await self._car.trigger_homelink()


class TeslaCarRemoteStart(TeslaCarEntity, ButtonEntity):
"""Representation of a Tesla car remote start button."""

def __init__(
self,
hass: HomeAssistant,
car: TeslaCar,
coordinator: TeslaDataUpdateCoordinator,
) -> None:
"""Initialise remote start button."""
super().__init__(hass, car, coordinator)
self.type = "remote start"
self._attr_icon = "mdi:power"

async def async_press(self):
"""Send the command."""
await self._car.remote_start()
2 changes: 1 addition & 1 deletion custom_components/tesla_custom/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"documentation": "https://github.com/alandtse/tesla/wiki",
"issue_tracker": "https://github.com/alandtse/tesla/issues",
"requirements": [
"teslajsonpy==3.2.2"
"teslajsonpy==3.3.0"
],
"codeowners": [
"@alandtse"
Expand Down
Loading

0 comments on commit 7217e5a

Please sign in to comment.