# Simple WeatherBoard - trigger: - platform: time_pattern minutes: /5 variables: # USE ONE Weather entity_id (check Developer Tools > States) # Open-Meteo likely uses "weather.home" and Openweather likely uses "weather.openweathermap" but yours may be different weather_entity: "weather.home" # Here you can edit the increments increment_0: "2" increment_1: "4" increment_2: "6" increment_3: "8" # Here you can edit the 3 titles: Handle it in the order of the 3 titles (WEATHER, TODAY, OUTLOOK are defaults #} # Be sure the font in your ESPHome YAML can handle the characters! ie. "WEATHR" for font_title and "TODAYULK" for the font_small_title #} titles: > {%- set titles = [] %} {%- set titles = titles + ["WEATHER"] %} {%- set titles = titles + ["TODAY"] %} {%- set titles = titles + ["OUTLOOK"] %} {{titles}} daily_0: "1" daily_1: "2" daily_2: "3" daily_3: "4" # Edit how timestamps are shown time_format: "%I:00%p" # %H:00 = 24hrs (13:00) / %I:00%p = 12hrs + AM/PM (01:00PM) strip_zero: "0" # 0 to strip leading zero (1:00PM), empty quotes if not action: - service: weather.get_forecasts data: type: hourly target: entity_id: "{{ weather_entity }}" response_variable: hourly - service: weather.get_forecasts data: type: daily target: entity_id: "{{ weather_entity }}" response_variable: daily sensor: - name: eInk WeatherBoard Data unique_id: eink_weatherboard_data state: "OK" attributes: hourly_times: "{{hourlytimes}}" weather_now_temperature: > {{ hourly[weather_entity].forecast[0].temperature | round }} weather_now_condition: > {%- set cond_now = hourly[weather_entity].forecast[0].condition %} {%- if states('sun.sun') == 'below_horizon' %} {%- if cond_now == 'sunny' %} night {% elif cond_now == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond_now }} {% endif %} {%- else %} {{ cond_now }} {%- endif %} weather_hourly_title: "{{ titles[1] }}" weather_hourly_condition_0: > {%- set cond0 = hourly[weather_entity].forecast[increment_0].condition %} {%- set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %} {%- set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %} {%- set cond0_time = as_timestamp(hourly[weather_entity].forecast[increment_0].datetime) %} {%- if cond0_time > next_setting and cond0_time < next_rising %} {%- if cond0 == 'sunny' %} night {% elif cond0 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond0 }} {% endif %} {%- else %} {{ cond0 }} {%- endif %} weather_hourly_temperature_0: > {{ hourly[weather_entity].forecast[increment_0].temperature | round }} weather_hourly_timestamp_0: > {%- set timestamp = as_timestamp(hourly[weather_entity].forecast[increment_0].datetime) | timestamp_custom(time_format) %} {{ timestamp.lstrip(strip_zero) }} weather_hourly_condition_1: > {%- set cond0 = hourly[weather_entity].forecast[increment_1].condition %} {%- set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %} {%- set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %} {%- set cond0_time = as_timestamp(hourly[weather_entity].forecast[increment_1].datetime) %} {%- if cond0_time > next_setting and cond0_time < next_rising %} {%- if cond0 == 'sunny' %} night {% elif cond0 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond0 }} {% endif %} {%- else %} {{ cond0 }} {%- endif %} weather_hourly_temperature_1: > {{ hourly[weather_entity].forecast[increment_1].temperature | round }} weather_hourly_timestamp_1: > {%- set timestamp = as_timestamp(hourly[weather_entity].forecast[increment_1].datetime) | timestamp_custom(time_format) %} {{ timestamp.lstrip(strip_zero) }} weather_hourly_condition_2: > {%- set cond0 = hourly[weather_entity].forecast[increment_2].condition %} {%- set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %} {%- set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %} {%- set cond0_time = as_timestamp(hourly[weather_entity].forecast[increment_2].datetime) %} {%- if cond0_time > next_setting and cond0_time < next_rising %} {%- if cond0 == 'sunny' %} night {% elif cond0 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond0 }} {% endif %} {%- else %} {{ cond0 }} {%- endif %} weather_hourly_temperature_2: > {{ hourly[weather_entity].forecast[increment_2].temperature | round }} weather_hourly_timestamp_2: > {%- set timestamp = as_timestamp(hourly[weather_entity].forecast[increment_2].datetime) | timestamp_custom(time_format) %} {{ timestamp.lstrip(strip_zero) }} weather_hourly_condition_3: > {%- set cond0 = hourly[weather_entity].forecast[increment_3].condition %} {%- set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %} {%- set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %} {%- set cond0_time = as_timestamp(hourly[weather_entity].forecast[increment_3].datetime) %} {%- if cond0_time > next_setting and cond0_time < next_rising %} {%- if cond0 == 'sunny' %} night {% elif cond0 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond0 }} {% endif %} {%- else %} {{ cond0 }} {%- endif %} weather_daily_title: "{{ titles[2] }}" weather_daily_condition_0: > {{ daily[weather_entity].forecast[daily_0].condition }} weather_daily_temperature_0: > {{ daily[weather_entity].forecast[daily_0].temperature | round }} weather_daily_timestamp_0: > {{ as_timestamp(daily[weather_entity].forecast[daily_0].datetime) | timestamp_custom('%a') }} weather_daily_condition_1: > {{ daily[weather_entity].forecast[daily_1].condition }} weather_daily_temperature_1: > {{ daily[weather_entity].forecast[daily_1].temperature | round }} weather_daily_timestamp_1: > {{ as_timestamp(daily[weather_entity].forecast[daily_1].datetime) | timestamp_custom('%a') }} weather_daily_condition_2: > {{ daily[weather_entity].forecast[daily_2].condition }} weather_daily_temperature_2: > {{ daily[weather_entity].forecast[daily_2].temperature | round }} weather_daily_timestamp_2: > {{ as_timestamp(daily[weather_entity].forecast[daily_2].datetime) | timestamp_custom('%a') }} weather_daily_condition_3: > {{ daily[weather_entity].forecast[daily_3].condition }} weather_daily_temperature_3: > {{ daily[weather_entity].forecast[daily_3].temperature | round }} weather_daily_timestamp_3: > {{ as_timestamp(daily[weather_entity].forecast[daily_3].datetime) | timestamp_custom('%a') }} - trigger: - platform: time_pattern minutes: /1 variables: waketime: > {# Edit and order the schedule from midnight 00:00 to 23:59 as needed #} {%- set waketimes = [] %} {%- set waketimes = waketimes + ["00:07"] %} {%- set waketimes = waketimes + ["06:07"] %} {%- set waketimes = waketimes + ["08:07"] %} {%- set waketimes = waketimes + ["10:07"] %} {%- set waketimes = waketimes + ["12:07"] %} {%- set waketimes = waketimes + ["14:07"] %} {%- set waketimes = waketimes + ["16:07"] %} {%- set waketimes = waketimes + ["18:07"] %} {%- set waketimes = waketimes + ["21:07"] %} {%- set waketime = namespace(next = "") %} {%- set waketime_all = [] %} {%- for test in waketimes %} {%- set waketime.next = (now().strftime('%Y-%m-%d')|string) + " " + (test|string) %} {%- if (now().strftime('%Y-%m-%d %H:%M:%S')|string|as_datetime) < (waketime.next|as_datetime) %} {%- break %} {%- endif %} {%- endfor %} {%- if (now().strftime('%Y-%m-%d %H:%M:%S')|string|as_datetime) > (waketime.next|as_datetime) %} {%- set waketime.next = (now().strftime('%Y-%m-%d')|string) + " " + (waketimes[0]|string) %} {%- set waketime_helper = ((as_timestamp(waketime.next|as_datetime + timedelta(days=1)) - as_timestamp(now()|as_datetime))|int(0)) %} {%- else %} {%- set waketime_helper = ((as_timestamp(waketime.next|as_datetime) - as_timestamp(now()|as_datetime))|int(0)) %} {%- endif %} {%- set waketime_all = [waketime.next] + [waketime_helper] + [waketimes] %} {{waketime_all}} sensor: - name: eInk WeatherBoard Wake Times unique_id: eink_weatherboard_wake_times state: "{{ this.attributes.next_wake_time | default('Not Available') }}" attributes: wake_times: "{{ waketime[2] | default('Not Available') }}" next_wake_time: "{{ waketime[0] | default(999999) }}" wake_time_helper: "{{ waketime[1] | default('Not Available') }}"