forked from abacao/hass_wibeee
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add configuration option to change the upstream URL (#62)
allows selecting between different Cloud services (or local-only mode) for uploading Wibeee push data. * disable persistent HTTP connections to Wibeee Cloud to avoid `aiohttp.client_exceptions.ServerDisconnectedError` * fix: hack to work around invalid JSON posted by Wibeee devices --------- Co-authored-by: Luis Miranda <[email protected]>
- Loading branch information
Showing
6 changed files
with
176 additions
and
52 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
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 |
---|---|---|
@@ -1,8 +1,26 @@ | ||
from datetime import timedelta | ||
|
||
from homeassistant.helpers.selector import SelectOptionDict | ||
|
||
DOMAIN = 'wibeee' | ||
NEST_DEFAULT_UPSTREAM = 'http://nest-ingest.wibeee.com' | ||
|
||
DEFAULT_SCAN_INTERVAL = timedelta(seconds=15) | ||
DEFAULT_TIMEOUT = timedelta(seconds=10) | ||
|
||
CONF_NEST_PROXY_ENABLE = 'nest_proxy_enable' | ||
CONF_NEST_UPSTREAM = 'nest_upstream' | ||
|
||
|
||
def _format_options(upstreams: dict[str, str]) -> list[SelectOptionDict]: | ||
return [SelectOptionDict(label=f'{cloud} ({url})', value=url) for cloud, url in upstreams.items()] | ||
|
||
|
||
NEST_PROXY_DISABLED: str = 'proxy_disabled' | ||
NEST_NULL_UPSTREAM: str = 'proxy_null' | ||
NEST_ALL_UPSTREAMS: list[SelectOptionDict] = [SelectOptionDict(label='Disabled (polling only)', value=NEST_PROXY_DISABLED), | ||
SelectOptionDict(label='Local only (no Cloud)', value=NEST_NULL_UPSTREAM)] + \ | ||
_format_options({ | ||
'Wibeee Nest': NEST_DEFAULT_UPSTREAM, | ||
'Iberdrola': 'http://datosmonitorconsumo.iberdrola.es:8080', | ||
'SolarProfit': 'http://wdata.solarprofit.es:8080', | ||
}) |
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
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