Skip to content

Commit

Permalink
change from bool to "on/off"
Browse files Browse the repository at this point in the history
  • Loading branch information
jcgoette committed Jul 27, 2021
1 parent 1655ae0 commit 03abeda
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions custom_components/hi_mama/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@ def name(self) -> str:
@property
def state(self) -> datetime:
"""Return the state of the HiMama sensor."""
return (
self._data[1]
if "At Daycare" in self._data[0]
else self._data[1].get("Date")
)
if "At Daycare" in self._data[0]:
return "on" if self._data[1] else "off"
else:
return self._data[1].get("Date")

@property
def extra_state_attributes(self) -> str:
Expand Down Expand Up @@ -127,6 +126,7 @@ def HiMamaQuery(self) -> dict:
"""Query HiMama for data."""
pymama_data = pymama_query(self._email, self._password, self._child_id)
pymama_latest = pymama_data.get("Latest")
# TODO: move to binary_sensor
pymama_latest["At Daycare"] = pymama_data.get("At Daycare")
return pymama_latest

Expand Down

0 comments on commit 03abeda

Please sign in to comment.