def test_lights_on_when_sun_sets(self):
        """Test lights go on when there is someone home and the sun sets."""
        self.assertTrue(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_on_when_sun_sets(self):
        """Test lights go on when there is someone home and the sun sets."""
        self.assertTrue(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()

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

        self.hass.states.set(
            device_tracker.ENTITY_ID_FORMAT.format('device_2'), STATE_HOME)

        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()

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

        self.hass.states.set(
            device_tracker.ENTITY_ID_FORMAT.format('device_2'), STATE_HOME)

        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))
    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))
    def test_lights_turn_on_when_coming_home_after_sun_set(self):

    # pylint: disable=invalid-name
        """Test lights turn on when coming home after sun set."""
        light.turn_off(self.hass)
        ensure_sun_set(self.hass)

        self.hass.block_till_done()

        self.assertTrue(
            setup_component(self.hass, device_sun_light_trigger.DOMAIN, {device_sun_light_trigger.DOMAIN: {}})
        )

        self.hass.states.set(device_tracker.ENTITY_ID_FORMAT.format("device_2"), STATE_HOME)

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