Skip to content

Commit

Permalink
add time_of_use_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 committed Jun 7, 2024
1 parent 4a9e1cf commit d0fc434
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="tesla_fleet_api",
version="0.6.0",
version="0.6.1",
author="Brett Adams",
author_email="[email protected]",
description="Tesla Fleet API library for Python",
Expand Down
2 changes: 1 addition & 1 deletion tesla_fleet_api/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from enum import Enum
import logging

VERSION = "0.5.16"
VERSION = "0.6.1"
LOGGER = logging.getLogger(__package__)
SERVERS = {
"na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
Expand Down
10 changes: 10 additions & 0 deletions tesla_fleet_api/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,13 @@ async def storm_mode(self, energy_site_id: int, enabled: bool) -> dict[str, Any]
f"api/1/energy_sites/{energy_site_id}/storm_mode",
json={"enabled": enabled},
)

async def time_of_use_settings(
self, energy_site_id: int, settings: dict[str, Any]
) -> dict[str, Any]:
"""Update the time of use settings for the energy site."""
return await self._request(
Method.POST,
f"api/1/energy_sites/{energy_site_id}/time_of_use_settings",
json={"tou_settings": {"tariff_content_v2": settings}},
)
7 changes: 7 additions & 0 deletions tesla_fleet_api/energyspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,10 @@ async def storm_mode(self, enabled: bool) -> dict[str, Any]:
self.energy_site_id,
enabled,
)

async def time_of_use_settings(self, settings: dict[str, Any]) -> dict[str, Any]:
"""Update the site's time of use settings."""
return await self._parent.time_of_use_settings(
self.energy_site_id,
settings,
)

0 comments on commit d0fc434

Please sign in to comment.