def set_state(entity_id, state, **kwargs):
    'Set the state.'
    hass.states.set(entity_id, state, **kwargs)
    wait_recording_done(hass)
    return hass.states.get(entity_id)
Set the state.
def set_state(entity_id, state, **kwargs):
    
    hass.states.set(entity_id, state, **kwargs)
    wait_recording_done(hass)
    return hass.states.get(entity_id)