From bcda9f888fa51eb06ddf531985fa477c7196c8a5 Mon Sep 17 00:00:00 2001 From: hoveeman Date: Sun, 25 Mar 2018 17:00:06 -0400 Subject: [PATCH] Added Homeassistant files to go on another machine --- README.md | 9 ++ homeassistant_files/automations.yaml | 11 +++ homeassistant_files/configuration.yaml | 117 +++++++++++++++++++++++++ homeassistant_files/scripts.yaml | 72 +++++++++++++++ 4 files changed, 209 insertions(+) create mode 100644 homeassistant_files/automations.yaml create mode 100644 homeassistant_files/configuration.yaml create mode 100644 homeassistant_files/scripts.yaml diff --git a/README.md b/README.md index b3f19dd..1fe00b1 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,12 @@ First run 'python config.py' to select the reader from the inputs. EDIT: Link to video of project in use: https://youtu.be/AvCseOQidSw + +Place the files under homeassistant_files in the config directory of your Homeassistant machine. +https://www.home-assistant.io/ + +You will need to create custom_components/switch directory in your config directory and place this file in there. +https://github.com/mf-social/Home-Assistant/blob/master/custom_components/switch/gmusic.py + +I followed this forum post to figure out how to find my device id, and set up the component. +https://community.home-assistant.io/t/google-music-in-ha/10976 diff --git a/homeassistant_files/automations.yaml b/homeassistant_files/automations.yaml new file mode 100644 index 0000000..d7d4f21 --- /dev/null +++ b/homeassistant_files/automations.yaml @@ -0,0 +1,11 @@ +- action: + - service: script.playlist + alias: Playlist Value Changes + condition: + - condition: template + value_template: '{{ states.input_text.playlist.state != "BootValue" }}' + id: '1521492851100' + trigger: + - entity_id: input_text.playlist + from: BootValue + platform: state diff --git a/homeassistant_files/configuration.yaml b/homeassistant_files/configuration.yaml new file mode 100644 index 0000000..f0e5709 --- /dev/null +++ b/homeassistant_files/configuration.yaml @@ -0,0 +1,117 @@ +homeassistant: + # Name of the location where Home Assistant is running + name: Home + # Location required to calculate the time the sun rises and sets + latitude: 40.029 + longitude: -83.0809 + # Impacts weather/sunrise data (altitude above sea level in meters) + elevation: 257 + # 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 + # Customization file + customize: !include customize.yaml + +# Show links to resources in log and frontend +#introduction: + +# Enables the frontend +frontend: + +# Enables configuration UI +config: + +http: + # Secrets are defined in the file secrets.yaml + api_password: !secret http_password + # Uncomment this if you are using SSL/TLS, running in Docker container, etc. + # base_url: example.duckdns.org:8123 + +# Checks for available updates +# Note: This component will send some information about your system to +# the developers to assist with development of Home Assistant. +# For more information, please see: +# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/ +updater: + # Optional, allows Home Assistant developers to focus on popular components. + # include_used_components: true + +# 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: + +# Enables a map showing the location of tracked devices +map: + +# Track the sun +#sun: + +# Weather prediction +#sensor: +# - platform: yr + +# Text to speech +tts: + - platform: google + +# Cloud +cloud: + +#group: !include groups.yaml +automation: !include automations.yaml +script: !include scripts.yaml + +input_text: + playlist: + name: playlist + initial: BootValue + +input_select: + music: + name: Music + options: + - " " # Should be empty + icon: mdi:music-note + media_player: + name: Media player + options: # entity_ids of your media players + - "soundbar" + - "kitchen" + - "down_stairs" + - "bedroom" + - "home_group" + - "up_stairs" + - "front_living_room" + - "basement" + - "guest_room" + icon: mdi:music-note + +switch: + - platform: gmusic + user: !secret gmusic_user + password: !secret gmusic_pass + device_id: !secret gmusic_device_id # http://unofficial-google-music-api.readthedocs.io/en/latest/reference/mobileclient.html#gmusicapi.clients.Mobileclient.login + media_player: media_player # entity id of the input select used for mediaplayer + playlist: music # entity id of the input select used for playlist + +# OPTIONAL +group: + google_music: + name: Google Music + entities: + - input_select.music + - input_select.media_player + - switch.google_music + + + + diff --git a/homeassistant_files/scripts.yaml b/homeassistant_files/scripts.yaml new file mode 100644 index 0000000..765b683 --- /dev/null +++ b/homeassistant_files/scripts.yaml @@ -0,0 +1,72 @@ +musicoff: + alias: Turn off the Music + sequence: + - service: media_player.turn_off + entity_id: media_player.down_stairs + - service: switch.turn_off + entity_id: switch.google_music + +musicon: + alias: Turn on the Google Music Switch + sequence: + - service: switch.turn_on + entity_id: switch.google_music + +playlist: + alias: Playlist Script from RFID + sequence: + - service: script.musicoff + - service: input_select.select_option + data_template: + entity_id: input_select.music + option: '{{ states.input_text.playlist.state }}' + - service: input_select.select_option + data: + entity_id: input_select.media_player + option: "down_stairs" + - service: script.volume30 + - service: script.musicon + - service: input_text.set_value + data_template: + entity_id: input_text.playlist + value: "BootValue" + +volume30: + alias: Set Volume of Media to 30% + sequence: + - service: media_player.volume_set + data: + entity_id: media_player.kitchen + volume_level: 0.3 + - service: media_player.volume_set + data: + entity_id: media_player.basement + volume_level: 0.3 + - service: media_player.volume_set + data: + entity_id: media_player.front_living_room + volume_level: 0.3 + - service: media_player.volume_set + data: + entity_id: media_player.down_stairs + volume_level: 0.3 + +volume40: + alias: Set Volume of Media to 40% + sequence: + - service: media_player.volume_set + data: + entity_id: media_player.kitchen + volume_level: 0.4 + - service: media_player.volume_set + data: + entity_id: media_player.basement + volume_level: 0.4 + - service: media_player.volume_set + data: + entity_id: media_player.front_living_room + volume_level: 0.4 + - service: media_player.volume_set + data: + entity_id: media_player.down_stairs + volume_level: 0.4