diff --git a/ha/ha_config/automations.yaml b/ha/ha_config/automations.yaml index 2dcabc8..ccff80b 100644 --- a/ha/ha_config/automations.yaml +++ b/ha/ha_config/automations.yaml @@ -14,44 +14,41 @@ - sat conditions: [] actions: - - action: rest_command.get_phone_weather - data: {} - response_variable: weather_data - variables: - max_temp: '{{weather_data.content.daily.temperature_2m_max[0]}}' - min_temp: '{{weather_data.content.daily.temperature_2m_min[0]}}' - temp_unit: '{{weather_data.content.daily_units.temperature_2m_max}}' - condition: "{% set code = weather_data.content.daily.weather_code[0] | int %} - {% set mapper = {\n 0: \"Clear sky\",\n 1: \"Mainly clear\",\n 2: \"Partly - cloudy\",\n 3: \"Overcast\",\n 45: \"Fog\",\n 48: \"Depositing rime fog\",\n - \ 51: \"Drizzle - Light intensity\",\n 53: \"Drizzle - Moderate intensity\",\n - \ 55: \"Drizzle - Dense intensity\",\n 56: \"Freezing Drizzle - Light intensity\",\n - \ 57: \"Freezing Drizzle - Dense intensity\",\n 61: \"Rain - Slight intensity\",\n - \ 63: \"Rain - Moderate intensity\",\n 65: \"Rain - Heavy intensity\",\n - \ 66: \"Freezing Rain - Light intensity\",\n 67: \"Freezing Rain - Heavy - intensity\",\n 71: \"Snow fall - Slight intensity\",\n 73: \"Snow fall - - Moderate intensity\",\n 75: \"Snow fall - Heavy intensity\",\n 77: \"Snow - grains\",\n 80: \"Rain showers - Slight intensity\",\n 81: \"Rain showers - - Moderate intensity\",\n 82: \"Rain showers - Violent intensity\",\n 85: - \"Snow showers - Slight intensity\",\n 86: \"Snow showers - Heavy intensity\",\n + high: '{{ state_attr(''sensor.daily_forecast'', ''temperature_2m_max'')[0] }}' + low: '{{ state_attr(''sensor.daily_forecast'', ''temperature_2m_min'')[0] }}' + temp_unit: '{{ state_attr(''sensor.units'', ''temperature_2m'') }}' + loc: '{{ state_attr(''sensor.alexs_iphone_2_geocoded_location'', ''Locality'') + }}, {{ state_attr(''sensor.alexs_iphone_2_geocoded_location'', ''Administrative + Area'') }}' + condition: "{% set code = state_attr('sensor.daily_forecast', 'weather_code')[0] + | int %} {% set mapper = {\n 0: \"Clear sky\",\n 1: \"Mainly clear\",\n + \ 2: \"Partly cloudy\",\n 3: \"Overcast\",\n 45: \"Fog\",\n 48: \"Depositing + rime fog\",\n 51: \"Drizzle - Light intensity\",\n 53: \"Drizzle - Moderate + intensity\",\n 55: \"Drizzle - Dense intensity\",\n 56: \"Freezing Drizzle + - Light intensity\",\n 57: \"Freezing Drizzle - Dense intensity\",\n 61: + \"Rain - Slight intensity\",\n 63: \"Rain - Moderate intensity\",\n 65: + \"Rain - Heavy intensity\",\n 66: \"Freezing Rain - Light intensity\",\n + \ 67: \"Freezing Rain - Heavy intensity\",\n 71: \"Snow fall - Slight intensity\",\n + \ 73: \"Snow fall - Moderate intensity\",\n 75: \"Snow fall - Heavy intensity\",\n + \ 77: \"Snow grains\",\n 80: \"Rain showers - Slight intensity\",\n 81: + \"Rain showers - Moderate intensity\",\n 82: \"Rain showers - Violent intensity\",\n + \ 85: \"Snow showers - Slight intensity\",\n 86: \"Snow showers - Heavy intensity\",\n \ 95: \"Thunderstorm - Slight intensity\",\n 96: \"Thunderstorm with slight hail\",\n 99: \"Thunderstorm with heavy hail\"\n } %}\n {{ mapper.get(code, \"Not Availible\") }}\n" - action: script.general_notificatioon - metadata: {} data: - title: Morning Weather message: 'Good Morning! - Here is the weather for today: + Here is the weather for today for {{loc}}: - High: {{max_temp}} {{temp_unit}} + High: {{high}} {{temp_unit}} - Low: {{min_temp}} {{temp_unit}} + Low: {{low}} {{temp_unit}} - Conditions: {{condition}} - - ' + Conditions: {{condition}}' + title: Morning Report mode: single - id: '1766182515375' alias: Dash Test @@ -66,58 +63,3 @@ - variables: max_temp: '{{weather.content.daily.temperature_2m_max[0]}}' mode: single -- id: '1766406207253' - alias: Morning Test - description: '' - triggers: - - trigger: time - at: 07:00:00 - weekday: - - sun - - mon - - tue - - wed - - thu - - fri - - sat - conditions: [] - actions: - - action: rest_command.get_phone_weather - data: {} - response_variable: weather_data - - variables: - max_temp: '{{weather_data.content.daily.temperature_2m_max[0]}}' - min_temp: '{{weather_data.content.daily.temperature_2m_min[0]}}' - temp_unit: '{{weather_data.content.daily_units.temperature_2m_max}}' - condition: "{% set code = weather_data.content.daily.weather_code[0] | int %} - {% set mapper = {\n 0: \"Clear sky\",\n 1: \"Mainly clear\",\n 2: \"Partly - cloudy\",\n 3: \"Overcast\",\n 45: \"Fog\",\n 48: \"Depositing rime fog\",\n - \ 51: \"Drizzle - Light intensity\",\n 53: \"Drizzle - Moderate intensity\",\n - \ 55: \"Drizzle - Dense intensity\",\n 56: \"Freezing Drizzle - Light intensity\",\n - \ 57: \"Freezing Drizzle - Dense intensity\",\n 61: \"Rain - Slight intensity\",\n - \ 63: \"Rain - Moderate intensity\",\n 65: \"Rain - Heavy intensity\",\n - \ 66: \"Freezing Rain - Light intensity\",\n 67: \"Freezing Rain - Heavy - intensity\",\n 71: \"Snow fall - Slight intensity\",\n 73: \"Snow fall - - Moderate intensity\",\n 75: \"Snow fall - Heavy intensity\",\n 77: \"Snow - grains\",\n 80: \"Rain showers - Slight intensity\",\n 81: \"Rain showers - - Moderate intensity\",\n 82: \"Rain showers - Violent intensity\",\n 85: - \"Snow showers - Slight intensity\",\n 86: \"Snow showers - Heavy intensity\",\n - \ 95: \"Thunderstorm - Slight intensity\",\n 96: \"Thunderstorm with slight - hail\",\n 99: \"Thunderstorm with heavy hail\"\n } %}\n {{ mapper.get(code, - \"Not Availible\") }}\n" - - action: script.general_notificatioon - metadata: {} - data: - title: Morning Weather - message: 'Good Morning! - - Here is the weather for today: - - High: {{max_temp}} {{temp_unit}} - - Low: {{min_temp}} {{temp_unit}} - - Conditions: {{condition}} - - ' - mode: single diff --git a/ha/ha_config/configuration.yaml b/ha/ha_config/configuration.yaml index 5f061cd..e4429ff 100644 --- a/ha/ha_config/configuration.yaml +++ b/ha/ha_config/configuration.yaml @@ -15,6 +15,7 @@ http: trusted_proxies: #- 172.19.0.2 # Add the IP address of the proxy server - 172.0.0.0/8 # You may also provide the subnet mask + - 192.168.0.56 rest_command: # This api shows: Daily code, max/min temp, apperent max/min temp, sunrise/sunset/daylight, UV, percip sum/hours/probability get_phone_weather: # All in US units for 3 days out @@ -24,50 +25,26 @@ rest_command: # This api shows: Daily code, max/min temp, apperent max/min temp, https://api.open-meteo.com/v1/forecast?latitude={{lat}}&longitude={{lon}}&daily=weather_code,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,sunrise,daylight_duration,sunset,uv_index_max,precipitation_sum,precipitation_hours,precipitation_probability_max&timezone=America%2FNew_York&forecast_days=3&wind_speed_unit=mph&temperature_unit=fahrenheit&precipitation_unit=inch method: GET -rest: - - resource_template: > - {% set lat = state_attr('device_tracker.alexs_phone','latitude') %} - {% set lon = state_attr('device_tracker.alexs_phone','longitude') %} - https://api.open-meteo.com/v1/forecast?latitude={{lat}}&longitude={{lon}}&daily=weather_code,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,sunrise,daylight_duration,sunset,uv_index_max,rain_sum,snowfall_sum,precipitation_sum,precipitation_hours,precipitation_probability_max&hourly=temperature_2m,apparent_temperature,precipitation_probability,weather_code,precipitation¤t=temperature_2m,apparent_temperature,precipitation,weather_code,is_day&timezone=America%2FNew_York&wind_speed_unit=mph&temperature_unit=fahrenheit&precipitation_unit=inch - scan_interval: 900 - sensor: - - name: "Phone Location Minimum Temperature" - unique_id: "phone_min_temp" - value_template: '{{value_json.daily.temperature_2m_min[0]}}' - unit_of_measurement: '°F' - device_class: temperature - - name: "Phone Location Maximum Temperature" - unique_id: "phone_max_temp" - value_template: '{{value_json.daily.temperature_2m_max[0]}}' - unit_of_measurement: '°F' - device_class: temperature +rest: !include_dir_merge_list rest/ monitor_docker: - name: Docker containers: - - cloudflared-cloudflared-1 - - gitea-db-1 - - gitea-server-1 - glances - habridge - homeassistant - nextcloud-app-1 - nextcloud-db-1 - nextcloud-redis-1 - - nginx-app-1 - portainer - syncthing rename: - cloudflared-cloudflared-1: 'Cloudflared' - gitea-db-1: 'Gitea Database' - gitea-server-1: 'Gitea Server' glances: 'Glances' habridge: 'Home Assistant Bridge' homeassistant: 'Home Assistant' nextcloud-app-1: 'Nextcloud Server' nextcloud-db-1: 'Nextcloud Database' nextcloud-redis-1: 'Nextcloud Redis' - nginx-app-1: 'Nginx Proxy Manager' portainer: 'Portainer' syncthing: 'Syncthing' monitored_conditions: diff --git a/ha/ha_config/scripts.yaml b/ha/ha_config/scripts.yaml index fea3d78..7493bda 100644 --- a/ha/ha_config/scripts.yaml +++ b/ha/ha_config/scripts.yaml @@ -42,3 +42,98 @@ general_notificatioon: alias: General Notification description: '' icon: mdi:bell-badge +get_cal_data: + sequence: + - action: calendar.get_events + metadata: {} + data: + duration: + hours: 96 + minutes: 0 + seconds: 0 + response_variable: Events + target: + entity_id: calendar.szumkoal_gmail_com + alias: Get Cal Data + description: '' +parse_morning_weather: + sequence: + - variables: + high: '{{ state_attr(''sensor.daily_forecast'', ''temperature_2m_max'')[0] }}' + low: '{{ state_attr(''sensor.daily_forecast'', ''temperature_2m_min'')[0] }}' + temp_unit: '{{ state_attr(''sensor.units'', ''temperature_2m'') }}' + condition: "{% set code = state_attr('sensor.daily_forecast', 'weather_code')[0] + | int %} {% set mapper = {\n 0: \"Clear sky\",\n 1: \"Mainly clear\",\n + \ 2: \"Partly cloudy\",\n 3: \"Overcast\",\n 45: \"Fog\",\n 48: \"Depositing + rime fog\",\n 51: \"Drizzle - Light intensity\",\n 53: \"Drizzle - Moderate + intensity\",\n 55: \"Drizzle - Dense intensity\",\n 56: \"Freezing Drizzle + - Light intensity\",\n 57: \"Freezing Drizzle - Dense intensity\",\n 61: + \"Rain - Slight intensity\",\n 63: \"Rain - Moderate intensity\",\n 65: + \"Rain - Heavy intensity\",\n 66: \"Freezing Rain - Light intensity\",\n + \ 67: \"Freezing Rain - Heavy intensity\",\n 71: \"Snow fall - Slight intensity\",\n + \ 73: \"Snow fall - Moderate intensity\",\n 75: \"Snow fall - Heavy intensity\",\n + \ 77: \"Snow grains\",\n 80: \"Rain showers - Slight intensity\",\n 81: + \"Rain showers - Moderate intensity\",\n 82: \"Rain showers - Violent intensity\",\n + \ 85: \"Snow showers - Slight intensity\",\n 86: \"Snow showers - Heavy intensity\",\n + \ 95: \"Thunderstorm - Slight intensity\",\n 96: \"Thunderstorm with slight + hail\",\n 99: \"Thunderstorm with heavy hail\"\n } %}\n {{ mapper.get(code, + \"Not Availible\") }}\n" + current_temp: '{{ state_attr(''sensor.current_weather'', ''apparent_temperature'') + }}' + alias: Parse_Morning_Weather + description: '' +parse_current_weather: + sequence: + - variables: + time: '{{ state_attr(''sensor.current_weather'', ''time'') | as_timestamp() + | timestamp_custom(''%B %d, %Y, %I:%M %p'') }}' + temp: '{{ state_attr(''sensor.current_weather'', ''temperature_2m'') }}' + apparent_temp: '{{ state_attr(''sensor.current_weather'', ''apparent_temperature'') + }}' + precip: '{{ state_attr(''sensor.current_weather'', ''precipitation'') }}' + weather_code: "{% set code = state_attr('sensor.current_weather', 'weather_code') + | int %} {% set mapper = {\n 0: \"Clear sky\",\n 1: \"Mainly clear\",\n + \ 2: \"Partly cloudy\",\n 3: \"Overcast\",\n 45: \"Fog\",\n 48: \"Depositing + rime fog\",\n 51: \"Drizzle - Light intensity\",\n 53: \"Drizzle - Moderate + intensity\",\n 55: \"Drizzle - Dense intensity\",\n 56: \"Freezing Drizzle + - Light intensity\",\n 57: \"Freezing Drizzle - Dense intensity\",\n 61: + \"Rain - Slight intensity\",\n 63: \"Rain - Moderate intensity\",\n 65: + \"Rain - Heavy intensity\",\n 66: \"Freezing Rain - Light intensity\",\n + \ 67: \"Freezing Rain - Heavy intensity\",\n 71: \"Snow fall - Slight intensity\",\n + \ 73: \"Snow fall - Moderate intensity\",\n 75: \"Snow fall - Heavy intensity\",\n + \ 77: \"Snow grains\",\n 80: \"Rain showers - Slight intensity\",\n 81: + \"Rain showers - Moderate intensity\",\n 82: \"Rain showers - Violent intensity\",\n + \ 85: \"Snow showers - Slight intensity\",\n 86: \"Snow showers - Heavy intensity\",\n + \ 95: \"Thunderstorm - Slight intensity\",\n 96: \"Thunderstorm with slight + hail\",\n 99: \"Thunderstorm with heavy hail\"\n } %}\n {{ mapper.get(code, + \"Not Availible\") }}\n" + daytime: '{{ state_attr(''sensor.current_weather'', ''is_day'') }}' + alias: Parse Current Weather + description: '' +parse_hourly_weather: + sequence: + - variables: + iso_time: '{{ state_attr(''sensor.hourly_forecast'', ''time'') }}' + temp: '{{ state_attr(''sensor.hourly_forecast'', ''temperature_2m'') }}' + precip_prob: '{{ state_attr(''sensor.hourly_forecast'', ''precipitation_probability'') + }}' + weather_code: '{{ state_attr(''sensor.hourly_forecast'', ''weather_code'') }}' + precip: '{{ state_attr(''sensor.hourly_forecast'', ''precipitation'') }}' + count: 0 + formatted_time: [] + - variables: + test: '{% set count = count +1 %}' + formatted_time: "\n{% set result = [] %} \n{% for i in range(iso_time | length) + %}\n {% set formatted = iso_time[i] | as_timestamp() | timestamp_custom('%B + %d, %Y, %I:%M %p') %}\n {% set result = result + [iso_time[i] | as_timestamp() + | timestamp_custom('%B %d, %Y, %I:%M %p')] %}\n{% endfor %} \n{{ result }}\n + \ \n" + - action: notify.persistent_notification + metadata: {} + data: + title: test + message: '{{iso_time}} + + {{ formatted_time }}' + alias: Parse Hourly Weather + description: ''