'Create state changed event.'

def create_state_changed_event(self, event_time_fired, entity_id, state, attributes=None, last_changed=None, last_updated=None):

    state = ha.State(entity_id, state, attributes, last_changed, last_updated).as_dict()
    return ha.Event(EVENT_STATE_CHANGED, {'entity_id': entity_id, 'old_state': state, 'new_state': state}, time_fired=event_time_fired)
