diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..feda34ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +secrets.yaml +known_devices.yaml +docker-compose.yaml +home-assistant.log +home-assistant_v2.db +deps/ +.HA_VERSION +.uuid \ No newline at end of file diff --git a/.travis.yaml b/.travis.yaml new file mode 100644 index 00000000..638361b5 --- /dev/null +++ b/.travis.yaml @@ -0,0 +1,9 @@ +language: python +python: + - "3.5.3" +install: + - pip3 install homeassistant +script: + - hass -c . --script check_config +before_install: + - mv travis_secrets.yaml secrets.yaml diff --git a/automation.yaml b/automation.yaml new file mode 100644 index 00000000..4220128a --- /dev/null +++ b/automation.yaml @@ -0,0 +1,60 @@ +- alias: Kitchen Ceiling send state off when lwt is seen + trigger: + platform: mqtt + topic: "tele/kitchen_ceiling_lamp/LWT" + payload: "Offline" + action: + service: mqtt.publish + data: + payload: "OFF" + qos: 1 + retain: true + topic: "stat/kitchen_ceiling_lamp/POWER" +- alias: Livingroom Ceiling send state off when lwt is seen + trigger: + platform: mqtt + topic: "tele/livingroom_ceiling_lamp/LWT" + payload: "Offline" + action: + service: mqtt.publish + data: + payload: "OFF" + qos: 1 + retain: true + topic: "stat/livingroom_ceiling_lamp/POWER" +- alias: Lobby Ceiling send state off when lwt is seen + trigger: + platform: mqtt + topic: "tele/lobby_ceiling/LWT" + payload: "Offline" + action: + service: mqtt.publish + data: + payload: "OFF" + qos: 1 + retain: true + topic: "stat/lobby_ceiling/POWER" +- alias: Studyroom Ceiling send state off when lwt is seen + trigger: + platform: mqtt + topic: "tele/studyroom_ceiling_lamp/LWT" + payload: "Offline" + action: + service: mqtt.publish + data: + payload: "OFF" + qos: 1 + retain: true + topic: "stat/studyroom_ceiling_lamp/POWER" +- alias: Storageroom Ceiling send state off when lwt is seen + trigger: + platform: mqtt + topic: "tele/storageroom_ceiling_lamp/LWT" + payload: "Offline" + action: + service: mqtt.publish + data: + payload: "OFF" + qos: 1 + retain: true + topic: "stat/storageroom_ceiling_lamp/POWER" diff --git a/configuration.yaml b/configuration.yaml new file mode 100644 index 00000000..fa4eacef --- /dev/null +++ b/configuration.yaml @@ -0,0 +1,91 @@ +################################################################# +## Home Assistant +################################################################# + +homeassistant: + name: Home + latitude: !secret homeassistant_latitude + longitude: !secret homeassistant_longitude + elevation: !secret homeassistant_elevation + unit_system: metric + time_zone: !secret homeassistant_timezone + customize: !include customize.yaml + + +frontend: +updater: + reporting: no + include_used_components: true +sun: +map: +config: + +logger: + default: critical + logs: + homeassistant.components.http.ban: warning + +logbook: + +http: + # Uncomment this to add a password (recommended!) + api_password: !secret homeassistant_password + # Uncomment this if you are using SSL or running in Docker etc + base_url: !secret homeassistant_url + ip_ban_enabled: True + login_attempts_threshold: 3 + +history: + +################################################################# +## Components +################################################################# + +emulated_hue: + host_ip: !secret homeassistant_host_ip + type: alexa + expose_by_default: false + +mqtt: + broker: !secret mqtt_host + port: 1883 + client_id: !secret mqtt_client_id + username: !secret mqtt_user + password: !secret mqtt_pass + keepalive: 60 + +recorder: + db_url: !secret db_url + purge_interval: 0 + +device_tracker: + - platform: fritz + track_new_devices: yes + +xiaomi_aqara: + discovery_retry: 10 + gateways: + - mac: + key: !secret xiaomi_aqara_key + +media_player: + - platform: denonavr + host: !secret denon_ip + - platform: kodi + host: !secret kodi_ip + +################################################################# +## Includes +################################################################# + +switch: !include switch.yaml +sensor: !include sensor.yaml +group: !include group.yaml +automation: !include automation.yaml +script: !include scripts.yaml +light: !include_dir_merge_list lights/ +input_boolean: !include input_boolean.yaml +input_number: !include input_number.yaml +notify: !include notify.yaml +zone: !include zone.yaml + diff --git a/customize.yaml b/customize.yaml new file mode 100644 index 00000000..1b8aec91 --- /dev/null +++ b/customize.yaml @@ -0,0 +1,114 @@ +switch.kitchen_ceiling_lamp: + emulated_hue_hidden: false + emulated_hue_name: "Küchen Lampe" + icon: mdi:lightbulb +switch.snowboard: + emulated_hue_hidden: false + emulated_hue_name: "Snowboard" + icon: mdi:lightbulb +switch.livingroom_ceiling: + emulated_hue_hidden: false + emulated_hue_name: "Decken Lampe" + icon: mdi:lightbulb +switch.livingroom_small_lamp: + emulated_hue_hidden: false + emulated_hue_name: "Kleine Lampe" + icon: mdi:lightbulb +switch.livingroom_large_lamp: + emulated_hue_hidden: false + emulated_hue_name: "Große Lampe" + icon: mdi:lightbulb +switch.rosie_station: + emulated_hue_hidden: false + emulated_hue_name: "Rosie Station" +switch.storageroom_ceiling_lamp: + emulated_hue_hidden: false + emulated_hue_name: "Abstellkammer Lampe" + icon: mdi:lightbulb +switch.studyroom_ceiling_lamp: + emulated_hue_hidden: false + emulated_hue_name: "Arbeitszimmer Decken Lampe" + icon: mdi:lightbulb +switch.studyroom_lamp: + emulated_hue_hidden: false + emulated_hue_name: "Arbeitszimmer Steh Lampe" + icon: mdi:lightbulb +switch.lobby_ceiling: + emulated_hue_hidden: false + emulated_hue_name: "Flur" + icon: mdi:lightbulb +media_player.denon_avrx1300w: + emulated_hue_hidden: false + emulated_hue_name: "Receiver" +group.all: + emulated_hue_hidden: false + emulated_hue_name: "Wohnung" +group.livingroom: + emulated_hue_hidden: false + emulated_hue_name: "Wohnzimmer" +group.kitchen: + emulated_hue_hidden: false + emulated_hue_name: "Küche" +group.studyroom: + emulated_hue_hidden: false + emulated_hue_name: "Arbeitszimmer" +group.synonym_light: + emulated_hue_hidden: false + emulated_hue_name: "Licht" +script.receiver_set_source_cbl_sat: + emulated_hue_hidden: false + emulated_hue_name: "Sat" +script.receiver_set_source_media_player: + emulated_hue_hidden: false + emulated_hue_name: "Receiver Media Player" +script.receiver_set_source_dvd: + emulated_hue_hidden: false + emulated_hue_name: "Receiver Kodi" +light.bar_table: + emulated_hue_hidden: false + emulated_hue_name: "Bar" +script.bar_table_green: + emulated_hue_hidden: false + emulated_hue_name: "Bar Grün" +script.bar_table_red: + emulated_hue_hidden: false + emulated_hue_name: "Bar Rot" +script.bar_table_white: + emulated_hue_hidden: false + emulated_hue_name: "Bar Weiss" +light.bedroom_yeelight: + emulated_hue_hidden: false + emulated_hue_name: "Schlafzimmer" +switch.plug_158d00015694c5: + friendly_name: Waschmaschine +sensor.travel_time_work_from_home: + icon: mdi: clock +sensor.travel_time_work_from_sindlingen: + icon: mdi: clock +sensor.travel_time_sindlingen_from_home: + icon: mdi: clock +sensor.travel_time_sindlingen_from_work: + icon: mdi: clock +sensor.travel_time_home_from_sindlingen: + icon: mdi: clock +sensor.travel_time_home_from_work: + icon: mdi: clock +sensor.travel_time_work_from_home: + friendly_name: "Slack Benachrichtigung" + icon: mdi: slack +sensor.travel_time_work_from_sindlingen: + friendly_name: "Slack Benachrichtigung" + icon: mdi: slack +sensor.travel_time_sindlingen_from_home: + friendly_name: "Slack Benachrichtigung" + icon: mdi: slack +sensor.travel_time_sindlingen_from_work: + friendly_name: "Slack Benachrichtigung" + icon: mdi: slack +sensor.travel_time_home_from_sindlingen: + friendly_name: "Slack Benachrichtigung" + icon: mdi: slack +sensor.travel_time_home_from_work: + friendly_name: "Slack Benachrichtigung" + icon: mdi: slack + diff --git a/entity_registry.yaml b/entity_registry.yaml new file mode 100644 index 00000000..3204522c --- /dev/null +++ b/entity_registry.yaml @@ -0,0 +1,24 @@ +sensor.illumination_286c0785b294: + name: + platform: xiaomi_aqara + unique_id: illumination286c0785b294 +switch.plug_158d00015694c5: + name: + platform: xiaomi_aqara + unique_id: status158d00015694c5 +light.gateway_light_286c0785b294: + name: + platform: xiaomi_aqara + unique_id: rgb286c0785b294 +binary_sensor.door_window_sensor_158d000126a57b: + name: + platform: xiaomi_aqara + unique_id: status158d000126a57b +binary_sensor.switch_158d00012db9e5: + name: + platform: xiaomi_aqara + unique_id: status158d00012db9e5 +binary_sensor.motion_sensor_158d00012aab97: + name: + platform: xiaomi_aqara + unique_id: status158d00012aab97 diff --git a/group.yaml b/group.yaml new file mode 100644 index 00000000..f6dd5a7a --- /dev/null +++ b/group.yaml @@ -0,0 +1,148 @@ +################################################################# +## View +################################################################# +default_view: + view: yes + icon: mdi:home + entities: + - group.livingroom + - group.occupancy + - switch.kitchen_ceiling_lamp + - media_player.denon_avrx1300w + - switch.plug_158d00015694c5 + - group.traveltimes + - sensor.dark_sky_icon + +lights: + name: Lights + view: yes + icon: mdi:lightbulb-outline + entities: + - switch.livingroom_large_lamp + - switch.studyroom_lamp + - switch.livingroom_small_lamp + - switch.studyroom_ceiling_lamp + - switch.storageroom_ceiling_lamp + - switch.kitchen_ceiling_lamp + - switch.livingroom_ceiling + - switch.lobby_ceiling + - switch.snowboard + - light.bedroom_yeelight + - light.bar_table + +view_studyroom: + name: Studyroom + view: yes + icon: mdi:laptop + entities: + - group.studyroom + +devices: + name: Geräte + view: yes + icon: mdi:wifi + entities: + - group.all_devices + +view_traveltimes: + name: Reisezeiten + view: yes + icon: mdi:google-maps + entities: + - group.traveltimes + +view_sensors: + name: Sensoren + view: yes + icon: mdi:gauge + entities: + - group.sensors + - group.weather + +################################################################# +## Group +################################################################# + +synonym_light: + name: synonym_light + entities: + - switch.livingroom_large_lamp +livingroom: + name: Livingroom + entities: + - switch.livingroom_ceiling + - switch.livingroom_large_lamp + - switch.livingroom_small_lamp + - switch.snowboard + - light.bar_table +all: + name: Everything + entities: + - media_player.denon_avrx1300w + - switch.livingroom_large_lamp + - switch.studyroom_lamp + - switch.livingroom_small_lamp + - switch.studyroom_ceiling_lamp + - switch.storageroom_ceiling_lamp + - switch.kitchen_ceiling_lamp + - switch.livingroom_ceiling + - switch.lobby_ceiling + - switch.snowboard + - light.bedroom_yeelight + - light.bar_table +kitchen: + name: Kitchen + entities: + - switch.kitchen_ceiling_lamp +studyroom: + name: Studyroom + entities: + - switch.studyroom_ceiling_lamp + - switch.studyroom_lamp +occupancy: + name: Anwesenheit + entities: + - device_tracker.kevin + - device_tracker.sina + - device_tracker.galaxys8 +sensors: + name: Sensoren + entities: + - sensor.illumination_286c0785b294 + - sensor.large_lamp_humidity + - sensor.large_lamp_temperature + - sensor.small_lamp_humidity + - sensor.small_lamp_temperature + - sensor.storageroom_humidity + - sensor.storageroom_temperature + - sensor.studyroom_humidity + - sensor.studyroom_temperature +weather: + name: Wetter + entities: + - sensor.dark_sky_icon + - sensor.dark_sky_humidity + - sensor.dark_sky_temperature + - sensor.dark_sky_daily_high_temperature + - sensor.dark_sky_daily_low_temperature + - sensor.dark_sky_cloud_coverage + - sensor.dark_sky_daily_precip_intensity + - sensor.dark_sky_precip_probability + - sensor.dark_sky_summary + - sensor.dark_sky_wind_speed + +traveltimes: + name: Reisezeiten + entities: + - sensor.travel_time_home_from_sindlingen + - input_boolean.travel_time_home_from_sindlingen + - sensor.travel_time_home_from_work + - input_boolean.travel_time_home_from_work + - sensor.travel_time_sindlingen_from_home + - input_boolean.travel_time_sindlingen_from_home + - sensor.travel_time_sindlingen_from_work + - input_boolean.travel_time_sindlingen_from_work + - sensor.travel_time_work_from_home + - input_boolean.travel_time_work_from_home + - sensor.travel_time_work_from_sindlingen + - input_boolean.travel_time_work_from_sindlingen \ No newline at end of file diff --git a/input_boolean.yaml b/input_boolean.yaml new file mode 100644 index 00000000..7a396861 --- /dev/null +++ b/input_boolean.yaml @@ -0,0 +1,16 @@ + is_home: + name: Is someone home + initial: on + icon: mdi:home + travel_time_work_from_home: + initial: off + travel_time_work_from_sindlingen: + initial: off + travel_time_sindlingen_from_home: + initial: off + travel_time_sindlingen_from_work: + initial: off + travel_time_home_from_sindlingen: + initial: off + travel_time_home_from_work: + initial: off \ No newline at end of file diff --git a/input_number.yaml b/input_number.yaml new file mode 100644 index 00000000..9534b03b --- /dev/null +++ b/input_number.yaml @@ -0,0 +1,18 @@ + travel_time_work_from_home: + min: 0 + max: 120 + travel_time_work_from_sindlingen: + min: 0 + max: 120 + travel_time_sindlingen_from_home: + min: 0 + max: 120 + travel_time_sindlingen_from_work: + min: 0 + max: 120 + travel_time_home_from_sindlingen: + min: 0 + max: 120 + travel_time_home_from_work: + min: 0 + max: 120 \ No newline at end of file diff --git a/notify.yaml b/notify.yaml new file mode 100644 index 00000000..3cea277e --- /dev/null +++ b/notify.yaml @@ -0,0 +1,4 @@ + - name: slack + platform: slack + api_key: !secret slack_api_key + default_channel: '#notifications' \ No newline at end of file diff --git a/scripts.yaml b/scripts.yaml new file mode 100644 index 00000000..edc07fec --- /dev/null +++ b/scripts.yaml @@ -0,0 +1,53 @@ +################################################################# +## Receiver +################################################################# +receiver_set_source_cbl_sat: + sequence: + - service: media_player.select_source + entity_id: media_player.denon_avrx1300w + data: + source: 'CBL/SAT' + +receiver_set_source_media_player: + sequence: + - service: media_player.select_source + entity_id: media_player.denon_avrx1300w + data: + source: 'Media Player' + +receiver_set_source_dvd: + sequence: + - service: media_player.select_source + entity_id: media_player.denon_avrx1300w + data: + source: 'DVD/Blu-ray' +################################################################# +## Bar Table +################################################################# +bar_table_green: + sequence: + - service: mqtt.publish + data: + payload: '{"state":"ON","brightness":255,"white_value":0,"color":{"r":0,"g":255,"b":0},"transition":"5"}' + qos: 1 + retain: false + topic: "RGBW/00D2EE20/json/set" + +bar_table_red: + sequence: + - service: mqtt.publish + data: + payload: '{"state":"ON","brightness":255,"white_value":0,"color":{"r":255,"g":0,"b":0},"transition":"5"}' + qos: 1 + retain: false + topic: "RGBW/00D2EE20/json/set" + +bar_table_white: + sequence: + - service: mqtt.publish + data: + payload: '{"state":"ON","brightness":255,"white_value":255,"color":{"r":0,"g":0,"b":0},"transition":"5"}' + qos: 1 + retain: false + topic: "RGBW/00D2EE20/json/set" + diff --git a/sensor.yaml b/sensor.yaml new file mode 100644 index 00000000..46f41e9a --- /dev/null +++ b/sensor.yaml @@ -0,0 +1,76 @@ +- platform: darksky + api_key: !secret darsky_api_key + monitored_conditions: + - summary + - icon + - nearest_storm_distance + - precip_type + - precip_intensity + - precip_probability + - temperature + - wind_speed + - cloud_cover + - humidity + - pressure + - temperature_max + - temperature_min + +- platform: mqtt + state_topic: "tele/storageroom_ceiling_lamp/DHT/TEMPERATURE" + name: 'Storageroom Temperature' + unit_of_measurement: '°C' +- platform: mqtt + state_topic: 'tele/storageroom_ceiling_lamp/DHT/HUMIDITY' + name: 'Storageroom Humidity' + unit_of_measurement: '%' +- platform: mqtt + state_topic: "tele/livingroom_small_lamp/DHT/TEMPERATURE" + name: 'Small Lamp Temperature' + unit_of_measurement: '°C' +- platform: mqtt + state_topic: 'tele/livingroom_small_lamp/DHT/HUMIDITY' + name: 'Small Lamp Humidity' + unit_of_measurement: '%' +- platform: mqtt + state_topic: 'tele/livingroom_large_lamp/DHT/TEMPERATURE' + name: 'Large Lamp Temperature' + unit_of_measurement: '°C' +- platform: mqtt + state_topic: 'tele/livingroom_large_lamp/DHT/HUMIDITY' + name: 'Large Lamp Humidity' + unit_of_measurement: '%' +- platform: mqtt + state_topic: 'tele/studyroom_lamp/DHT/TEMPERATURE' + name: 'Studyroom Temperature' + unit_of_measurement: '°C' +- platform: mqtt + state_topic: 'tele/studyroom_lamp/DHT/HUMIDITY' + name: 'Studyroom Humidity' + unit_of_measurement: '%' +# Travel times +- platform: template + sensors: + travel_time_work_from_home: + friendly_name: "Dauer von zu Hause zur SVA" + unit_of_measurement: "min" + value_template: "{{ states('input_number.travel_time_work_from_home') | int}}" + travel_time_work_from_sindlingen: + friendly_name: "Dauer von Sina zur SVA" + unit_of_measurement: "min" + value_template: "{{ states('input_number.travel_time_work_from_sindlingen') | int}}" + travel_time_sindlingen_from_home: + friendly_name: "Dauer von zu Hause zu Sina" + unit_of_measurement: "min" + value_template: "{{ states('input_number.travel_time_sindlingen_from_home') | int}}" + travel_time_sindlingen_from_work: + friendly_name: "Dauer von der SVA zu Sina" + unit_of_measurement: "min" + value_template: "{{ states('input_number.travel_time_sindlingen_from_work') | int}}" + travel_time_home_from_sindlingen: + friendly_name: "Dauer von Sina nach Hause" + unit_of_measurement: "min" + value_template: "{{ states('input_number.travel_time_home_from_sindlingen') | int}}" + travel_time_home_from_work: + friendly_name: "Dauer von der SVA nach Hause" + unit_of_measurement: "min" + value_template: "{{ states('input_number.travel_time_home_from_work') | int}}" \ No newline at end of file diff --git a/switch.yaml b/switch.yaml new file mode 100644 index 00000000..2d272206 --- /dev/null +++ b/switch.yaml @@ -0,0 +1,91 @@ +- platform: mqtt + name: "Kitchen Ceiling Lamp" + state_topic: "stat/kitchen_ceiling_lamp/POWER" + command_topic: "cmnd/kitchen_ceiling_lamp/POWER" + payload_on: "ON" + payload_off: "OFF" + optimistic: false + qos: 1 + retain: false +- platform: mqtt + name: "Studyroom Ceiling Lamp" + state_topic: "stat/studyroom_ceiling_lamp/POWER" + command_topic: "cmnd/studyroom_ceiling_lamp/POWER" + payload_on: "ON" + payload_off: "OFF" + optimistic: false + qos: 1 + retain: false +- platform: mqtt + name: "Snowboard" + state_topic: "stat/rosie_socket/POWER" + command_topic: "cmnd/rosie_socket/POWER" + payload_on: "ON" + payload_off: "OFF" + optimistic: false + qos: 1 + retain: false +- platform: mqtt + name: "Storageroom Ceiling Lamp" + state_topic: "stat/storageroom_ceiling_lamp/POWER" + command_topic: "cmnd/storageroom_ceiling_lamp/POWER" + payload_on: "ON" + payload_off: "OFF" + optimistic: false + qos: 1 + retain: false +- platform: mqtt + name: "Studyroom Lamp" + state_topic: "stat/studyroom_lamp/POWER" + command_topic: "cmnd/studyroom_lamp/POWER" + payload_on: "ON" + payload_off: "OFF" + optimistic: false + qos: 1 + retain: false +#- platform: mqtt +# name: "Snowboard Lamp" +# state_topic: "stat/snowboard_lamp/POWER" +# command_topic: "cmnd/snowboard_lamp/POWER" +# payload_on: "ON" +# payload_off: "OFF" +# optimistic: false +# qos: 1 +# retain: false +- platform: mqtt + name: "Livingroom Ceiling" + state_topic: "stat/livingroom_ceiling_lamp/POWER" + command_topic: "cmnd/livingroom_ceiling_lamp/POWER" + payload_on: "ON" + payload_off: "OFF" + optimistic: false + qos: 1 + retain: false +- platform: mqtt + name: "Livingroom Large Lamp" + state_topic: "stat/livingroom_large_lamp/POWER" + command_topic: "cmnd/livingroom_large_lamp/POWER" + payload_on: "ON" + payload_off: "OFF" + optimistic: false + qos: 1 + retain: false +- platform: mqtt + name: "Livingroom Small Lamp" + state_topic: "stat/livingroom_small_lamp/POWER" + command_topic: "cmnd/livingroom_small_lamp/POWER" + payload_on: "ON" + payload_off: "OFF" + optimistic: false + qos: 1 + retain: false +- platform: mqtt + name: "Lobby Ceiling" + state_topic: "stat/lobby_ceiling/POWER" + command_topic: "cmnd/lobby_ceiling/POWER" + payload_on: "ON" + payload_off: "OFF" + optimistic: false + qos: 1 + retain: false + diff --git a/travis-secrets.yaml b/travis-secrets.yaml new file mode 100644 index 00000000..8203a6ce --- /dev/null +++ b/travis-secrets.yaml @@ -0,0 +1,31 @@ +homeassistant_latitude: 0.0000 +homeassistant_longitude: 0.0000 +homeassistant_elevation: 00 +homeassistant_timezone: America/Los_Angeles +homeassistant_password: xxxxxxxxxxxxxxxxxxx +homeassistant_url: travis.secret.com +homeassistant_host_ip: 192.168.0.1 + +mqtt_host: mqtthost +mqtt_client_id: clientid +mqtt_user: +mqtt_pass: + +db_url: mysql://xxxxx:xxxxx@127.0.0.1/hass_db?charset=utf8 + +xiaomi_aqara_key: xxxxxxxxxxxxxxxx + +denon_ip: 192.168.0.2 + +kodi_ip: 192.168.0.3 + +darsky_api_key: 3144adb8b9cc2493517dcf211be1b8bd + +slack_api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + +work_latitude: 0.00000 +work_longitude: 0.00000 + +user_two_name: xxxxxxxxxxxxxx +user_two_latitude: 0.00000 +user_two_longitude: 0.00000 \ No newline at end of file diff --git a/zone.yaml b/zone.yaml new file mode 100644 index 00000000..4cf91488 --- /dev/null +++ b/zone.yaml @@ -0,0 +1,17 @@ +- name: Home + latitude: !secret homeassistant_latitude + longitude: !secret homeassistant_longitude + radius: 450 + icon: mdi:home + +- name: Work + latitude: !secret work_latitude + longitude: !secret work_longitude + radius: 150 + icon: mdi:domain + +- name: !secret user_two_name + latitude: !secret user_two_latitude + longitude: !secret user_two_longitude + radius: 150 + icon: mdi:home \ No newline at end of file