Exemple #1
0
    def test_get_active_mode_zone_quick_mode_ventilation(self) -> None:
        """Test get active mode for zone quick mode ventilation."""
        zone = _zone()
        system = System(zones=[zone], quick_mode=QuickModes.VENTILATION_BOOST)

        active_mode = system.get_active_mode_zone(zone)

        self.assertEqual(QuickModes.VENTILATION_BOOST, active_mode.current)
        self.assertEqual(Zone.MIN_TARGET_HEATING_TEMP, active_mode.target)
Exemple #2
0
    def test_get_active_mode_zone_quick_mode_one_day_away(self) -> None:
        """Test get active mode for zone one day away."""
        zone = _zone()
        system = System(zones=[zone], quick_mode=QuickModes.ONE_DAY_AWAY)

        active_mode = system.get_active_mode_zone(zone)

        self.assertEqual(QuickModes.ONE_DAY_AWAY, active_mode.current)
        self.assertEqual(Zone.MIN_TARGET_HEATING_TEMP, active_mode.target)
Exemple #3
0
    def test_set_room_new_room(self) -> None:
        """Test manipulating rooms in system."""
        room1 = Room(id='10')
        room2 = Room(id='11')
        room3 = Room(id='12')
        system = System(rooms=[room1, room2])

        system.set_room(room3.id, room3)
        self.assertEqual(3, len(system.rooms))
Exemple #4
0
    def test_get_active_mode_zone_quick_mode_system_off(self) -> None:
        """Test get active mode for zone with system off."""
        zone = _zone()
        system = System(zones=[zone], quick_mode=QuickModes.SYSTEM_OFF)

        active_mode = system.get_active_mode_zone(zone)

        self.assertEqual(QuickModes.SYSTEM_OFF, active_mode.current)
        self.assertEqual(Zone.MIN_TARGET_HEATING_TEMP, active_mode.target)
Exemple #5
0
    def test_get_active_mode_hot_water_one_day_away(self) -> None:
        """Test get active mode for hot water with one day away."""
        dhw = Dhw(hotwater=_hotwater())
        system = System(dhw=dhw, quick_mode=QuickModes.ONE_DAY_AWAY)

        active_mode = system.get_active_mode_hot_water()

        self.assertEqual(QuickModes.ONE_DAY_AWAY, active_mode.current)
        self.assertEqual(constants.FROST_PROTECTION_TEMP, active_mode.target)
Exemple #6
0
    def test_get_active_mode_hot_water_system_off(self) -> None:
        """Test active mode hot water system off."""
        dhw = Dhw(hotwater=_hotwater())
        system = System(dhw=dhw, quick_mode=QuickModes.SYSTEM_OFF)

        active_mode = system.get_active_mode_hot_water()

        self.assertEqual(QuickModes.SYSTEM_OFF, active_mode.current)
        self.assertEqual(constants.FROST_PROTECTION_TEMP, active_mode.target)
Exemple #7
0
    def test_get_active_mode_room_system_off(self) -> None:
        """Test active mode room when system off."""
        room = _room()
        system = System(rooms=[room], quick_mode=QuickModes.SYSTEM_OFF)

        active_mode = system.get_active_mode_room(room)

        self.assertEqual(QuickModes.SYSTEM_OFF, active_mode.current)
        self.assertEqual(Room.MIN_TARGET_TEMP, active_mode.target)
Exemple #8
0
    def test_get_active_mode_zone_quick_mode_party(self) -> None:
        """Test get active mode for zone quick mode party."""
        zone = _zone()
        system = System(zones=[zone], quick_mode=QuickModes.PARTY)

        active_mode = system.get_active_mode_zone(zone)

        self.assertEqual(QuickModes.PARTY, active_mode.current)
        self.assertEqual(zone.heating.target_high, active_mode.target)
Exemple #9
0
    def test_get_active_mode_zone_quick_mode_water_boost(self) -> None:
        """Test get active mode for zone with hot water boost."""
        zone = _zone()
        system = System(zones=[zone], quick_mode=QuickModes.HOTWATER_BOOST)

        active_mode = system.get_active_mode_zone(zone)

        self.assertEqual(OperatingModes.AUTO, active_mode.current)
        self.assertEqual(SettingModes.DAY, active_mode.sub)
        self.assertEqual(zone.heating.target_high, active_mode.target)
Exemple #10
0
    def test_set_room_existing_room(self) -> None:
        """Test manipulating rooms in system."""
        room1 = Room(id='10')
        room2 = Room(id='11')
        room3 = Room(id='11')
        system = System(rooms=[room1, room2])

        system.set_room(room3.id, room3)
        self.assertEqual(2, len(system.rooms))
        self.assertEqual(room3, system._rooms[room2.id])
