Skip to content

Commit

Permalink
Merge pull request #28 from mmillmor/mmillmor-patch-3
Browse files Browse the repository at this point in the history
Fixed issue with updating username
  • Loading branch information
mmillmor authored Jul 25, 2023
2 parents 3b06daa + 7194afc commit 1511b16
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
9 changes: 5 additions & 4 deletions custom_components/geo_home/geohome.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
class GeoHomeHub:
"""GeoHome Hub controller."""

def __init__(self, username: str, password: str, hass: HomeAssistant) -> None:
def __init__(self, config_entry: ConfigEntry, hass: HomeAssistant) -> None:
"""Initialize the hub controller."""
self.username = username
self.password = password
self.config_entry = config_entry
self.hass = hass
self.accessToken = None
self.electricityCreditRemaining = None
Expand Down Expand Up @@ -76,10 +75,12 @@ def __init__(self, username: str, password: str, hass: HomeAssistant) -> None:

def async_auth(self) -> bool:
"""Validate the username and password."""
username = self.config_entry.data.get("username")
password = self.config_entry.data.get("password")

response = requests.post(
BASE_URL + LOGIN_URL,
json={"identity": self.username, "password": self.password},
json={"identity": username, "password": password},
)
if response.status_code == 200:
response_json = response.json()
Expand Down
2 changes: 1 addition & 1 deletion custom_components/geo_home/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"issue_tracker": "https://github.com/mmillmor/geo_home_hacs/issues",
"requirements": [],
"ssdp": [],
"version":"1.8.0",
"version":"1.9.0",
"zeroconf": []
}
4 changes: 1 addition & 3 deletions custom_components/geo_home/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@

async def async_setup_entry(hass, config_entry, async_add_entities):

username = config_entry.data.get("username")
password = config_entry.data.get("password")
hub = GeoHomeHub(username, password, hass)
hub = GeoHomeHub(config_entry, hass)

coordinator = MyCoordinator(hass, hub)

Expand Down

0 comments on commit 1511b16

Please sign in to comment.