From 6ddde5c197f9027d94556fa6f43dc5404cb7ef28 Mon Sep 17 00:00:00 2001 From: Denys Dovhan Date: Thu, 17 Oct 2024 16:51:28 +0300 Subject: [PATCH] Migrate integration for new home --- configuration.yaml | 9 ++ integrations/alarm_control_panel.yaml | 11 --- integrations/automation.yaml | 14 --- integrations/binary_sensor.yaml | 20 ---- integrations/camera.yaml | 29 ------ integrations/climate.yaml | 14 --- integrations/frontend.yaml | 7 -- integrations/google_assistant.yaml | 67 ------------- integrations/groups.yaml | 13 --- integrations/http.yaml | 0 integrations/logger.yaml | 32 ------- integrations/media_player.yaml | 1 + integrations/multiscrape.yaml | 32 ++++++- integrations/notify.yaml | 27 +++--- integrations/plant.yaml | 20 ---- integrations/powercalc.yaml | 0 integrations/scenes.yaml | 132 -------------------------- integrations/script.yaml | 9 -- integrations/sensor.yaml | 55 +---------- integrations/template.yaml | 29 ------ integrations/tts.yaml | 10 -- integrations/zone.yaml | 14 --- 22 files changed, 51 insertions(+), 494 deletions(-) mode change 100755 => 100644 configuration.yaml delete mode 100755 integrations/alarm_control_panel.yaml delete mode 100755 integrations/automation.yaml delete mode 100755 integrations/binary_sensor.yaml delete mode 100755 integrations/camera.yaml delete mode 100755 integrations/climate.yaml delete mode 100755 integrations/frontend.yaml delete mode 100755 integrations/google_assistant.yaml delete mode 100755 integrations/groups.yaml mode change 100755 => 100644 integrations/http.yaml delete mode 100755 integrations/logger.yaml mode change 100755 => 100644 integrations/media_player.yaml mode change 100755 => 100644 integrations/notify.yaml delete mode 100755 integrations/plant.yaml mode change 100755 => 100644 integrations/powercalc.yaml delete mode 100755 integrations/scenes.yaml delete mode 100755 integrations/script.yaml mode change 100755 => 100644 integrations/sensor.yaml delete mode 100755 integrations/template.yaml delete mode 100755 integrations/tts.yaml delete mode 100755 integrations/zone.yaml diff --git a/configuration.yaml b/configuration.yaml old mode 100755 new mode 100644 index 4384ffb..ed82a80 --- a/configuration.yaml +++ b/configuration.yaml @@ -8,6 +8,10 @@ # Configure a default setup of Home Assistant (frontend, api, etc) default_config: +# Loading frontend themes +frontend: + themes: !include_dir_merge_named ../themes + # Load Home Assistant integrations as packages homeassistant: # Load customizations @@ -15,3 +19,8 @@ homeassistant: customize: !include customize.yaml # Load packages packages: !include_dir_named integrations + +# Root-level staff +automation: !include automations.yaml +script: !include scripts.yaml +scene: !include scenes.yaml diff --git a/integrations/alarm_control_panel.yaml b/integrations/alarm_control_panel.yaml deleted file mode 100755 index bb09ccd..0000000 --- a/integrations/alarm_control_panel.yaml +++ /dev/null @@ -1,11 +0,0 @@ -# -# Manual Alarm Control Panel -# -# https://www.home-assistant.io/integrations/manual/ -# - -alarm_control_panel: - - platform: manual - name: Home Alarm - arming_time: 0 - delay_time: 0 diff --git a/integrations/automation.yaml b/integrations/automation.yaml deleted file mode 100755 index c53675b..0000000 --- a/integrations/automation.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# -# Automations -# -# https://www.home-assistant.io/docs/automation/ -# - -# This file is used by automation editor in the UI. -# However, it's helpful to test some simple automations in there. -# -# automations.yaml file in the root exists for editor to work. -automation: !include ../automations.yaml - -# My automations are stored in automations folder. -automation split: !include_dir_merge_list ../automations diff --git a/integrations/binary_sensor.yaml b/integrations/binary_sensor.yaml deleted file mode 100755 index a3058cd..0000000 --- a/integrations/binary_sensor.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# -# Binary Sensor -# -# https://www.home-assistant.io/integrations/binary_sensor/ -# - -binary_sensor: - # Car Wash - - platform: car_wash - weather: weather.forecast_nyvky - # Winter Tires - - platform: snowtire - weather: weather.forecast_nyvky - # Fayna Town Electricity - - platform: rest - name: Fayna Electricity - resource: https://light.fayna.town - device_class: power - scan_interval: 60 - value_template: "{{ 'Шось темно' not in value and 'Світла нема' not in value }}" diff --git a/integrations/camera.yaml b/integrations/camera.yaml deleted file mode 100755 index 0c4f892..0000000 --- a/integrations/camera.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Camera -# -# https://www.home-assistant.io/integrations/camera/ -# - -camera: - - platform: ffmpeg - name: Home Camera - input: !secret home_camera_stream - - # IMPORTANT - # Public cameras are disabled because of a Russian rocket strikes - - # - platform: ffmpeg - # name: chernivtsi_landscape - # input: http://langate.tv/camera360/tracks-v1/mono.m3u8 - - # - platform: ffmpeg - # name: chernivtsi_filarmonia - # input: http://langate.tv/filarmonia/tracks-v1/mono.m3u8 - - # - platform: ffmpeg - # name: kyiv_sofiyska - # input: http://vps.guru.ua/hls/sofi8212.m3u8 - - # - platform: ffmpeg - # name: kyiv_mykhailivska - # input: http://vps.guru.ua/hls/mihaylovskaya2812.m3u8 diff --git a/integrations/climate.yaml b/integrations/climate.yaml deleted file mode 100755 index ce125d8..0000000 --- a/integrations/climate.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# -# Binary Sensor -# -# https://www.home-assistant.io/integrations/climate -# - -climate: - - platform: generic_thermostat - name: Balcony Heater - heater: switch.balcony_heater - target_sensor: sensor.balcony_conditions_sensor_temperature - precision: 0.5 - min_temp: 15 - max_temp: 30 diff --git a/integrations/frontend.yaml b/integrations/frontend.yaml deleted file mode 100755 index 996e515..0000000 --- a/integrations/frontend.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# -# Frontend -# -# https://www.home-assistant.io/integrations/frontend/ -# -frontend: - themes: !include_dir_merge_named ../themes diff --git a/integrations/google_assistant.yaml b/integrations/google_assistant.yaml deleted file mode 100755 index 2863bec..0000000 --- a/integrations/google_assistant.yaml +++ /dev/null @@ -1,67 +0,0 @@ -# -# Google Assistant -# -# https://www.home-assistant.io/integrations/google_assistant/ -# - -google_assistant: - project_id: !secret google_project_id - service_account: !include ../GA_SERVICE_ACCOUNT.json - report_state: true - exposed_domains: - - light - - input_boolean - - scene - - vacuum - - fan - - switch - - script - - climate - - humidifier - entity_config: - media_player.playstation_5: - expose: true - aliases: - - ps5 - - playstation - media_player.samsung_tv: - expose: true - - # ---------------------------------- - # Prevent exposing specific entities - # ---------------------------------- - - # Transmission - switch.transmission_turtle_mode: - expose: false - switch.transmission_switch: - expose: false - # Adaptive Lighting - switch.adaptive_lighting_adapt_brightness_home: - expose: false - switch.adaptive_lighting_adapt_color_home: - expose: false - switch.adaptive_lighting_sleep_mode_home: - expose: false - # ACs - switch.bedroom_ac_beeper: - expose: false - switch.living_room_ac_beeper: - expose: false - # Thermostats - switch.living_room_heater_auto_lock: - expose: false - switch.living_room_heater_away_mode: - expose: false - switch.living_room_heater_window_detection: - expose: false - switch.living_room_heater_valve_detection: - expose: false - switch.bedroom_heater_auto_lock: - expose: false - switch.bedroom_heater_away_mode: - expose: false - switch.bedroom_heater_window_detection: - expose: false - switch.bedroom_heater_valve_detection: - expose: false diff --git a/integrations/groups.yaml b/integrations/groups.yaml deleted file mode 100755 index b9388c5..0000000 --- a/integrations/groups.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# -# Group -# -# https://www.home-assistant.io/integrations/group/ -# - -group: - family: - name: Family - icon: mdi:home-heart - entities: - - person.denys - - person.marry diff --git a/integrations/http.yaml b/integrations/http.yaml old mode 100755 new mode 100644 diff --git a/integrations/logger.yaml b/integrations/logger.yaml deleted file mode 100755 index fd63fff..0000000 --- a/integrations/logger.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Logger -# -# https://www.home-assistant.io/integrations/logger/ -# - -logger: - default: warning - filters: - libav.hls: - # Cameras sometimes have ivalid timestampts - - 'Invalid timestamps stream=0, pts=' - - pyhap.characteristic: - # Humidifier's target temperatur is sometimes 0 during the startup. - - 'TargetHumidifierDehumidifierState: value=0 is an invalid value.' - - homeassistant.components.camera: - # Vacuum Map sometimes takes longer to update. - - 'Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval' - - homeassistant.components.mqtt.number: - # Calibration values sometimes go out of range. That's a valve's bug. - - '_heater_local_temperature_calibration:' - - homeassistant.components.stream: - # Live city cameras are often go offline. That is not a problem. - - 'Error from stream worker: Error opening stream http://vps.guru.ua' - - homeassistant.helpers.entity: - # Vacuum Map sometime take more time to update. - - 'Update of camera.roborock_live_map is taking over 10 seconds' diff --git a/integrations/media_player.yaml b/integrations/media_player.yaml old mode 100755 new mode 100644 index 09a7153..71ca8a5 --- a/integrations/media_player.yaml +++ b/integrations/media_player.yaml @@ -7,6 +7,7 @@ media_player: - platform: universal name: PlayStation 5 + unique_id: playstation_5 attributes: state: sensor.playstation_5_activity power: sensor.playstation_5_activity|power diff --git a/integrations/multiscrape.yaml b/integrations/multiscrape.yaml index 4cef1d0..b0ef28b 100644 --- a/integrations/multiscrape.yaml +++ b/integrations/multiscrape.yaml @@ -18,16 +18,19 @@ multiscrape: value_template: >- {% set message = value.split("|||") | last | lower %} {% set in_kyiv = "київ" in message or "святошин" in message %} - {% set danger_now = "київ — уважно" in message + {% set danger_now = "київ — увага" in message or "київ — укриття" in message or "київ, укриття" in message + or "київ — уважно" in message or "київ, уважно" in message or "київ укриття не лишає" in message or "київ — будьте в укриттях" in message or "швидкісна ціль" in message or "подалі від зовнішніх стін" in message or "безпечних місцях" in message + or "спуск балістики" in message or "кинджал у напрямку" in message + or "пуск кинджалу" in message or "кинджал на" in message %} {{ danger_now and in_kyiv }} @@ -60,18 +63,21 @@ multiscrape: select_list: '.js-message_text' value_template: > {% set message = value.split("|||") | last | lower %} - {% set danger_indicator = "🔴" in message %} - {% set in_kyiv = "київ" in message or "святошин" in message %} + {% set nearby = "київ" in message + or "святошин" in message + or "шевченківський" in message + or "академмістечко" in message%} {% set danger_now = "київ!" in message or "буде гучно" in message or "бути гучно" in message or "в укриття" in message + or "перебувайте в укритті" in message or "кинджал на" in message or "балістика на" in message or "київ ракета" in message or "на київ заходять ракети" in message %} - {{ danger_indicator and danger_now and in_kyiv }} + {{ danger_now and nearby }} attributes: - name: latest_message select_list: '.js-message_text' @@ -89,3 +95,21 @@ multiscrape: - name: latest_message select_list: '.js-message_text' value_template: "{{ value.split('|||') | last }}" + + - name: Ukrenergo + resource: https://t.me/s/Ukrenergo?q=увага%2Bвідключення + scan_interval: 600 + list_separator: '|||' + sensor: + - unique_id: ukrenergo_telegram + name: Ukrenergo Telegram + icon: mdi:rocket-launch + device_class: date + select_list: '.js-message_info time' + attribute: datetime + value_template: > + {{ value.split("|||") | last | as_datetime }} + attributes: + - name: latest_message + select_list: '.js-message_text' + value_template: "{{ value.split('|||') | last }}" diff --git a/integrations/notify.yaml b/integrations/notify.yaml old mode 100755 new mode 100644 index 4e9296c..d7bade9 --- a/integrations/notify.yaml +++ b/integrations/notify.yaml @@ -1,25 +1,20 @@ +# +# Logger +# +# https://www.home-assistant.io/integrations/notify/ +# + notify: - - platform: html5 - name: web - vapid_pub_key: !secret html5_notify_pub_key - vapid_prv_key: !secret html5_notify_prv_key - vapid_email: !secret html5_notify_email # Groups - name: denys platform: group services: - service: mobile_app_denyss_iphone - - service: mobile_app_denyss_ipad - - service: mobile_app_wix_macbook_pro - - name: marry + # - service: mobile_app_denyss_ipad + - service: mobile_app_ua_jg9hyqw3q0 + - name: maria platform: group services: - service: mobile_app_iphone_maria - - service: mobile_app_home_macbook_pro - - service: mobile_app_marry_macbook_pro - - name: all - platform: group - services: - - service: web - - service: denys - - service: marry + # - service: mobile_app_home_macbook_pro + # - service: mobile_app_marry_macbook_pro diff --git a/integrations/plant.yaml b/integrations/plant.yaml deleted file mode 100755 index 93d944a..0000000 --- a/integrations/plant.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# -# Plant -# -# https://www.home-assistant.io/integrations/plant/ -# - -plant: - plant: - sensors: - moisture: sensor.plant_moisture - temperature: sensor.plant_temperature - conductivity: sensor.plant_conductivity - brightness: sensor.plant_illuminance - min_temperature: 12 - max_temperature: 32 - min_conductivity: 350 - max_conductivity: 2000 - min_brightness: 800 - max_brightness: 15000 - check_days: 10 diff --git a/integrations/powercalc.yaml b/integrations/powercalc.yaml old mode 100755 new mode 100644 diff --git a/integrations/scenes.yaml b/integrations/scenes.yaml deleted file mode 100755 index 392d16e..0000000 --- a/integrations/scenes.yaml +++ /dev/null @@ -1,132 +0,0 @@ -# -# Scene -# -# https://www.home-assistant.io/integrations/scene/ -# - -# This file exists for UI editor to work. -scene: !include ../scenes.yaml - -# Scenes defined in YAML -scene split: - - id: lights_out - name: Lights Out - entities: - light.bedroom_bed_lights: - state: off - light.bedroom_floor_lamp: - state: off - light.bedroom_ceiling_light: - state: off - light.living_room_tv_lights: - state: off - light.living_room_main_light: - state: off - light.living_room_table_lights: - state: off - light.desk_lamp: - state: off - light.corridor_light: - state: off - light.kitchen_lightstrip: - state: off - light.kitchen_spotlights: - state: off - - - id: night_lights - name: Night Lights - entities: - light.bedroom_bed_lights: - state: on - light.bedroom_floor_lamp: - state: on - brightness: 1 - rgb_color: [255, 0, 255] - light.bedroom_ceiling_light: - state: off - light.living_room_tv_lights: - state: on - light.living_room_main_light: - state: off - light.living_room_table_lights: - state: off - light.corridor_light: - state: off - light.kitchen_lightstrip: - state: on - light.kitchen_spotlights: - state: off - - - id: evening_lights - name: Evening Lights - entities: - light.bedroom_bed_lights: - state: on - light.bedroom_floor_lamp: - state: on - effect: Slowdown - flowing: true - light.bedroom_ceiling_light: - state: off - light.living_room_tv_lights: - state: on - light.living_room_main_light: - state: off - light.living_room_table_lights: - state: on - brightness: 255 - color_temp: 220 - light.kitchen_lightstrip: - state: on - light.kitchen_spotlights: - state: on - - - id: bright_lights - name: Bright Lights - entities: - light.bedroom_bed_lights: - state: on - light.bedroom_floor_lamp: - state: on - brightness: 255 - color_temp: 240 - light.bedroom_ceiling_light: - state: on - brightness: 255 - light.living_room_tv_lights: - state: on - light.living_room_main_light: - state: on - brightness: 255 - light.living_room_table_lights: - state: on - brightness: 255 - color_temp: 240 - light.kitchen_lightstrip: - state: on - light.kitchen_spotlights: - state: on - ligth.corridor_light: - state: on - - - id: sleeping_lights - name: Sleeping Lights - entities: - light.bedroom_bed_lights: - state: off - light.bedroom_floor_lamp: - state: on - brightness: 1 - rgb_color: [255, 0, 0] - light.bedroom_ceiling_light: - state: off - light.living_room_tv_lights: - state: off - light.living_room_main_light: - state: off - light.living_room_table_lights: - state: off - light.kitchen_lightstrip: - state: off - light.kitchen_spotlights: - state: off diff --git a/integrations/script.yaml b/integrations/script.yaml deleted file mode 100755 index da6c75c..0000000 --- a/integrations/script.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# -# Script -# -# https://www.home-assistant.io/integrations/script/ -# - -script split: !include_dir_merge_named ../scripts - -script: !include ../scripts.yaml diff --git a/integrations/sensor.yaml b/integrations/sensor.yaml old mode 100755 new mode 100644 index 176a006..2581ccb --- a/integrations/sensor.yaml +++ b/integrations/sensor.yaml @@ -5,61 +5,9 @@ # sensor: - # Lun Misto - - platform: rest - name: Misto Lun - resource: https://api.meteostation.online/chrome/addon/informer/ - value_template: 'OK' - scan_interval: 300 # every 5 minutes - json_attributes: - - lunmisto_air - - tomtom_jams - - tomtom_temp - - # Lun Misto AQI - - platform: rest - name: Outdoor AQI - unit_of_measurement: 'AQI' - device_class: aqi - resource: https://misto.lun.ua/api/air/v1/public/data/ - value_template: >- - {% set station = '301' %} - {# #} - {% macro aqi(aqihigh, aqilow, conchigh, conclow, conc) -%} - {{ (aqilow + (conc - conclow) * (aqihigh - aqilow) / (conchigh - conclow)) | round }} - {%- endmacro %} - {# #} - {% for data in value_json %} - {% if data.station.name == station %} - {% set conc = data.particles[2].pm25 %} - {% if conc >= 0 and conc < 12 %} - {{ aqi(50, 0, 12, 0, conc) }} - {% elif conc >= 12 and conc < 35.5 %} - {{ aqi(100, 51, 35.5, 12, conc) }} - {% elif conc >= 35.5 and conc < 55.5 %} - {{ aqi(150, 101, 55.5, 35.5, conc) }} - {% elif conc >= 55.5 and conc < 150 %} - {{ aqi(200, 151, 150.5, 55.5, conc) }} - {% elif conc >= 150 and conc < 250.5 %} - {{ aqi(300, 201, 250.5, 150.5, conc) }} - {% elif conc >= 250.5 and conc < 350.5 %} - {{ aqi(400, 301, 350.5, 250.5, conc) }} - {% elif conc >= 350.5 and conc < 500.5 %} - {{ aqi(500, 401, 500.5, 350.5, conc) }} - {% else %} - unknown - {% endif %} - {% endif %} - {% endfor %} - scan_interval: 300 # every 5 minutes - json_attributes_path: "$.[?(@.station.name=='125')].particles[2]" - json_attributes: - - pm25 - - pm10 - - pm100 - # Electricity Outages Stats - platform: history_stats + unique_id: no_electricity_today name: No Electricity Today entity_id: binary_sensor.electricity state: 'off' @@ -68,6 +16,7 @@ sensor: duration: hours: 24 - platform: history_stats + unique_id: no_electricity_today_percent name: No Electricity Today Percent entity_id: binary_sensor.electricity state: 'off' diff --git a/integrations/template.yaml b/integrations/template.yaml deleted file mode 100755 index ef236dc..0000000 --- a/integrations/template.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Template -# -# https://www.home-assistant.io/integrations/template/ -# - -template: - - binary_sensor: - - name: Do Not Disturb Denys - state: >- - {% set camera_on = is_state('binary_sensor.wix_macbook_pro_camera_in_use', 'on') %} - {% set mic_on = is_state('binary_sensor.wix_macbook_pro_audio_input_in_use', 'on') %} - {% set focus_on = is_state('binary_sensor.denys_iphone_focus', 'on') %} - {% set sleep_on = is_state('binary_sensor.sleeping_time', 'on') %} - {% set at_home = is_state('person.denys', 'home') %} - {{ at_home and (camera_on or mic_on or focus_on or sleep_on) }} - icon: >- - {{ iif(is_state('binary_sensor.do_not_disturb_denys', 'on'), 'mdi:bell-off', 'mdi:bell') }} - - - name: Do Not Disturb Marry - state: >- - {% set camera_on = is_state('binary_sensor.marry_macbook_pro_camera_in_use', 'on') %} - {% set mic_on = is_state('binary_sensor.marry_macbook_pro_audio_input_in_use', 'on') %} - {% set focus_on = is_state('binary_sensor.iphone_maria_focus', 'on') %} - {% set sleep_on = is_state('binary_sensor.sleeping_time', 'on') %} - {% set at_home = is_state('person.marry', 'home') %} - {{ at_home and (camera_on or mic_on or focus_on or sleep_on) }} - icon: >- - {{ iif(is_state('binary_sensor.do_not_disturb_marry', 'on'), 'mdi:bell-off', 'mdi:bell') }} diff --git a/integrations/tts.yaml b/integrations/tts.yaml deleted file mode 100755 index 17574ed..0000000 --- a/integrations/tts.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# -# Text-to-Speech -# -# https://www.home-assistant.io/integrations/tts/ -# - -tts: - - platform: google_translate - service_name: google_say - language: uk # Ukrainian diff --git a/integrations/zone.yaml b/integrations/zone.yaml deleted file mode 100755 index 2facc3e..0000000 --- a/integrations/zone.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# -# Zone -# -# https://www.home-assistant.io/integrations/zone/ -# - -zone: - # Default home zone has only 100m radius - # Device trackers often end up out of this zone causing incorrect behavior - - name: Home - latitude: !secret latitude - longitude: !secret longitude - radius: 200 - icon: mdi:home