'Check correct startup and stop of pilight daemon.'

@patch('pilight.pilight.Client', PilightDaemonSim)
@patch('tests.components.test_pilight._LOGGER.error')
def test_start_stop(self, mock_pilight_error):

    with assert_setup_component(4):
        self.assertTrue(setup_component(self.hass, pilight.DOMAIN, {pilight.DOMAIN: {}}))
        self.hass.start()
        self.hass.block_till_done()
        error_log_call = mock_pilight_error.call_args_list[(-2)]
        self.assertTrue(('PilightDaemonSim    callback' in str(error_log_call)))
        error_log_call = mock_pilight_error.call_args_list[(-1)]
        self.assertTrue(('PilightDaemonSim    start' in str(error_log_call)))
        self.skip_teardown_stop = True
        self.hass.stop()
        error_log_call = mock_pilight_error.call_args_list[(-1)]
        self.assertTrue(('PilightDaemonSim    stop' in str(error_log_call)))
