forked from floringhimie/salusfy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f38066f
commit 6ccd7df
Showing
4 changed files
with
30 additions
and
22 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
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,35 +1,39 @@ | ||
class ConfigAdapter: | ||
"""Simulates how Home Assistant loads configuration""" | ||
|
||
def __init__(self, config): | ||
self._config = config | ||
|
||
def get(self, key: str) -> any: | ||
if (key == 'name'): | ||
"""Returns the config value based on the Home Assistant key""" | ||
|
||
if key == 'name': | ||
return 'Simulator' | ||
|
||
if (key == 'id'): | ||
if key == 'id': | ||
return self._config.DEVICE_ID | ||
|
||
if (key == 'username'): | ||
if key == 'username': | ||
return self._config.USERNAME | ||
|
||
if (key == 'password'): | ||
if key == 'password': | ||
return self._config.PASSWORD | ||
|
||
if (key == 'simulator'): | ||
if key == 'simulator': | ||
if hasattr(self._config, 'SIMULATOR'): | ||
return self._config.SIMULATOR | ||
return False | ||
|
||
if (key == 'enable_temperature_client'): | ||
if key == 'enable_temperature_client': | ||
if hasattr(self._config, 'ENABLE_TEMPERATURE_CLIENT'): | ||
return self._config.ENABLE_TEMPERATURE_CLIENT | ||
return False | ||
|
||
if (key == 'host'): | ||
if key == 'host': | ||
return self._config.HOST | ||
|
||
if (key == 'entity_id'): | ||
if key == 'entity_id': | ||
return self._config.ENTITY_ID | ||
|
||
if (key == 'access_token'): | ||
if key == 'access_token': | ||
return self._config.ACCESS_TOKEN |