Exemple #11
0
    def test_get_active_mode_zone_cooling_for_x_days(self) -> None:
        """Test quick mode COOLING_FOR_X_DAYS."""
        zone = _zone_cooling()
        system = System(zones=[zone], quick_mode=QuickModes.COOLING_FOR_X_DAYS)

        active_mode = system.get_active_mode_zone(zone)

        self.assertEqual(QuickModes.COOLING_FOR_X_DAYS, active_mode.current)
        self.assertIsNone(active_mode.sub)
        self.assertEqual(zone.cooling.target_high, active_mode.target)
Exemple #12
0
    def test_get_active_mode_circulation_auto(self) -> None:
        """Test get active mode for circulation."""
        dhw = Dhw(circulation=_circulation())
        system = System(dhw=dhw)

        active_mode = system.get_active_mode_circulation()

        self.assertEqual(OperatingModes.AUTO, active_mode.current)
        self.assertIsNone(active_mode.target)
        self.assertEqual(SettingModes.ON, active_mode.sub)
Exemple #13
0
    def test_get_active_mode_circulation_off(self) -> None:
        """Test active mode for circulation off."""
        dhw = Dhw(circulation=_circulation())
        system = System(quick_mode=QuickModes.SYSTEM_OFF, dhw=dhw)

        active_mode = system.get_active_mode_circulation()

        self.assertEqual(QuickModes.SYSTEM_OFF, active_mode.current)
        self.assertIsNone(active_mode.target)
        self.assertIsNone(active_mode.sub)
Exemple #14
0
    def test_get_active_mode_ventilation_night(self) -> None:
        """Test get active mode for ventilation."""

        ventilation = Ventilation(operating_mode=OperatingModes.NIGHT,
                                  target_low=3)
        system = System(ventilation=ventilation)

        active_mode = system.get_active_mode_ventilation()

        self.assertEqual(OperatingModes.NIGHT, active_mode.current)
        self.assertEqual(3, active_mode.target)
Exemple #15
0
    def test_get_active_mode_ventilation_day(self) -> None:
        """Test get active mode for ventilation."""

        ventilation = Ventilation(operating_mode=OperatingModes.DAY,
                                  target_high=5)
        system = System(ventilation=ventilation)

        active_mode = system.get_active_mode_ventilation()

        self.assertEqual(OperatingModes.DAY, active_mode.current)
        self.assertEqual(5, active_mode.target)
Exemple #16
0
    def test_get_active_mode_zone(self) -> None:
        """Test get active mode for zone."""

        zone = _zone()
        system = System(zones=[zone])

        active_mode = system.get_active_mode_zone(zone)

        self.assertEqual(OperatingModes.AUTO, active_mode.current)
        self.assertEqual(SettingModes.DAY, active_mode.sub)
        self.assertEqual(zone.heating.target_high, active_mode.target)
Exemple #17
0
    def test_get_active_mode_circulation_hot_water_boost(self) -> None:
        """Test get active mode for circulation with hotwater boost."""
        dhw = Dhw(circulation=_circulation())

        system = System(quick_mode=QuickModes.HOTWATER_BOOST, dhw=dhw)

        active_mode = system.get_active_mode_circulation()

        self.assertEqual(QuickModes.HOTWATER_BOOST, active_mode.current)
        self.assertIsNone(active_mode.target)
        self.assertIsNone(active_mode.sub)
Exemple #18
0
    def test_get_active_mode_room(self) -> None:
        """Test active mode room."""
        room = _room()

        system = System(rooms=[room])

        active_mode = system.get_active_mode_room(room)

        self.assertEqual(OperatingModes.AUTO, active_mode.current)
        self.assertIsNone(active_mode.sub)
        self.assertEqual(20, active_mode.target)
Exemple #19
0
    def test_get_active_mode_hot_water(self) -> None:
        """Test get active mode for hot water."""

        dhw = Dhw(hotwater=_hotwater())
        system = System(dhw=dhw)

        active_mode = system.get_active_mode_hot_water()

        self.assertEqual(OperatingModes.AUTO, active_mode.current)
        self.assertEqual(SettingModes.ON, active_mode.sub)
        self.assertEqual(50, active_mode.target)
Exemple #20
0
    def test_get_active_mode_circulation_empty_timeprogram(self) -> None:
        """Test get active mode for circulation."""

        dhw = Dhw(circulation=_circulation())
        dhw.circulation.time_program = TimeProgram(days={})
        system = System(dhw=dhw)

        active_mode = system.get_active_mode_circulation()

        self.assertEqual(OperatingModes.AUTO, active_mode.current)
        self.assertEqual(SettingModes.OFF, active_mode.sub)
Exemple #21
0
    def test_get_active_mode_room_quick_veto(self) -> None:
        """Test mode room with quick veto."""
        room = _room()
        quick_veto = QuickVeto(duration=0, target=22)
        room.quick_veto = quick_veto
        system = System(rooms=[room])

        active_mode = system.get_active_mode_room(room)

        self.assertEqual(OperatingModes.QUICK_VETO, active_mode.current)
        self.assertEqual(quick_veto.target, active_mode.target)
