def test_lights_on_when_sun_sets(self):
        """ Test lights go on when there is someone home and the sun sets. """

        device_sun_light_trigger.setup(
            self.hass, {device_sun_light_trigger.DOMAIN: {}})

        ensure_sun_risen(self.hass)

        light.turn_off(self.hass)

        self.hass.pool.block_till_done()

        ensure_sun_set(self.hass)

        self.hass.pool.block_till_done()

        self.assertTrue(light.is_on(self.hass))
示例#2
0
    def test_lights_on_when_sun_sets(self):
        """ Test lights go on when there is someone home and the sun sets. """

        device_sun_light_trigger.setup(self.hass,
                                       {device_sun_light_trigger.DOMAIN: {}})

        ensure_sun_risen(self.hass)

        light.turn_off(self.hass)

        self.hass.pool.block_till_done()

        ensure_sun_set(self.hass)

        self.hass.pool.block_till_done()

        self.assertTrue(light.is_on(self.hass))
    def test_lights_turn_on_when_coming_home_after_sun_set(self):
        """ Test lights turn on when coming home after sun set. """
        light.turn_off(self.hass)

        ensure_sun_set(self.hass)

        self.hass.pool.block_till_done()

        device_sun_light_trigger.setup(
            self.hass, {device_sun_light_trigger.DOMAIN: {}})

        self.scanner.come_home('DEV2')
        trigger_device_tracker_scan(self.hass)

        self.hass.pool.block_till_done()

        self.assertTrue(light.is_on(self.hass))
示例#4
0
    def test_lights_turn_on_when_coming_home_after_sun_set(self):
        """ Test lights turn on when coming home after sun set. """
        light.turn_off(self.hass)

        ensure_sun_set(self.hass)

        self.hass.pool.block_till_done()

        device_sun_light_trigger.setup(self.hass,
                                       {device_sun_light_trigger.DOMAIN: {}})

        self.scanner.come_home('DEV2')
        trigger_device_tracker_scan(self.hass)

        self.hass.pool.block_till_done()

        self.assertTrue(light.is_on(self.hass))