示例#1
0
    def get_toon_details():
        status = ToonManager().get_status()
        states = ToonManager().get_states()

        result = ThermostatDetails(
            status.active_state, status.current_displayed_temperature,
            status.current_modulation_level, status.current_set_point,
            status.next_program, status.next_set_point, status.next_state,
            status.next_time, status.program_state, status.real_set_point, [
                ThermostatState(x.name, x.id, x.temperature, x.dhw)
                for x in states if x.id != 4
            ])

        return to_JSON(result)
示例#2
0
    def get_electricity_details():
        start_hours = request.args.get('startHours')
        end_hours = request.args.get('endHours')

        stats = ToonManager().get_electricity_stats(start_hours + " hours ago",
                                                    end_hours + " hours ago")
        return to_JSON(stats)
示例#3
0
    def get_toon_status():
        status = ToonManager().get_status()
        result = ThermostatInfo(status.active_state,
                                status.current_displayed_temperature,
                                status.current_set_point)

        return to_JSON(result)
示例#4
0
    def set_temperature():
        temp = int(request.args.get('temperature'))

        temp /= 100
        Logger().write(LogVerbosity.Info,
                       "Setting toon temperature to " + str(temp))
        ToonManager().set_temperature(temp, "user")
        return "OK"
示例#5
0
 def get_gas_details():
     start_hours = request.args.get('startHours')
     end_hours = int(request.args.get('endHours'))
     if end_hours == 0:
         end_hours = 0.001
     stats = ToonManager().get_gas_stats(start_hours + " hours ago",
                                         str(end_hours) + " hours ago",
                                         "hours")
     return to_JSON(stats)
示例#6
0
    def set_active_state():
        state = request.args.get('state')

        Logger().write(LogVerbosity.Info, "Setting toon state to " + state)
        ToonManager().set_state(state)
        return "OK"
示例#7
0
 def execute(self):
     ToonManager().set_temperature(self.temp, "rule")