def async_trigger(hass, config, action):
 if (CONF_AFTER in config):
  after = config.get(CONF_AFTER)
  (hours, minutes, seconds) = (after.hour, after.minute, after.second)
 else:
  hours = config.get(CONF_HOURS)
  minutes = config.get(CONF_MINUTES)
  seconds = config.get(CONF_SECONDS)
 @callback
 def time_automation_listener(now):
  'Listen for time changes and calls action.'
  hass.async_run_job(action, {'trigger': {'platform': 'time', 'now': now}})
 return async_track_time_change(hass, time_automation_listener, hour=hours, minute=minutes, second=seconds)

def async_trigger ( hass , config , action ) : if ( CONF_AFTER in config ) : after = config . get ( CONF_AFTER ) ( hours , minutes , seconds ) = ( after . hour , after . minute , after . second ) else : hours = config . get ( CONF_HOURS ) minutes = config . get ( CONF_MINUTES ) seconds = config . get ( CONF_SECONDS ) @ callback def time_automation_listener ( now ) : hass . async_run_job ( action , { 'trigger' : { 'platform' : 'time' , 'now' : now } } ) return async_track_time_change ( hass , time_automation_listener , hour = hours , minute = minutes , second = seconds )
listen for state changes based on configuration .