d4bd5a180ce9c7dc39b0a00000307148ca6b6303,homeassistant/components/opengarage/cover.py,OpenGarageCover,update,#OpenGarageCover#,140

Before Change


    def update(self):
        Get updated status from API.
        try:
            status = self._get_status()
            if self._name is None:
                if status["name"] is not None:
                    self._name = status["name"]
            state = STATES_MAP.get(status.get("door"), STATE_UNKNOWN)
            if self._state_before_move is not None:
                if self._state_before_move != state:
                    self._state = state

After Change


    def update(self):
        Get updated status from API.
        try:
            status = requests.get(
                "{}/jc".format(self.opengarage_url), timeout=10
            ).json()
        except requests.exceptions.RequestException as ex:
            _LOGGER.error(
                "Unable to connect to OpenGarage device: %(reason)s", dict(reason=ex)
            )
            self._available = False
            return

        if self._name is None and status["name"] is not None:
            self._name = status["name"]
        state = STATES_MAP.get(status.get("door"))
        if self._state_before_move is not None:
            if self._state_before_move != state:
                self._state = state
                self._state_before_move = None
        else:
            self._state = state

        _LOGGER.debug("%s status: %s", self._name, self._state)
        if status.get("rssi") is not None:
            self._device_state_attributes[ATTR_SIGNAL_STRENGTH] = status.get("rssi")
        if status.get("dist") is not None:
            self._device_state_attributes[ATTR_DISTANCE_SENSOR] = status.get("dist")
        if self._state is not None:
            self._device_state_attributes[ATTR_DOOR_STATE] = self._state
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: home-assistant/home-assistant
Commit Name: d4bd5a180ce9c7dc39b0a00000307148ca6b6303
Time: 2019-08-25
Author: mail@dahoiv.net
File Name: homeassistant/components/opengarage/cover.py
Class Name: OpenGarageCover
Method Name: update


Project Name: home-assistant/home-assistant
Commit Name: d4bd5a180ce9c7dc39b0a00000307148ca6b6303
Time: 2019-08-25
Author: mail@dahoiv.net
File Name: homeassistant/components/opengarage/cover.py
Class Name: OpenGarageCover
Method Name: _push_button


Project Name: home-assistant/home-assistant
Commit Name: 3b3f5fe6fe2092a5071491fafce11b3851d07ce8
Time: 2015-11-08
Author: paulus@paulusschoutsen.nl
File Name: homeassistant/components/notify/instapush.py
Class Name:
Method Name: get_service