Exemple #22
0
    def test_get_active_mode_circulation_no_timeprogram_on(self) -> None:
        """Test get active mode for circulation."""

        dhw = Dhw(circulation=_circulation())
        dhw.circulation.time_program = None
        dhw.circulation.operating_mode = OperatingModes.ON
        system = System(dhw=dhw)

        active_mode = system.get_active_mode_circulation()

        self.assertEqual(OperatingModes.ON, active_mode.current)
Exemple #23
0
    def test_get_active_mode_ventilation_party(self) -> None:
        """Test get active mode for ventilation."""

        ventilation = Ventilation(operating_mode=OperatingModes.NIGHT,
                                  target_high=5)
        system = System(ventilation=ventilation, quick_mode=QuickModes.PARTY)

        active_mode = system.get_active_mode_ventilation()

        self.assertEqual(QuickModes.PARTY, active_mode.current)
        self.assertEqual(ventilation.target_high, active_mode.target)
Exemple #24
0
    def test_get_active_mode_ventilation_quick_mode_boost(self) -> None:
        """Test get active mode for ventilation."""

        ventilation = Ventilation(operating_mode=OperatingModes.NIGHT,
                                  target_high=5)
        system = System(ventilation=ventilation,
                        quick_mode=QuickModes.VENTILATION_BOOST)

        active_mode = system.get_active_mode_ventilation()

        self.assertEqual(QuickModes.VENTILATION_BOOST, active_mode.current)
        self.assertEqual(Ventilation.MAX_LEVEL, active_mode.target)
Exemple #25
0
    def test_get_active_mode_hotwater_no_timeprogram_on(self) -> None:
        """Test get active mode for hot water."""

        dhw = Dhw(hotwater=_hotwater())
        dhw.hotwater.time_program = None
        dhw.hotwater.operating_mode = OperatingModes.ON
        system = System(dhw=dhw)

        active_mode = system.get_active_mode_hot_water()

        self.assertEqual(OperatingModes.ON, active_mode.current)
        self.assertEqual(50, active_mode.target)
Exemple #26
0
    def test_get_active_mode_hotwater_empty_timeprogram(self) -> None:
        """Test get active mode for hot water."""

        dhw = Dhw(hotwater=_hotwater())
        dhw.hotwater.time_program = TimeProgram(days={})
        system = System(dhw=dhw)

        active_mode = system.get_active_mode_hot_water()

        self.assertEqual(OperatingModes.AUTO, active_mode.current)
        self.assertEqual(SettingModes.ON, active_mode.sub)
        self.assertEqual(50, active_mode.target)
Exemple #27
0
    def test_get_active_mode_room_holiday_mode(self) -> None:
        """Test active mode room with holiday mode."""
        holiday = HolidayMode(True, datetime.date.today(),
                              datetime.date.today(), 10)

        room = _room()
        system = System(rooms=[room], holiday=holiday)

        active_mode = system.get_active_mode_room(room)

        self.assertEqual(QuickModes.HOLIDAY, active_mode.current)
        self.assertEqual(holiday.target, active_mode.target)
Exemple #28
0
    def test_get_active_mode_ventilation_holiday(self) -> None:
        """Test get active mode for ventilation."""
        holiday = HolidayMode(True, datetime.date.today(),
                              datetime.date.today(), 10)
        ventilation = Ventilation(operating_mode=OperatingModes.NIGHT,
                                  target_high=5)
        system = System(ventilation=ventilation, holiday=holiday)

        active_mode = system.get_active_mode_ventilation()

        self.assertEqual(QuickModes.HOLIDAY, active_mode.current)
        self.assertEqual(Ventilation.MIN_LEVEL, active_mode.target)
Exemple #29
0
    def test_get_active_mode_ventilation_system_off(self) -> None:
        """Test get active mode for ventilation."""

        ventilation = Ventilation(operating_mode=OperatingModes.NIGHT,
                                  target_high=5)
        system = System(ventilation=ventilation,
                        quick_mode=QuickModes.SYSTEM_OFF)

        active_mode = system.get_active_mode_ventilation()

        self.assertEqual(QuickModes.SYSTEM_OFF, active_mode.current)
        self.assertEqual(Ventilation.MIN_LEVEL, active_mode.target)
Exemple #30
0
    def test_get_active_mode_ventilation_one_day_away(self) -> None:
        """Test get active mode for ventilation."""

        ventilation = Ventilation(operating_mode=OperatingModes.NIGHT,
                                  target_high=5)
        system = System(ventilation=ventilation,
                        quick_mode=QuickModes.ONE_DAY_AWAY)

        active_mode = system.get_active_mode_ventilation()

        self.assertEqual(QuickModes.ONE_DAY_AWAY, active_mode.current)
        self.assertEqual(Ventilation.MIN_LEVEL, active_mode.target)