human
What is a the Python code you requested given the following:
Complete the below
@asyncio.coroutine
def async_trigger(hass, config, action):

    ''''Listen for state changes based on configuration.'
    '''
assistant
#Here is the Python code you requested.
    entity_id = config.get(CONF_ENTITY_ID)
    below = config.get(CONF_BELOW)
    above = config.get(CONF_ABOVE)
    value_template = config.get(CONF_VALUE_TEMPLATE)
    if (value_template is not None):
        value_template.hass = hass
    @callback
    def state_automation_listener(entity, from_s, to_s):
        'Listen    for    state    changes    and    calls    action.'
        if (to_s is None):
            return
        variables = {'trigger': {'platform': 'numeric_state', 'entity_id': entity, 'below': below, 'above': above}}
        if (not condition.async_numeric_state(hass, to_s, below, above, value_template, variables)):
            return
        if ((from_s is not None) and condition.async_numeric_state(hass, from_s, below, above, value_template, variables)):
            return
        variables['trigger']['from_state'] = from_s
        variables['trigger']['to_state'] = to_s
        hass.async_run_job(action, variables)
    return async_track_state_change(hass, entity_id, state_automation_listener)