Ejemplo n.º 1
0
 def is_on(self) -> bool:
     """Return true if entity is at home."""
     try:
         return bool(
             SureLocationID(self._state["where"]) == SureLocationID.INSIDE)
     except (KeyError, TypeError):
         return False
Ejemplo n.º 2
0
    def device_state_attributes(self) -> Optional[Dict[str, Any]]:
        """Return the state attributes of the device."""
        attributes = None
        if self._state:
            attributes = {
                "since": str(
                    datetime.fromisoformat(self._state["since"]).replace(tzinfo=None)
                ),
                "where": SureLocationID(self._state["where"]).name.capitalize(),
            }

        return attributes