commit 8e94557f607f0bd05057c1b158ecb9fd71e86929 Author: Christian Kauer Date: Tue Nov 2 19:38:26 2021 +0100 initial checkin diff --git a/.HA_VERSION b/.HA_VERSION new file mode 100644 index 0000000..57ca1b6 --- /dev/null +++ b/.HA_VERSION @@ -0,0 +1 @@ +2021.10.6 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd62d4c --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/*.log +/home-assistant.log.1 +/home-assistant.log.fault +/home-assistant_v2.db-wal +/home-assistant_v2.db +/home-assistant_v2.db-shm +/.storage diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a04b218 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "*.yaml": "home-assistant" + } +} \ No newline at end of file diff --git a/automations.yaml b/automations.yaml new file mode 100644 index 0000000..76cf6d9 --- /dev/null +++ b/automations.yaml @@ -0,0 +1,18 @@ +- id: '1635708587790' + alias: Außenbeleuchtung einschalten + description: '' + trigger: + - platform: sun + event: sunset + offset: -00:30:00 + condition: + - condition: time + before: '22:00' + action: + - service: telegram_bot.send_message + data: + title: Sonnenuntergang + message: Außenbeleuchtung wird eingeschaltet {"message":"Darksky:{{states('sun.sun')}}"} + target: -391668323 + message_tag: '' + mode: single diff --git a/automations/system/start_notification.yaml b/automations/system/start_notification.yaml new file mode 100644 index 0000000..0b87df0 --- /dev/null +++ b/automations/system/start_notification.yaml @@ -0,0 +1,14 @@ +description: Send notification on Home Assistant start +alias: system_start_notification +id: 104463f6-7524-48d9-bbe5-2bb09017e946 +mode: single +trigger: + platform: homeassistant + event: start +action: + - service: notify.dev_telegram + data: + message: Home Assistant is starting up again + # - service: notify.chk_telegram + # data: + # message: Home Assistant is starting up again \ No newline at end of file diff --git a/blueprints/automation/homeassistant/motion_light.yaml b/blueprints/automation/homeassistant/motion_light.yaml new file mode 100644 index 0000000..54a4a4f --- /dev/null +++ b/blueprints/automation/homeassistant/motion_light.yaml @@ -0,0 +1,54 @@ +blueprint: + name: Motion-activated Light + description: Turn on a light when motion is detected. + domain: automation + source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml + input: + motion_entity: + name: Motion Sensor + selector: + entity: + domain: binary_sensor + device_class: motion + light_target: + name: Light + selector: + target: + entity: + domain: light + no_motion_wait: + name: Wait time + description: Time to leave the light on after last motion is detected. + default: 120 + selector: + number: + min: 0 + max: 3600 + unit_of_measurement: seconds + +# If motion is detected within the delay, +# we restart the script. +mode: restart +max_exceeded: silent + +trigger: + platform: state + entity_id: !input motion_entity + from: "off" + to: "on" + +action: + - alias: "Turn on the light" + service: light.turn_on + target: !input light_target + - alias: "Wait until there is no motion from device" + wait_for_trigger: + platform: state + entity_id: !input motion_entity + from: "on" + to: "off" + - alias: "Wait the number of seconds that has been set" + delay: !input no_motion_wait + - alias: "Turn off the light" + service: light.turn_off + target: !input light_target diff --git a/blueprints/automation/homeassistant/notify_leaving_zone.yaml b/blueprints/automation/homeassistant/notify_leaving_zone.yaml new file mode 100644 index 0000000..71abf8f --- /dev/null +++ b/blueprints/automation/homeassistant/notify_leaving_zone.yaml @@ -0,0 +1,44 @@ +blueprint: + name: Zone Notification + description: Send a notification to a device when a person leaves a specific zone. + domain: automation + source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/notify_leaving_zone.yaml + input: + person_entity: + name: Person + selector: + entity: + domain: person + zone_entity: + name: Zone + selector: + entity: + domain: zone + notify_device: + name: Device to notify + description: Device needs to run the official Home Assistant app to receive notifications. + selector: + device: + integration: mobile_app + +trigger: + platform: state + entity_id: !input person_entity + +variables: + zone_entity: !input zone_entity + # This is the state of the person when it's in this zone. + zone_state: "{{ states[zone_entity].name }}" + person_entity: !input person_entity + person_name: "{{ states[person_entity].name }}" + +condition: + condition: template + value_template: "{{ trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}" + +action: + - alias: "Notify that a person has left the zone" + domain: mobile_app + type: notify + device_id: !input notify_device + message: "{{ person_name }} has left {{ zone_state }}" diff --git a/blueprints/script/homeassistant/confirmable_notification.yaml b/blueprints/script/homeassistant/confirmable_notification.yaml new file mode 100644 index 0000000..d52e5a6 --- /dev/null +++ b/blueprints/script/homeassistant/confirmable_notification.yaml @@ -0,0 +1,84 @@ +blueprint: + name: Confirmable Notification + description: >- + A script that sends an actionable notification with a confirmation before + running the specified action. + domain: script + source_url: https://github.com/home-assistant/core/blob/master/homeassistant/components/script/blueprints/confirmable_notification.yaml + input: + notify_device: + name: Device to notify + description: Device needs to run the official Home Assistant app to receive notifications. + selector: + device: + integration: mobile_app + title: + name: "Title" + description: "The title of the button shown in the notification." + default: "" + selector: + text: + message: + name: "Message" + description: "The message body" + selector: + text: + confirm_text: + name: "Confirmation Text" + description: "Text to show on the confirmation button" + default: "Confirm" + selector: + text: + confirm_action: + name: "Confirmation Action" + description: "Action to run when notification is confirmed" + default: [] + selector: + action: + dismiss_text: + name: "Dismiss Text" + description: "Text to show on the dismiss button" + default: "Dismiss" + selector: + text: + dismiss_action: + name: "Dismiss Action" + description: "Action to run when notification is dismissed" + default: [] + selector: + action: + +mode: restart + +sequence: + - alias: "Set up variables" + variables: + action_confirm: "{{ 'CONFIRM_' ~ context.id }}" + action_dismiss: "{{ 'DISMISS_' ~ context.id }}" + - alias: "Send notification" + domain: mobile_app + type: notify + device_id: !input notify_device + title: !input title + message: !input message + data: + actions: + - action: "{{ action_confirm }}" + title: !input confirm_text + - action: "{{ action_dismiss }}" + title: !input dismiss_text + - alias: "Awaiting response" + wait_for_trigger: + - platform: event + event_type: mobile_app_notification_action + event_data: + action: "{{ action_confirm }}" + - platform: event + event_type: mobile_app_notification_action + event_data: + action: "{{ action_dismiss }}" + - choose: + - conditions: "{{ wait.trigger.event.data.action == action_confirm }}" + sequence: !input confirm_action + - conditions: "{{ wait.trigger.event.data.action == action_dismiss }}" + sequence: !input dismiss_action diff --git a/configuration.yaml b/configuration.yaml new file mode 100644 index 0000000..1ee88a5 --- /dev/null +++ b/configuration.yaml @@ -0,0 +1,20 @@ +homeassistant: + # Load packages + packages: !include_dir_named integrations + + + + +# Configure a default setup of Home Assistant (frontend, api, etc) +default_config: + +# Text to speech +tts: + - platform: google_translate + +#group: !include groups.yaml +#automation: !include automations.yaml +#script: !include scripts.yaml +scene: !include scenes.yaml + + diff --git a/entities/lights/attic_ceiling_spots.yaml b/entities/lights/attic_ceiling_spots.yaml new file mode 100644 index 0000000..3d2d53c --- /dev/null +++ b/entities/lights/attic_ceiling_spots.yaml @@ -0,0 +1,11 @@ +# https://www.home-assistant.io/integrations/light.group/ +# +platform: group +name: Deckenstrahler +unique_id: 89e0b395-1c3b-4646-b0bb-101d77e1d867 +entities: + - light.hue_color_spot_1 + - light.hue_color_spot_2 + - light.hue_color_spot_3 + - light.hue_color_spot_4 + diff --git a/entities/lights/dining_room.yaml b/entities/lights/dining_room.yaml new file mode 100644 index 0000000..a88f8d0 --- /dev/null +++ b/entities/lights/dining_room.yaml @@ -0,0 +1,8 @@ +# https://www.home-assistant.io/integrations/light.group/ +# +platform: group +name: Esszimmerlichter +unique_id: 89e0b396-1c3b-4646-b0bb-101d77e1d862 +entities: + - light.licht_esszimmer_tisch + - light.licht_esszimmer_wand diff --git a/entities/lights/dining_room_sw1.yaml b/entities/lights/dining_room_sw1.yaml new file mode 100644 index 0000000..e4c6dff --- /dev/null +++ b/entities/lights/dining_room_sw1.yaml @@ -0,0 +1,9 @@ +# https://www.home-assistant.io/integrations/light.group/ +# +# switch als Licht einbinden, so dass eine Grupperung als light möglich ist +# https://community.home-assistant.io/t/light-groups-making-me-crazy/180978/6 +platform: switch +name: Licht Esszimmer Wand +entity_id: switch.double_switch_node9_3 + + diff --git a/entities/lights/dining_room_sw2.yaml b/entities/lights/dining_room_sw2.yaml new file mode 100644 index 0000000..c627de6 --- /dev/null +++ b/entities/lights/dining_room_sw2.yaml @@ -0,0 +1,9 @@ +# https://www.home-assistant.io/integrations/light.group/ +# +# switch als Licht einbinden, so dass eine Grupperung als light möglich ist +# https://community.home-assistant.io/t/light-groups-making-me-crazy/180978/6 +platform: switch +name: Licht Esszimmer Tisch +entity_id: switch.double_switch_node9_2_2 + + diff --git a/entities/lights/kitchen.yaml b/entities/lights/kitchen.yaml new file mode 100644 index 0000000..241d3fd --- /dev/null +++ b/entities/lights/kitchen.yaml @@ -0,0 +1,8 @@ +# https://www.home-assistant.io/integrations/light.group/ +# +platform: group +name: Küchenlichter +unique_id: 89e0b395-1c3b-4646-b0bb-101d77e1d862 +entities: + - light.kitchen1 + - light.kitchen2 diff --git a/entities/lights/kitchen_sw1.yaml b/entities/lights/kitchen_sw1.yaml new file mode 100644 index 0000000..2c45be3 --- /dev/null +++ b/entities/lights/kitchen_sw1.yaml @@ -0,0 +1,9 @@ +# https://www.home-assistant.io/integrations/light.group/ +# +# switch als Licht einbinden, so dass eine Grupperung als light möglich ist +# https://community.home-assistant.io/t/light-groups-making-me-crazy/180978/6 +platform: switch +name: Licht Küche Gaube +entity_id: switch.double_switch_node18_6 + + diff --git a/entities/lights/kitchen_sw2.yaml b/entities/lights/kitchen_sw2.yaml new file mode 100644 index 0000000..02a44f7 --- /dev/null +++ b/entities/lights/kitchen_sw2.yaml @@ -0,0 +1,7 @@ +# https://www.home-assistant.io/integrations/group/ +# +# switch als Licht einbinden, so dass eine Grupperung als light möglich ist +# https://community.home-assistant.io/t/light-groups-making-me-crazy/180978/6 +platform: switch +name: Licht Küche Herd +entity_id: switch.double_switch_node18_2_5 \ No newline at end of file diff --git a/entities/lights/living_room.yaml b/entities/lights/living_room.yaml new file mode 100644 index 0000000..98543d5 --- /dev/null +++ b/entities/lights/living_room.yaml @@ -0,0 +1,9 @@ +# https://www.home-assistant.io/integrations/light.group/ +# +platform: group +name: Wohnzimmerlichter +unique_id: 81e0b395-1c3b-4646-b0bb-101d77e1d862 +entities: + - light.hue_color_spot_5 + - light.hue_color_spot_6 + - light.hue_color_spot_7 diff --git a/entities/lights/living_room_socket1.yaml b/entities/lights/living_room_socket1.yaml new file mode 100644 index 0000000..89c4c87 --- /dev/null +++ b/entities/lights/living_room_socket1.yaml @@ -0,0 +1,9 @@ +# https://www.home-assistant.io/integrations/light.group/ +# +# switch als Licht einbinden, so dass eine Grupperung als light möglich ist +# https://community.home-assistant.io/t/light-groups-making-me-crazy/180978/6 +platform: switch +name: Stricklicht +entity_id: switch.nas_wr01z_node21 + + diff --git a/entities/notifiers/chk_telegram.yaml b/entities/notifiers/chk_telegram.yaml new file mode 100644 index 0000000..cd3621e --- /dev/null +++ b/entities/notifiers/chk_telegram.yaml @@ -0,0 +1,6 @@ +# Notifier for Telegram to Christian +# https://www.home-assistant.io/integrations/notify/ +# +name: chk_telegram +platform: telegram +chat_id: !secret telegram_chk \ No newline at end of file diff --git a/entities/notifiers/dev_telegram.yaml b/entities/notifiers/dev_telegram.yaml new file mode 100644 index 0000000..777d1ec --- /dev/null +++ b/entities/notifiers/dev_telegram.yaml @@ -0,0 +1,5 @@ +# Notifier for Telegram-Gruppe DEV-Gruppe (openhab) +# https://www.home-assistant.io/integrations/notify/ +name: dev_telegram +platform: telegram +chat_id: !secret telegram_dev \ No newline at end of file diff --git a/groups.yaml b/groups.yaml new file mode 100644 index 0000000..e69de29 diff --git a/integrations/alexa.yaml b/integrations/alexa.yaml new file mode 100644 index 0000000..da78bb5 --- /dev/null +++ b/integrations/alexa.yaml @@ -0,0 +1,3 @@ +# https://www.home-assistant.io/integrations/alexa.smart_home/#test-the-lambda-function +alexa: + smart_home: \ No newline at end of file diff --git a/integrations/automation.yaml b/integrations/automation.yaml new file mode 100644 index 0000000..15b6e23 --- /dev/null +++ b/integrations/automation.yaml @@ -0,0 +1,4 @@ +# https://www.home-assistant.io/docs/automation/ +# +automation: !include ../automations.yaml +automation split: !include_dir_list ../automations \ No newline at end of file diff --git a/integrations/groups.yaml b/integrations/groups.yaml new file mode 100644 index 0000000..ea60094 --- /dev/null +++ b/integrations/groups.yaml @@ -0,0 +1,4 @@ +# https://www.home-assistant.io/integrations/group/ +# +group: !include ../groups.yaml +group split: !include_dir_named ../entities/groups \ No newline at end of file diff --git a/integrations/http.yaml b/integrations/http.yaml new file mode 100644 index 0000000..ea3baf7 --- /dev/null +++ b/integrations/http.yaml @@ -0,0 +1,7 @@ +http: + ssl_certificate: /ssl/cert.pem + ssl_key: /ssl/privkey.pem + use_x_forwarded_for: true + trusted_proxies: + - 192.168.178.70 + - 127.0.0.1 \ No newline at end of file diff --git a/integrations/light.yaml b/integrations/light.yaml new file mode 100644 index 0000000..5bfa422 --- /dev/null +++ b/integrations/light.yaml @@ -0,0 +1,3 @@ +# https://www.home-assistant.io/integrations/light/ +# +light: !include_dir_list ../entities/lights \ No newline at end of file diff --git a/integrations/notify.yaml b/integrations/notify.yaml new file mode 100644 index 0000000..e99f4b9 --- /dev/null +++ b/integrations/notify.yaml @@ -0,0 +1,3 @@ +# https://www.home-assistant.io/integrations/notify/ +# +notify: !include_dir_list ../entities/notifiers \ No newline at end of file diff --git a/integrations/script.yaml b/integrations/script.yaml new file mode 100644 index 0000000..d1eb602 --- /dev/null +++ b/integrations/script.yaml @@ -0,0 +1,10 @@ +--- +# The script integration allows users to specify a sequence of actions to be +# executed by Home Assistant when turned on. +# +# This loads up my custom scripts. +# +# https://www.home-assistant.io/integrations/script/ +# +script: !include ../scripts.yaml +script split: !include_dir_named ../scripts \ No newline at end of file diff --git a/integrations/telegram_bot.yaml b/integrations/telegram_bot.yaml new file mode 100644 index 0000000..4e945c4 --- /dev/null +++ b/integrations/telegram_bot.yaml @@ -0,0 +1,9 @@ +# Telegram Integration +# https://www.home-assistant.io/integrations/telegram_bot/ + +telegram_bot: + - platform: polling + api_key: !secret telegram_api_key + allowed_chat_ids: + - !secret telegram_dev # dev chat + - !secret telegram_chk # christian \ No newline at end of file diff --git a/scenes.yaml b/scenes.yaml new file mode 100644 index 0000000..e69de29 diff --git a/scripts.yaml b/scripts.yaml new file mode 100644 index 0000000..7b35d5c --- /dev/null +++ b/scripts.yaml @@ -0,0 +1,8 @@ +script_test1: + alias: Skript Test1 + sequence: + - service: telegram_bot.send_message + data: + message: test from script 1 + target: -391668323 + mode: single diff --git a/scripts/telegram_test.yaml b/scripts/telegram_test.yaml new file mode 100644 index 0000000..8d8af54 --- /dev/null +++ b/scripts/telegram_test.yaml @@ -0,0 +1,15 @@ +alias: Telegram Test1 +sequence: + - service: telegram_bot.send_message + data: + message: test from Telegram Test1 + arget: -391668323 +mode: single + +# alias: Telegram Test1 +# mode: single +# sequence: +# - service: telegram_bot.send_message +# data: +# message: Sonne17 +# target: -391668323 \ No newline at end of file diff --git a/secrets.yaml b/secrets.yaml new file mode 100644 index 0000000..dff5f53 --- /dev/null +++ b/secrets.yaml @@ -0,0 +1,9 @@ + +# Use this file to store secrets like usernames and passwords. +# Learn more at https://www.home-assistant.io/docs/configuration/secrets/ +some_password: welcome + + +telegram_api_key: 448772521:AAHIIrXBVEUF7_1zYRCmGo5YHipRJyBlp7o +telegram_dev: -391668323 +telegram_chk: 14652347 \ No newline at end of file diff --git a/tts/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3_en_-_google_translate.mp3 b/tts/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3_en_-_google_translate.mp3 new file mode 100644 index 0000000..709f232 Binary files /dev/null and b/tts/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3_en_-_google_translate.mp3 differ