예제 #1
0
    def do(session):
        system_settings = system.get_current_system_settings(session)

        mode = system_settings.system_mode

        if mode.name == AutoMode.name():
            return AutoMode(mode.id, system_settings.current_program)

        if mode.name == ManualMode.name():
            return ManualMode(mode.id)

        if mode.name != OffMode.name():
            LOG.error('System set to unknown mode \'%s\'.  Defaulting to Off', mode.name)

        return OffMode(mode.id)
예제 #2
0
        def do(session):
            system_settings = system.get_current_system_settings(session)
            program = system_settings.current_program
            program_data = None

            if program:
                program_data = dict(name=program.name)
                schedule, next_schedule = utils.get_active_and_next_schedule(program)

                schedule_data = self._build_schedule_dict(schedule)
                next_schedule_data = self._build_schedule_dict(next_schedule)

                program_data['active_schedule'] = schedule_data
                program_data['next_schedule'] = next_schedule_data

            return dict(name=self.name(), program=program_data)
예제 #3
0
        def do(session):
            system_settings = system.get_current_system_settings(session)
            program = system_settings.current_program
            program_data = None

            if program:
                program_data = dict(name=program.name)
                schedule, next_schedule = utils.get_active_and_next_schedule(
                    program)

                schedule_data = self._build_schedule_dict(schedule)
                next_schedule_data = self._build_schedule_dict(next_schedule)

                program_data['active_schedule'] = schedule_data
                program_data['next_schedule'] = next_schedule_data

            return dict(name=self.name(), program=program_data)
예제 #4
0
        def do(session):
            system_settings = system.get_current_system_settings(session)
            program = system_settings.current_program

            self._set_program_name(program)

            if not program:
                LOG.warn('No program set for system.')
                return states.OFF
            elif not program.schedules:
                LOG.warn('No schedules found for program \'%s\'.  Setting system to Off', program.name)
                return states.OFF

            schedule = utils.get_active_schedule(program)
            if not schedule:
                LOG.error('Could not determine the ')
            return self._get_state(current_temp, schedule.cool_temp, schedule.heat_temp)
예제 #5
0
        def do(session):
            system_settings = system.get_current_system_settings(session)
            program = system_settings.current_program

            self._set_program_name(program)

            if not program:
                LOG.warn('No program set for system.')
                return states.OFF
            elif not program.schedules:
                LOG.warn(
                    'No schedules found for program \'%s\'.  Setting system to Off',
                    program.name)
                return states.OFF

            schedule = utils.get_active_schedule(program)
            if not schedule:
                LOG.error('Could not determine the ')
            return self._get_state(current_temp, schedule.cool_temp,
                                   schedule.heat_temp)
예제 #6
0
 def do(session):
     system_settings = system.get_current_system_settings(session)
     return dict(name=self.name(),
                 cool_temp=system_settings.cool_temp,
                 heat_temp=system_settings.heat_temp)
예제 #7
0
 def do(session):
     system_settings = system.get_current_system_settings(session)
     return self._get_state(current_temp, system_settings.cool_temp,
                            system_settings.heat_temp)
예제 #8
0
 def do(session):
     system_settings = system.get_current_system_settings(session)
     return dict(name=self.name(), cool_temp=system_settings.cool_temp,
                 heat_temp=system_settings.heat_temp)
예제 #9
0
 def do(session):
     system_settings = system.get_current_system_settings(session)
     return self._get_state(current_temp, system_settings.cool_temp, system_settings.heat_temp)