'Get the latest data and update the states.'

@asyncio.coroutine
def async_update(self):

    if ((self.from_state is None) or (self.to_state is None)):
        return
    if ((self.from_state.state == STATE_UNKNOWN) or (self.to_state.state == STATE_UNKNOWN)):
        return
    try:
        if self._attribute:
            from_value = float(self.from_state.attributes.get(self._attribute))
            to_value = float(self.to_state.attributes.get(self._attribute))
        else:
            from_value = float(self.from_state.state)
            to_value = float(self.to_state.state)
        self._state = (to_value > from_value)
        if self._invert:
            self._state = (not self._state)
    except (ValueError, TypeError) as ex:
        self._state = None
        _LOGGER.error(ex)
