commit 1c32ac48500476cd6c782984ba3dce7bc33d78df Author: Dan Date: Sat Jun 22 23:10:30 2019 -0400 Initial Commit diff --git a/automations.yaml b/automations.yaml new file mode 100644 index 0000000..1cdf013 --- /dev/null +++ b/automations.yaml @@ -0,0 +1,233 @@ +- alias: 'Come home lights on if dark' + trigger: + - platform: state + entity_id: device_tracker.dan_dansphone + to: 'home' + condition: + condition: and + conditions: + - condition: state + entity_id: device_tracker.dan_dansphone + state: 'home' + - condition: sun + after: sunset + after_offset: '-01:00:00' + action: + - service: light.turn_on + entity_id: group.lightautomation + - service: notify.notify_dan + data: + title: 'Lights on' + message: 'All lights turned on' + - delay: '00:05:00' + - service: light.turn_off + entity_id: light.sengled_e11g13_030b3e1d_1 + - service: notify.notify_dan + data: + title: 'EntryWay Light Off - Beacon' + message: 'Entryway light turned off. Welcome Home.' + +- alias: 'Leave and lights turn off' + trigger: + platform: state + entity_id: device_tracker.dan_dansphone + to: 'not_home' + condition: + condition: state + entity_id: group.all_lights + state: 'on' + action: + - service: light.turn_off + entity_id: group.all_lights + - service: notify.notify_dan + data: + title: 'Lights off' + message: 'All lights have been turned off' + +- alias: 'Switch on' + trigger: + platform: sun + event: sunset + offset: '-01:00:00' + action: + service: switch.turn_on + entity_id: switch.linear_ps15z2_plugin_appliance_module_switch + +- alias: 'Switch off' + trigger: + platform: time + at: '00:00:00' + action: + service: switch.turn_off + entity_id: switch.linear_ps15z2_plugin_appliance_module_switch + +#- alias: 'Lights On - Beacon' +# trigger: +# - platform: state +# entity_id: sensor.Dan, sensor.Guest +# from: 'not_home' +# condition: +# condition: and +# conditions: +# - condition: sun +# after: sunset +# after_offset: "-1:00:00" +# - condition: state +# entity_id: group.lightautomation +# state: 'off' +# action: +# - service: light.turn_on +# entity_id: group.lightautomation +# - service: notify.notify_dan +# data: +# title: 'Lights on - Beacon' +# message: 'All lights turned on via beacon' +# +#- alias: 'Entryway Off - Beacon' +# trigger: +# - platform: state +# entity_id: sensor.Dan +# from: 'EntryWay - HB' +# to: 'Bedroom' +# condition: +# condition: state +# entity_id: light.sengled_e11g13_030b3e1d_1 +# state: 'on' +# action: +# - service: light.turn_off +# entity_id: light.sengled_e11g13_030b3e1d_1 +# - service: notify.notify_dan +# data: +# title: 'EntryWay Light Off - Beacon' +# message: 'Entryway light turned off. Welcome Home.' +# +#- alias: 'Lights Off - Beacon' +# trigger: +# platform: state +# entity_id: sensor.Dan, sensor.Guest +# to: 'not_home' +# condition: +# condition: state +# entity_id: group.all_lights +# state: 'on' +# action: +# - service: light.turn_off +# entity_id: group.all_lights +# - service: notify.notify_dan +# data: +# title: 'Lights off - Beacon' +# message: 'All lights have been turned off via beacon' + +- alias: 'Lights on when home' + trigger: + - platform: sun + event: sunset + offset: '-01:00:00' + condition: + condition: and + conditions: + - condition: template + ##value_template: "{% if not is_state('sensor.dan', 'not_home') or not is_state('sensor.guest', 'not_home') or is_state('device_tracker.dan_dansphone', 'home') %}true{% endif %}" + value_template: "{% if is_state('device_tracker.dan_dansphone', 'home') %}true{% endif %}" + - condition: state + entity_id: group.lightlivingroom + state: 'off' + action: + - service: light.turn_on + entity_id: group.lightlivingroom + - service: notify.notify_dan + data: + title: 'Living Room Lights on - Sunset' + message: 'Living Room Lights turned on. But you probably know that.' + +- alias: 'IFTT' + trigger: + platform: event + event_type: ifttt_webhook_received + event_data: + action: call_service + action: + service_template: '{{ trigger.event.data.service }}' + data_template: + entity_id: '{{ trigger.event.data.entity_id }}' + + + + + #########Climate Automations###### + +- alias: 'Set Away Mode' + trigger: + platform: state + entity_id: device_tracker.dan_dansphone + to: 'not_home' + from: 'home' + condition: + condition: template + value_template: "{% if not is_state('climate.home', 'off') %}true{% endif %}" + action: + - service: climate.set_away_mode + entity_id: climate.home + data: + away_mode: 'on' + - service: notify.notify_dan + data: + title: 'Left House - Set thermostate to Away' + message: 'Thermostat set to away mode' + - service: input_boolean.turn_on + data: + entity_id: input_boolean.thermostat_mode + +- alias: 'Leave Work Set Home Mode' + trigger: + platform: state + entity_id: device_tracker.dan_dansphone + to: 'not_home' + from: 'Work' + condition: + - condition: template + value_template: "{% if not is_state('climate.home', 'off') %}true{% endif %}" + - condition: time + weekday: + - mon + - tue + - wed + - thu + action: + - service: climate.set_away_mode + entity_id: climate.home + data: + away_mode: 'off' + - service: notify.notify_dan + data: + title: 'Left Work - Set thermostate to Home' + message: 'Thermostat set to home mode' + - service: input_boolean.turn_off + data: + entity_id: input_boolean.thermostat_mode + +- alias: 'Set Home Mode' + trigger: + platform: state + entity_id: device_tracker.dan_dansphone + to: 'home' + from: 'not_home' + condition: + - condition: template + value_template: "{% if not is_state('climate.home', 'off') %}true{% endif %}" + - condition: state + entity_id: input_boolean.thermostat_mode + state: 'on' + action: + - service: climate.set_away_mode + entity_id: climate.home + data: + away_mode: 'off' + - service: notify.notify_dan + data: + title: 'Back Home - Set thermostate to Home' + message: 'Thermostat set to home mode' + - service: input_boolean.turn_off + data: + entity_id: input_boolean.thermostat_mode + diff --git a/climate.yaml b/climate.yaml new file mode 100644 index 0000000..b6fc6c2 --- /dev/null +++ b/climate.yaml @@ -0,0 +1,12 @@ +- alias: 'Set Away Mode' + trigger: + platform: state + entity_id: device_tracker.dan_dansphone + to: 'not_home' + condition: template + value_template: "{% if not is_state('thermostat_current_status', 'off') %}true{% endif %}" + action: + - service: set_away_mode + away_mode: on + + \ No newline at end of file diff --git a/climate_sensors.yaml b/climate_sensors.yaml new file mode 100644 index 0000000..1871b93 --- /dev/null +++ b/climate_sensors.yaml @@ -0,0 +1,7 @@ +- platform: template + sensors: + - thermostat_current_status: + value_template: '{{ states.climate.house.attributes.operation }}' + + - thermostat_away_mode: + value_template: '{{ states.climate.house.attributes.away_mode }}' \ No newline at end of file diff --git a/configuration.yaml b/configuration.yaml new file mode 100644 index 0000000..dc78f8e --- /dev/null +++ b/configuration.yaml @@ -0,0 +1,198 @@ +homeassistant: + # Name of the location where Home Assistant is running + name: Home + # Location required to calculate the time the sun rises and sets + latitude: 41.3568 + longitude: -82.262 + # Impacts weather/sunrise data (altitude above sea level in meters) + elevation: 244 + # 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: +lovelace: + mode: yaml +# Enables configuration UI +config: + +map: + +#namecheapdns: +# domain: danshouse.space +# password: c6dc6147fab242a2a4c50688790995c5 + +http: + # Secrets are defined in the file secrets.yaml + api_password: ICYN30blah + # Uncomment this if you are using SSL/TLS, running in Docker container, etc. + + base_url: icyn30.duckdns.org:8123 + ssl_certificate: /ssl/fullchain.pem + ssl_key: /ssl/privkey.pem +# 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: + +# Track the sun +sun: + +#weather +weather: + - platform: darksky + api_key: 19b4b95365ea88c65b085805ef046ba0 + latitude: 41.469249 + longitude: -81.713146 + name: Amherst + +# sensors +sensor: + - platform: yr +# - platform: darksky +# api_key: 19b4b95365ea88c65b085805ef046ba0 +# latitude: 41.469249 +# longitude: -81.713146 +# monitored_conditions: +# - icon +# - precip_type +# - precip_intensity +# - precip_probability +# - apparent_temperature +# - apparent_temperature_max +# - apparent_temperature_min +# - precip_intensity_max +# - hourly_summary +# - platform: mqtt +# state_topic: "owntracks/HA/DansPhone" +# name: "Phone Battery" +# unit_of_measurement: "%" +# value_template: '{{ value_json.batt }}' +# - platform: mqtt_room +# device_id: e2c56db5dffb48d2b060d0f5a71096e0_0000_0000 +# name: 'Dan' +# state_topic: 'happy-bubbles/presence/ha' +# away_timeout: 60 +# - platform: mqtt_room +# device_id: 74278bdab64445208f0c720eaf059935_0000_0000 +# name: 'Guest' +# state_topic: 'happy-bubbles/presence/ha' +# away_timeout: 60 +# - platform: sonarr +# api_key: c544cae167164f11947c84ad4e04f61c +# host: 192.168.86.20 +# monitored_conditions: +# - upcoming +# days: 7 +# - diskspace + - platform: template + sensors: + thermostat_current_status: + value_template: "{{ states.climate.home.attributes.operation }}" + - platform: template + sensors: + thermostat_away_mode: + value_template: "{{ states.climate.home.attributes.away_mode }}" + - platform: template + sensors: + thermostat_climate_mode: + value_template: "{{ states.climate.home.attributes.climate_mode }}" + - platform: template + sensors: + thermostat_outside_temperature: + unit_of_measurement: "°F" + value_template: "{{ float(states.weather.home.attributes.temperature) }}" + + +# Text to speech +#tts: +# - platform: google + +#mqtt: +# broker: core-mosquitto +# username: HA +# password: login + +#device_tracker: +# - platform: owntracks + +ifttt: + key: bO6GhKW9xCaQoIigKnq1qF + +telegram_bot: + - platform: broadcast + api_key: 374239722:AAGd4y_LsEoOe5IUUblKXehCQFJV1s2JdQo + allowed_chat_ids: + 438758485 + +notify: + name: notify_dan + platform: telegram + chat_id: 438758485 + +hue: + bridges: + - host: 192.168.86.44 + allow_unreachable: true + +alexa: + +zwave: + usb_path: /dev/ttyUSB0 + +zha: + usb_path: /dev/ttyUSB1 + database_path: /config/zigbee.db + +ecobee: + api_key: 8DSRpsILZJNUIJXvSzY6C4ufrMQNQsHa + +input_boolean: + thermostat_mode: + name: Thermostat Away Mode + +influxdb: + host: docker.dandev.us + include: + entities: + - sensor.home_temperature + - sensor.home_humidity + - sensor.thermostat_outside_temperature + - device_tracker.dan_dansphone + - sensor.thermostate_current_status + - sensor.thermostate_climate_mode + - light.sengled_e11g13_030b22ba_1 + - light.sengled_e11g13_030b3e1d_1 + - light.sengled_e11g13_030b3efd_1 + - light.sengled_e11g13_030b40af_1 + - light.sengled_e11g13_031468d6_1 + - light.table + +group: !include groups.yaml +automation: !include automations.yaml +script: !include scripts.yaml +zone: !include zones.yaml +intent_script: !include intents.yaml diff --git a/confirm.yaml b/confirm.yaml new file mode 100644 index 0000000..87a3080 --- /dev/null +++ b/confirm.yaml @@ -0,0 +1,12 @@ + > + {{ [ + "OK", + "Sure", + "I gotchu", + "'ight", + "Done", + "No worries", + "Ain't no thang", + "As you wish", + "No problem" + ] | random }} diff --git a/customize.yaml b/customize.yaml new file mode 100644 index 0000000..690125a --- /dev/null +++ b/customize.yaml @@ -0,0 +1,19 @@ +media_player.un55j6300_un55j6200: + friendly_name: TV - Livingroom +device_tracker.dan_hero2qltevzw: + friendly_name: Test + hidden: true + homebridge_hidden: true + tid: BAD +light.sengled_e11g13_030b3e1d_1: + friendly_name: Entryway Light +light.sengled_e11g13_030b3efd_1: + friendly_name: Dinning Room +light.sengled_e11g13_030b40af_1: + friendly_name: Desk +light.sengled_e11g13_030b22ba_1: + friendly_name: Living Room +light.sengled_e11g13_031468d6_1: + friendly_name: Office +switch.linear_ps15z2_plugin_appliance_module_switch: + friendly_name: Switch diff --git a/ecobee.conf b/ecobee.conf new file mode 100644 index 0000000..ceec1d4 --- /dev/null +++ b/ecobee.conf @@ -0,0 +1 @@ +{"API_KEY": "8DSRpsILZJNUIJXvSzY6C4ufrMQNQsHa", "ACCESS_TOKEN": "Qcc9PZdrmep5mVpxrEUC8SJQQqeWZhzx", "REFRESH_TOKEN": "JUfW7vo01SfVDBpf83oT8EvEx6VVJJXD", "AUTHORIZATION_CODE": "f7eDBBVWQootcVDogCRxBBWO1joSDJNH"} \ No newline at end of file diff --git a/groups.yaml b/groups.yaml new file mode 100644 index 0000000..d77ed01 --- /dev/null +++ b/groups.yaml @@ -0,0 +1,72 @@ +default_view: + view: yes + icon: mdi:home + entities: + - sensor.dark_sky_apparent_temperature + - sensor.dark_sky_daily_high_apparent_temperature + - sensor.dark_sky_daily_low_apparent_temperature + - sensor.dark_sky_daily_max_precip_intensity + - sensor.dark_sky_hourly_summary + - sensor.dark_sky_icon + - sensor.dark_sky_precip + - sensor.dark_sky_precip_intensity + - sensor.dark_sky_precip_probability + - sun.sun + - device_tracker.dan_dansphone + - switch.linear_ps15z2_plugin_appliance_module_switch + - light.table + - light.lamp_left + - light.lamp_right + - light.sengled_e11g13_030b3e1d_1 + - light.sengled_e11g13_030b3efd_1 + - light.sengled_e11g13_030b40af_1 + - light.sengled_e11g13_030b22ba_1 + - light.sengled_e11g13_031468d6_1 + - sensor.Dan + - sensor.Guest +media: + name: Media + view: yes + control: hidden + entities: + - media_player.bedroom + - media_player.galaxy_s7_edge + - media_player.living_room + - media_player.plex_web_chrome + - media_player.roku_yr00av370849 + +automations: + name: Automations + view: yes + entities: + - automation.come_home_lights_on_if_dark + - automation.leave_and_lights_turn_off + - automation.Switch_on + - automation.Switch_off + - automation.lights_off__beacon + - automation.lights_on__beacon + - automation.Lights_on_when_home + - automation.iftt + +LightAutomation: + name: Automated lights + view: no + control: hidden + entities: + - light.table + - light.lamp_left + - light.lamp_right + - light.sengled_e11g13_030b3e1d_1 + - light.sengled_e11g13_030b22ba_1 + - light.sengled_e11g13_030b3efd_1 + +LightLivingRoom: + name: Automated Lights Living Room + view: no + control: hidden + entities: + - light.table + - light.lamp_left + - light.lamp_right + - light.sengled_e11g13_030b22ba_1 + - light.sengled_e11g13_030b3efd_1 diff --git a/intents.yaml b/intents.yaml new file mode 100644 index 0000000..939bed0 --- /dev/null +++ b/intents.yaml @@ -0,0 +1,30 @@ +LocateIntent: + speech: + text: > + {% for state in states.device_tracker %} + {% if state.name.lower() == User.lower() %} + {{ state.name }} is at {{ states("device_tracker.dan_dansphone") }} + {% else %} + I am sorry. I don't know {{ User }}. + {% endif %} + {% endfor %} + +TestIntent: + speech: + text: This doesn't work + +KitchenLight: + action: + service: light.toggle + entity_id: light.sengled_e11g13_030b3efd_1 + speech: + type: plain + text: !include confirm.yaml + +DeskLight: + action: + service: light.toggle + entity_id: light.sengled_e11g13_030b40af_1 + speech: + type: plain + text: !include confirm.yaml diff --git a/known_devices.yaml b/known_devices.yaml new file mode 100644 index 0000000..b70ee1e --- /dev/null +++ b/known_devices.yaml @@ -0,0 +1,16 @@ +dan_dansphone: + hide_if_away: false + icon: + mac: + name: Dan + picture: + track: true + vendor: + +galaxy_note9: + hide_if_away: false + icon: + mac: + name: Galaxy Note9 + picture: + track: true diff --git a/phue.conf b/phue.conf new file mode 100644 index 0000000..c4cc4c7 --- /dev/null +++ b/phue.conf @@ -0,0 +1 @@ +{"192.168.0.3": {"username": "VnBhos4INN1hYOhPwmnNYY4wq3179dXJGTJrb04q"}} \ No newline at end of file diff --git a/scripts.yaml b/scripts.yaml new file mode 100644 index 0000000..e69de29 diff --git a/secrets.yaml b/secrets.yaml new file mode 100644 index 0000000..acb5cbc --- /dev/null +++ b/secrets.yaml @@ -0,0 +1,4 @@ + +# Use this file to store secrets like usernames and passwords. +# Learn more at https://home-assistant.io/docs/configuration/secrets/ +http_password: welcome diff --git a/ui-lovelace.yaml b/ui-lovelace.yaml new file mode 100644 index 0000000..28b3bf0 --- /dev/null +++ b/ui-lovelace.yaml @@ -0,0 +1,102 @@ + +# This file was automatically generated by lovelace_migrate.py +# https://github.com/dale3h/python-lovelace + +title: Home +views: + - title: default_view + icon: mdi:home + cards: + - type: vertical-stack + cards: + - type: weather-forecast + entity: weather.amherst + - type: entities + entities: + - sun.sun + - sensor.home_temperature + - sensor.home_humidity + + - type: entities + entities: + - switch.linear_ps15z2_plugin_appliance_module_switch + - light.table + - light.lamp_left + - light.lamp_right + - light.sengled_e11g13_030b3e1d_1 + - light.sengled_e11g13_030b3efd_1 +#Old Desk Light - light.sengled_e11g13_030b40af_1 + - light.sengled_e11g13_030b22ba_1 + - light.sengled_e11g13_031468d6_1 + - type: entity-filter + entities: + - device_tracker.dan_dansphone + - sensor.dan + - sensor.guest + state_filter: + - home + - Work + - EntryWay - HB + - Bedroom - HB + card: + type: glance + title: Locations + #- type: iframe + # url: https://calendar.google.com/calendar/embed?src=o8j2rmvuti5q41p20iavvacab4%40group.calendar.google.com&ctz=America%2FNew_York + # aspect_ratio: 80% + #- type: iframe + # url: https://calendar.google.com/calendar/embed?src=icyn30%40gmail.com&ctz=America%2FNew_York + # aspect_ratio: 80% + - type: iframe + url: https://calendar.google.com/calendar/embed?src=e1f4omvdb8fntpfbmhv0bc5mog%40group.calendar.google.com&ctz=America%2FNew_York + aspect_ratio: 80% + + - title: Media + icon: mdi:play-network + cards: + - type: media-control + entity: media_player.roku_yr00av370849 + - title: Automations + icon: mdi:robot + cards: + - type: entities + entities: + - automation.come_home_lights_on_if_dark + - automation.leave_and_lights_turn_off + - automation.switch_on + - automation.switch_off + - automation.lights_on_when_home + - automation.iftt + + - title: HVAC + icon: mdi:temperature-fahrenheit + cards: + - type: entities + entities: + - climate.home + - type: vertical-stack + cards: + - type: entities + entities: + - sensor.home_temperature + - sensor.home_humidity + - type: history-graph + entities: + - sensor.home_temperature + - sensor.thermostat_outside_temperature + - sensor.home_humidity + - type: entities + entities: + - entity: sensor.thermostat_current_status + name: Status + - entity: sensor.thermostat_away_mode + name: Away Mode + - entity: sensor.thermostat_climate_mode + name: Climate Mode + - type: entities + entities: + - automation.set_away_mode + - automation.leave_work_set_home_mode + - automation.set_home_mode + - type: thermostat + entity: climate.home diff --git a/zones.yaml b/zones.yaml new file mode 100644 index 0000000..c428c79 --- /dev/null +++ b/zones.yaml @@ -0,0 +1,14 @@ +# - name: Apartment +# latitude: 41.409482 +# longitude: -82.198393 +# range: 300 + +- name: Work + latitude: 41.469146 + longitude: -81.713181 + range: 1000 + +- name: Home + latitude: 41.399024 + longitude: -82.233214 + range: 300