'Return the state of the device.'

@property
def state(self):

    if ((self._state in (STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY)) and self._pending_time and ((self._state_ts + self._pending_time) > dt_util.utcnow())):
        return STATE_ALARM_PENDING
    if ((self._state == STATE_ALARM_TRIGGERED) and self._trigger_time):
        if ((self._state_ts + self._pending_time) > dt_util.utcnow()):
            return STATE_ALARM_PENDING
        elif (((self._state_ts + self._pending_time) + self._trigger_time) < dt_util.utcnow()):
            if self._disarm_after_trigger:
                return STATE_ALARM_DISARMED
            return self._pre_trigger_state
    return self._state
