Skip to content

Commit

Permalink
fix device override
Browse files Browse the repository at this point in the history
  • Loading branch information
pantherale0 committed Oct 6, 2024
1 parent 5c19cc3 commit c3c67c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions pyfamilysafety/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
"""Family safety account handler."""

import logging
from datetime import datetime, date, time, timedelta
from datetime import datetime, date, time
from urllib.parse import quote_plus

from .api import FamilySafetyAPI
from .device import Device
from .application import Application
from .enum import OverrideTarget, OverrideType
from .helpers import localise_datetime, API_TIMEZONE
from .requests import PendingRequest

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -152,8 +151,8 @@ async def override_device(self,
response = await self._api.send_request(
endpoint="override_device_restriction",
body={
"overrideType": str(override).upper(),
"target": str(target).upper(),
"overrideType": str(override),
"target": str(target),
"validUntil": valid_until.strftime("%Y-%m-%dT%H:%M:%SZ")
},
USER_ID=self.user_id
Expand Down
2 changes: 1 addition & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def main():
_LOGGER.debug("Discovered account %s, label %s", account.user_id, account.first_name)
_LOGGER.debug(account)
_LOGGER.debug("Usage today %s", account.today_screentime_usage)
await account.override_device("AllDevices", OverrideType.UNTIL, valid_until=datetime.now()+timedelta(days=5))
await account.override_device("Xbox", OverrideType.CANCEL)

_LOGGER.debug("ping")
await asyncio.sleep(15)
Expand Down

0 comments on commit c3c67c3

Please # to comment.