Running Shell Scripts Not Found

I am having trouble calling a shell script to auto update HA config from a github repo once it passes a Travis-CI build. Below is the workflow:

Make local change on laptop -> commit -> push to github -> Travis-CI builds and runs hass -c . --script check_config -> if passes then automation on HA is triggered -> HA pulls the github change -> HA reloads config file

I have all the parts and scripts written to make this workflow but HA cannot seem to find the script.

/home//homeassistant/.homeassistant/configuration.yaml

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: !secret latitude 
  longitude: !secret longitude
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 83
  # metric for Metric, imperial for Imperial
  unit_system: imperial
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/New_York
  customize: !include_dir_merge_named customize

mqtt:
  broker: 127.0.0.1
  port: 1883
  username: !secret mqtt_username
  password: !secret mqtt_password

# Show links to resources in log and frontend
#introduction:

# Enables the frontend
frontend:

http:
  # Uncomment this to add a password (recommended!)
  # api_password: PASSWORD
  # Uncomment this if you are using SSL or running in Docker etc
  # base_url: example.duckdns.org:8123

# Checks for available updates
updater:

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
#conversation:

# Enables support for tracking state changes over time.
history:

# View all events in a logbook
#logbook:

# Track the sun
sun:

#Customize binary sensors on home page
binary_sensor: !include ./configuration/binary_sensor.yaml

#Nest Climate config
climate: !include ./configuration/climate.yaml

#cover: !include ./configuration/cover.yaml

#UniFi Device Tracker
device_tracker: !include ./configuration/device_tracker.yaml

#Dashboard groups
group: !include ./configuration/group.yaml

#http: !include ./configuration/http.yaml

#IFTTT Config API key
ifttt: !include ./configuration/ifttt.yaml

#input_boolean: !include ./configuration/input_boolean.yaml

#input_select: !include ./configuration/input_select.yaml

#light: !include ./configuration/light.yaml

#Chromecast and other Media Players
media_player: !include ./configuration/media_player.yaml

#mqtt: !include ./configuration/mqtt.yaml

#Nest Config
nest: !include ./configuration/nest.yaml

#notify: !include ./configuration/notify.yaml

#remote: !include ./configuration/remote.yaml

script: !include_dir_merge_named script

#Sensors
sensor: !include ./configuration/sensor.yaml

switch: !include ./configuration/switch.yaml

# Text to speech
tts: !include ./configuration/tts.yaml

#Automations
automation: !include_dir_merge_list automation
config:

shell_command: !include_dir_merge_named shell_command

/home/homeassistant/.homeassistant/automation/update_config.yaml

- alias: 'Update config if travis build is successfull'
  trigger:
    platform: state
    entity_id: sensor.travis_build_label
  condition:
    - condition: state
      entity_id: sensor.travis_status
      state: 'Success'
  action:
    - service: shell_command.update_config_from_github

/home/homeassistant/.homeassistant/configuration/sensor.yaml

#Travis-CI Integration
- platform: command_line
  name: Travis Status
  command: /usr/bin/curl -X GET https://api.travis-ci.org/repos/claughinghouse/homeassistant/cc.xml | grep lastBuildStatus | cut -d'"' -f2
  scan_interval: 60

- platform: command_line
  name: Travis Build Label
  command: /usr/bin/curl -X GET https://api.travis-ci.org/repos/claughinghouse/homeassistant/cc.xml | grep lastBuildLabel | cut -d'"' -f2
  scan_interval: 60

/home/homeassistant/.homeassistant/script/get_latest_config.sh

#!/bin/bash

cd "/home/homeassistant/.homeassistant"
git pull
sudo systemctl restart home-assistant@homeassistant

/home/homeassistant/.homeassistant/shell_command/update_config_from_github.yaml

'bash /home/homeassistant/.homeassistant/script/get_latest_config.sh'

I thought that I had this working but I keep receiving the error

2017-06-27 12:16:37 WARNING (MainThread) [homeassistant.core] Unable to find service shell_command/update_config_from_github

I tried to follow the HA configs from Tommatheussen, CCOSTAN, update-from-github-and-restart, and update-config-automatically-if-travis-ci-build-succeeds but I think that I am missing something simple or implemented something incorrectly. I can execute the script as the homeassistant user locally to pull the repo and restart HA.

The shell_command and script docs pages are confusing to me and I cannot figure out how to implement them properly.

You can view my current config here in case my config posts do not make sense.

Thank you!!!

Hi @claughinghouse, have you tried it with:

update_config_from_github: 'bash /home/homeassistant/.homeassistant/script/get_latest_config.sh'

I think the shell_command must have a name.

Edit: Or you should use !include_dir_named for the shell_command include, it maps filename => content of file.

@VDRainer I think that I am more confused now or I am missing something obvious.

Where should the
update_config_from_github: 'bash /home/homeassistant/.homeassistant/script/get_latest_config.sh'
portion go?

Should I replace the !include_dir_named portion in my configuration.yaml file?

should go to /home/homeassistant/.homeassistant/shell_command/update_config_from_github.yaml

OR

use:

shell_command: !include_dir_named shell_command

in configuration.yaml
Then the name of the update_config_from_github.yaml file will be used as name for the shell_command.

BTW: I never used !include_dir_named, so i`m not sure if it works.