Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tibber/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
DEMO_TOKEN: Final = "3A77EECF61BD445F47241A5A36202185C35AF3AF58609E19B53F3A8872AD7BE1-1"

RESOLUTION_HOURLY: Final = "HOURLY"
RESOLUTION_QUARTER_HOURLY: Final = "QUARTER_HOURLY"
RESOLUTION_DAILY: Final = "DAILY"
RESOLUTION_WEEKLY: Final = "WEEKLY"
RESOLUTION_MONTHLY: Final = "MONTHLY"
Expand Down
2 changes: 1 addition & 1 deletion tibber/gql_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
viewer {
home(id: "%s") {
currentSubscription {
priceInfo(resolution: QUARTER_HOURLY) {
priceInfo(resolution: %s) {
current {
currency
energy
Expand Down
10 changes: 6 additions & 4 deletions tibber/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from gql import gql

from .const import RESOLUTION_DAILY, RESOLUTION_HOURLY, RESOLUTION_MONTHLY, RESOLUTION_WEEKLY
from .const import RESOLUTION_DAILY, RESOLUTION_HOURLY, RESOLUTION_MONTHLY, RESOLUTION_WEEKLY, RESOLUTION_QUARTER_HOURLY
from .gql_queries import (
HISTORIC_DATA,
HISTORIC_DATA_DATE,
Expand Down Expand Up @@ -197,9 +197,11 @@ async def update_info(self) -> None:
"""Update home info and the current price info asynchronously."""
await self.update_info_and_price_info()

async def update_info_and_price_info(self) -> None:
"""Update home info and all price info asynchronously."""
if not (data := await self._tibber_control.execute(UPDATE_INFO_PRICE % self._home_id)):
async def update_info_and_price_info(self, resolution: str = RESOLUTION_QUARTER_HOURLY) -> None:
"""Update home info and all price info asynchronously.
:param resolution: The resolution of the data. Can be RESOLUTION_QUARTER_HOURLY or RESOLUTION_HOURLY
"""
if not (data := await self._tibber_control.execute(UPDATE_INFO_PRICE % (self._home_id, resolution))):
_LOGGER.error("Could not get the data.")
return
self.info = data
Expand Down