Esempio n. 1
0
    def _set_system_state(s):
        LOG.info('Setting system mode: %s', state.print_state(s))
        if s == state.HEAT:
            _heat_on()
        elif s == state.COOL:
            _cool_on()
        elif s == state.FAN_ONLY:
            _fan_only()
        elif s == state.OFF:
            _off()

        # Verify that the system state was set currently
        threading._sleep(1)
        cs, _ = get_system_state()
        if s != cs:
            LOG.error('The system state was not set correctly!  Expected state: %s, Actual state: %s',
                      state.print_state(s), state.print_state(cs))
Esempio n. 2
0
    def _set_system_state(s):
        LOG.info('Setting system mode: %s', state.print_state(s))
        if s == state.HEAT:
            _heat_on()
        elif s == state.COOL:
            _cool_on()
        elif s == state.FAN_ONLY:
            _fan_only()
        elif s == state.OFF:
            _off()

        # Verify that the system state was set currently
        threading._sleep(1)
        cs, _ = get_system_state()
        if s != cs:
            LOG.error(
                'The system state was not set correctly!  Expected state: %s, Actual state: %s',
                state.print_state(s), state.print_state(cs))
Esempio n. 3
0
def set_system_state(to_state, current_state):
    if to_state == state.UNKNOWN:
        LOG.error(
            'Trying to set system status UNKNOWN.... Uncool... bailing.  Current state: %s',
            state.print_state(current_state))
        return

    def _set_system_state(s):
        LOG.info('Setting system mode: %s', state.print_state(s))
        if s == state.HEAT:
            _heat_on()
        elif s == state.COOL:
            _cool_on()
        elif s == state.FAN_ONLY:
            _fan_only()
        elif s == state.OFF:
            _off()

        # Verify that the system state was set currently
        threading._sleep(1)
        cs, _ = get_system_state()
        if s != cs:
            LOG.error(
                'The system state was not set correctly!  Expected state: %s, Actual state: %s',
                state.print_state(s), state.print_state(cs))

    def _heat_on():
        GPIO.output(CONF.io.green_pin_out, True)
        GPIO.output(CONF.io.white_pin_out, True)
        GPIO.output(CONF.io.yellow_pin_out, False)

    def _cool_on():
        GPIO.output(CONF.io.green_pin_out, True)
        GPIO.output(CONF.io.white_pin_out, True)
        GPIO.output(CONF.io.yellow_pin_out, True)

    def _fan_only():
        GPIO.output(CONF.io.green_pin_out, True)
        GPIO.output(CONF.io.white_pin_out, False)
        GPIO.output(CONF.io.yellow_pin_out, False)

    def _off():
        GPIO.output(CONF.io.green_pin_out, False)
        GPIO.output(CONF.io.white_pin_out, False)
        GPIO.output(CONF.io.yellow_pin_out, False)

    if current_state in [state.OFF, state.FAN_ONLY]:
        _set_system_state(to_state)
    else:
        # First set the system to fan only to let the system cool down for 2 minutes, then set the system state
        _set_system_state(state.FAN_ONLY)
        threading._sleep(CONF.hvac.on_mode_change_fan_interval)
        _set_system_state(to_state)
Esempio n. 4
0
def set_system_state(to_state, current_state):
    if to_state == state.UNKNOWN:
        LOG.error('Trying to set system status UNKNOWN.... Uncool... bailing.  Current state: %s',
                  state.print_state(current_state))
        return

    def _set_system_state(s):
        LOG.info('Setting system mode: %s', state.print_state(s))
        if s == state.HEAT:
            _heat_on()
        elif s == state.COOL:
            _cool_on()
        elif s == state.FAN_ONLY:
            _fan_only()
        elif s == state.OFF:
            _off()

        # Verify that the system state was set currently
        threading._sleep(1)
        cs, _ = get_system_state()
        if s != cs:
            LOG.error('The system state was not set correctly!  Expected state: %s, Actual state: %s',
                      state.print_state(s), state.print_state(cs))

    def _heat_on():
        GPIO.output(CONF.io.green_pin_out, True)
        GPIO.output(CONF.io.white_pin_out, True)
        GPIO.output(CONF.io.yellow_pin_out, False)

    def _cool_on():
        GPIO.output(CONF.io.green_pin_out, True)
        GPIO.output(CONF.io.white_pin_out, True)
        GPIO.output(CONF.io.yellow_pin_out, True)

    def _fan_only():
        GPIO.output(CONF.io.green_pin_out, True)
        GPIO.output(CONF.io.white_pin_out, False)
        GPIO.output(CONF.io.yellow_pin_out, False)

    def _off():
        GPIO.output(CONF.io.green_pin_out, False)
        GPIO.output(CONF.io.white_pin_out, False)
        GPIO.output(CONF.io.yellow_pin_out, False)

    if current_state in [state.OFF, state.FAN_ONLY]:
        _set_system_state(to_state)
    else:
        # First set the system to fan only to let the system cool down for 2 minutes, then set the system state
        _set_system_state(state.FAN_ONLY)
        threading._sleep(CONF.hvac.on_mode_change_fan_interval)
        _set_system_state(to_state)