-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for Burbank Water and Power (#110)
* add support for Burbank Water and Power * Updated with pre-commit * response is always an empty body, handle exceptions properly * Rename bwp.py to burbankwaterandpower.py and remove commented code
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""Burbank Water and Power (BWP).""" | ||
|
||
from typing import Optional | ||
|
||
import aiohttp | ||
|
||
from ..const import USER_AGENT | ||
from .base import UtilityBase | ||
|
||
|
||
class BurbankWaterAndPower(UtilityBase): | ||
"""Burbank Water and Power (BWP).""" | ||
|
||
@staticmethod | ||
def name() -> str: | ||
"""Distinct recognizable name of the utility.""" | ||
return "Burbank Water and Power (BWP)" | ||
|
||
@staticmethod | ||
def subdomain() -> str: | ||
"""Return the opower.com subdomain for this utility.""" | ||
return "bwp" | ||
|
||
@staticmethod | ||
def timezone() -> str: | ||
"""Return the timezone.""" | ||
return "America/Los_Angeles" | ||
|
||
@staticmethod | ||
async def async_login( | ||
session: aiohttp.ClientSession, | ||
username: str, | ||
password: str, | ||
optional_mfa_secret: Optional[str], | ||
) -> None: | ||
"""Login to the utility website.""" | ||
async with session.post( | ||
"https://bwp.opower.com/ei/edge/apis/user-account-control-v1/cws/v1/bwp/account/signin", | ||
json={ | ||
"username": username, | ||
"password": password, | ||
}, | ||
headers={"User-Agent": USER_AGENT}, | ||
raise_for_status=False, | ||
) as _: | ||
pass |