Thanks to @Edwin_D I managed to sort the sensor out without using an extra sensor, I have updated my GitHub with the complete code
Hi! Are you able to provide input where things have changed in the code? I believe I have built my version on your code
The changes are made in the sensor in Home Assistant that the ESP gets its data from, the sensor.weatherman_data. When attributes were removed from the Weather integration we needed to get those attributes using the service weather.get_forecasts instead. So that is now applied in the sensor.weatherman_data
So itÂŽs first of all the trigger to that sensor,
- trigger:
platform: time_pattern
minutes: "/1"
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.smhi_home
response_variable: hourly
and then in the different templates for the attributes to get the response data provided from the weather integration
weather_temperature_0: >
{{ hourly["weather.smhi_home"].forecast[0].temperature | round }}
Let me know if there is anything special you are wondering
How did you get the model of â7.50in-bv2-rbâ work?
When I attempt to configure it with that I get âUnknown value â7.50in-bv2-rbâ, did you mean â7.50in-bv2â, â7.50in-bv3â, â7.50inv2â?.â
I want that red lol
Using twisterss custom version from this thread:
sorry for posting this massive file here but hopefully it helps other to figure out the new weather forecast WoW
---
trigger:
platform: time_pattern
minutes: "/4"
action:
- service: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.forecast_home
response_variable: daily
sensor:
- name: e-ink Display Data
unique_id: e_ink_display_data
icon: ios:display-2
state: "OK"
attributes:
greeting: >
{%- if now() > today_at('18:00') %}
Good evening
{%- elif now() > today_at('12:00') %}
Good afternoon
{%- elif now() > today_at('5:00') %}
Good morning
{%- else %}
Good night
{%- endif %}
weather_condition_now: >
{% set cond_now = states('weather.forecast_home') %}
{% 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_condition_0: >
{% set cond0 = daily["weather.forecast_home"].forecast[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(daily["weather.forecast_home"].forecast[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_temperature_0: >
{{ daily["weather.forecast_home"].forecast[0].temperature | round }}
#{{ daily["weather.forecast_home"].forecast[0].temperature | round }}
weather_timestamp_0: >
{{ as_timestamp(daily["weather.forecast_home"].forecast[0].datetime) | timestamp_custom('%a') }}
weather_condition_1: >
{% set cond1 = daily["weather.forecast_home"].forecast[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 cond1_time = as_timestamp(daily["weather.forecast_home"].forecast[1].datetime) %}
{% if cond1_time > next_setting and cond1_time < next_rising %}
{% if cond1 == 'sunny' %} night {% elif cond1 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond1 }} {% endif %}
{% else %}
{{ cond1 }}
{% endif %}
weather_temperature_1: >
{{ daily["weather.forecast_home"].forecast[1].temperature | round }}
weather_timestamp_1: >
{{ as_timestamp(daily["weather.forecast_home"].forecast[1].datetime) | timestamp_custom('%a') }}
weather_condition_2: >
{% set cond2 = daily["weather.forecast_home"].forecast[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 cond2_time = as_timestamp(daily["weather.forecast_home"].forecast[2].datetime) %}
{% if cond2_time > next_setting and cond2_time < next_rising %}
{% if cond2 == 'sunny' %} night {% elif cond2 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond2 }} {% endif %}
{% else %}
{{ cond2 }}
{% endif %}
weather_temperature_2: >
{{ daily["weather.forecast_home"].forecast[2].temperature | round }}
weather_timestamp_2: >
{{ as_timestamp(daily["weather.forecast_home"].forecast[2].datetime) | timestamp_custom('%a') }}
weather_condition_3: >
{% set cond3 = daily["weather.forecast_home"].forecast[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 cond3_time = as_timestamp(daily["weather.forecast_home"].forecast[3].datetime) %}
{% if cond3_time > next_setting and cond3_time < next_rising %}
{% if cond3 == 'sunny' %} night {% elif cond3 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond3 }} {% endif %}
{% else %}
{{ cond3 }}
{% endif %}
weather_temperature_3: >
{{ daily["weather.forecast_home"].forecast[3].temperature | round }}
weather_timestamp_3: >
{{ as_timestamp(daily["weather.forecast_home"].forecast[3].datetime) | timestamp_custom('%a') }}
afval_today: >
{{ states('sensor.afvalinfo_thuis_trash_type_today') }}
afval_tomorrow: >
{{ states('sensor.afvalinfo_thuis_trash_type_tomorrow') }}
travel_Best_time: >
{{ state_attr('sensor.werk_best','duration') | round(2) }}
travel_Best_name: >
{{ state_attr('sensor.werk_best','friendly_name') }}
travel_ASML_time: >
{{ state_attr('sensor.werk_asml','duration') | round(2) }}
travel_ASML_name: >
{{ state_attr('sensor.werk_asml','friendly_name') }}
travel_Euretco_time: >
{{ state_attr('sensor.reistijd_hoeverlaken','duration') | round(2) }}
travel_Euretco_name: >
{{ state_attr('sensor.reistijd_hoeverlaken','friendly_name') }}
sun_next_rising: >
{{ state_attr('Sun.sun', 'next_rising') }}
sun_next_setting: >
{{ state_attr('Sun.sun', 'next_setting') }}
moon_phase_icon: >
{{ state_attr('sensor.moon_phase', 'icon') }}
media_playing_status: >
{{ states('media_player.keuken') }}
media_playing_title: >
{{ state_attr('media_player.keuken', 'media_title') | title }}
media_playing_artist: >
{{ state_attr('media_player.keuken', 'media_artist') | title }} (on {{ state_attr('media_player.office_sonos', 'media_channel') | title }})
I figure Iâll share mine too since I struggled to get my 2 different OpenWeatherMap APIs to work. This may provide some help to other folks who use daily and hourly forecasts together:
template:
# Bundle up all the data to send over to e-ink ESPHome devices.
# For the timestamps use: %H = 24hrs / %I = 12hrs
# To add AM/PM add the following: {{ as_timestamp(state_attr('weather.openweathermap_hourly', 'forecast')[x].datetime) | timestamp_custom('%p') }}
# original: {{ as_timestamp(state_attr('weather.openweathermap_hourly', 'forecast')[6].datetime) | timestamp_custom('%I:00') }}
- trigger:
platform: time_pattern
minutes: /1
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id:
- weather.openweathermap_hourly
response_variable: hourly
- service: weather.get_forecasts
data:
type: daily
target:
entity_id:
- weather.openweathermap
response_variable: daily
sensor:
- name: Weather Data
unique_id: weather_data
state: "OK"
attributes:
greeting: >
{%- if now() > today_at('18:00') %}
Good evening
{%- elif now() > today_at('12:00') %}
Good afternoon
{%- elif now() > today_at('5:00') %}
Good morning
{%- else %}
Good night
{%- endif %}
# Current temperature + condition
weather_now_temperature: >
{{ hourly["weather.openweathermap_hourly"].forecast[0].temperature | round }}
weather_now_condition: >
{% set cond_now = hourly["weather.openweathermap_hourly"].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 %}
# Hourly temperature + condition + timestamp (4x)
weather_hourly_condition_0: >
{% set cond0 = hourly["weather.openweathermap_hourly"].forecast[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.openweathermap_hourly"].forecast[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_0: >
{{ hourly["weather.openweathermap_hourly"].forecast[2].temperature | round }}
weather_hourly_timestamp_0: >
{% set timestamp = as_timestamp(hourly["weather.openweathermap_hourly"].forecast[2].datetime) | timestamp_custom('%I:00') %} {{ timestamp.lstrip("0") }}{{ as_timestamp(hourly["weather.openweathermap_hourly"].forecast[2].datetime) | timestamp_custom('%p') }}
weather_hourly_condition_1: >
{% set cond0 = hourly["weather.openweathermap_hourly"].forecast[4].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.openweathermap_hourly"].forecast[4].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.openweathermap_hourly"].forecast[4].temperature | round }}
weather_hourly_timestamp_1: >
{% set timestamp = as_timestamp(hourly["weather.openweathermap_hourly"].forecast[4].datetime) | timestamp_custom('%I:00') %} {{ timestamp.lstrip("0") }}{{ as_timestamp(hourly["weather.openweathermap_hourly"].forecast[4].datetime) | timestamp_custom('%p') }}
weather_hourly_condition_2: >
{% set cond0 = hourly["weather.openweathermap_hourly"].forecast[6].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.openweathermap_hourly"].forecast[6].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.openweathermap_hourly"].forecast[6].temperature | round }}
weather_hourly_timestamp_2: >
{% set timestamp = as_timestamp(hourly["weather.openweathermap_hourly"].forecast[6].datetime) | timestamp_custom('%I:00') %} {{ timestamp.lstrip("0") }}{{ as_timestamp(hourly["weather.openweathermap_hourly"].forecast[6].datetime) | timestamp_custom('%p') }}
weather_hourly_condition_3: >
{% set cond0 = hourly["weather.openweathermap_hourly"].forecast[8].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.openweathermap_hourly"].forecast[8].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_3: >
{{ hourly["weather.openweathermap_hourly"].forecast[8].temperature | round }}
weather_hourly_timestamp_3: >
{% set timestamp = as_timestamp(hourly["weather.openweathermap_hourly"].forecast[8].datetime) | timestamp_custom('%I:00') %} {{ timestamp.lstrip("0") }}{{ as_timestamp(hourly["weather.openweathermap_hourly"].forecast[8].datetime) | timestamp_custom('%p') }}
# Daily temperature + condition + day of week (3x)
weather_daily_condition_0: >
{{ daily["weather.openweathermap"].forecast[1].condition }}
weather_daily_temperature_0: >
{{ daily["weather.openweathermap"].forecast[1].temperature | round }}
weather_daily_timestamp_0: >
{{ as_timestamp(daily["weather.openweathermap"].forecast[1].datetime) | timestamp_custom('%a') }}
weather_daily_condition_1: >
{{ daily["weather.openweathermap"].forecast[2].condition }}
weather_daily_temperature_1: >
{{ daily["weather.openweathermap"].forecast[2].temperature | round }}
weather_daily_timestamp_1: >
{{ as_timestamp(daily["weather.openweathermap"].forecast[2].datetime) | timestamp_custom('%a') }}
weather_daily_condition_2: >
{{ daily["weather.openweathermap"].forecast[3].condition }}
weather_daily_temperature_2: >
{{ daily["weather.openweathermap"].forecast[3].temperature | round }}
weather_daily_timestamp_2: >
{{ as_timestamp(daily["weather.openweathermap"].forecast[3].datetime) | timestamp_custom('%a') }}
weather_daily_condition_3: >
{{ daily["weather.openweathermap"].forecast[4].condition }}
weather_daily_temperature_3: >
{{ daily["weather.openweathermap"].forecast[4].temperature | round }}
weather_daily_timestamp_3: >
{{ as_timestamp(daily["weather.openweathermap"].forecast[4].datetime) | timestamp_custom('%a') }}
can you share your code please
Do you mean my esphome YAML?
Itâs not necessary anymore, I donât know how but everything started to work
Hi,
I just found this project and wanted to use it as a first start to have a room âdoor signâ where people can see, if/when the room is booked (I do know that this is not a room sign, but I hoped to get this running to see how such a door sign can be made, and as a side effekt to have this nice think hanging on my wall). I wanted to use e-Paper to save battery power. Basic idea is to hang such an epaper next to the room, and have another âglue softwareâ in HA, that reads the room bookings from Microsoft 365 outlook calender, and sends it thru HA to the esp32 e-paper. On the longer run, a button next to the room should book the next15 free minutes of this room. I have the gutt feeling that HA is perfect for âglueingâ all this together.
I got the waveshare 7 in e-Paper and the e-Paper ESP32 driver board.
I installed successfully esphome and the needed drivers, and run
esphome run weatherman.yaml
With the yaml and font and image files from github:
and generated a secrets.yaml
with my credentials.
but only get the following error
INFO ESPHome 2024.4.2
INFO Reading configuration weatherman.yaml...
ERROR Error while reading config: Invalid YAML syntax:
mapping values are not allowed here
in "secrets.yaml", line 2, column 7
Is here any kind soul, that could give me a pointer how to continue, as I strongly assume, that I am doing things totally wrong as I am new to esphome.
many thanks
Juergen
Does your secrets look like that?
# Your Wi-Fi SSID and password
wifi_ssid: "NAME123"
wifi_password: "123456789"
Hi @AFSC ,
for sure noit Many thanks. But still there where errors from esphome with the original weathermal.yaml. I than took
and it compiled just fine.
But when it tries to upload the binary on my mac, I get
INFO Upload with baud rate 460800 failed. Trying again with baud rate 115200.
esptool.py v4.7.0
Loaded custom configuration from /Users/ry90/egeling.cloud/heubergweg-haus/homeAssistant/epaper/esptool.cfg
Serial port /dev/cu.usbmodem54E20349931
Connecting.....
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 94:b5:55:1c:8a:74
Uploading stub...
ERROR Running command failed: Failed to write to target RAM (result was 01070000: Operation timed out)
As far as I googled this seems to be an issue with the mac. But I got espsomfy first binary installed with
âconnect-attempts 0
swith, but here I have no luck. Did anyone here install the first firmware on a mac? If so, how? In the esptool.cfg I changed some timings, but obvious with no luck.
thanks for any pointer. I googled a lot, but without success.
thanks
Juergen
weather has stopped working since i upgraded HA
sensor.weatherman_data is unable to collect the data
You might want to post your code, otherwise we donât know, what you really are doingâŠ
HI,
I tried it the web interface and with another ESP32 it worked fine. So I think I need a differente e-Paper waveshare driver board.
thanks fpr the help
Can you all provide me whith ESP32 e-Paper driver boards that work
And a shop where to buy them?
many thanks
Juergen
Would you mind explaining in short words, what you have done (and how), what board youâre using and all other data you might want to share.
I have a guess, but without knowing moreâŠyou might not getting your ESP board into flash mode (vs boot mode). Let us know some details, and weâll see how things work out.
Hi @paddy0174 ,
I have this board
which seems to be the standard Waveshare e-paper board. And I am trying to get the first flash âsomehowâ on this board to make the rest of the installs/upgrades OTA.
I had it connected with USB cable, installed the driver and the criver was âseenâ, and I got a /dev/cu⊠device.
Installing with ESPhome did not work, I got the error I posted.
Installing with https://web.esphome.io/ did not work on this board either. I tried
esptool.py --connect-attempts 15 --before no_reset --after hard_reset --baud 57600 --port /dev/cu.usbmodem54E20356371 --chip esp32 write_flash -z --flash_size detect 0x10000 /Users/ry90/egeling.cloud/heubergweg-haus/homeAssistant/epaper/.esphome/build/weatherman/.pioenvs/weatherman/firmware.bin 0x1000 /Users/ry90/egeling.cloud/heubergweg-haus/homeAssistant/epaper/.esphome/build/weatherman/.pioenvs/weatherman/bootloader.bin 0x8000 /Users/ry90/egeling.cloud/heubergweg-haus/homeAssistant/epaper/.esphome/build/weatherman/.pioenvs/weatherman/partitions.bin 0xe000 /Users/ry90/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin
where I got another ESP to work with the
esptool.py --connect-attempts 15 --before no_reset
by bringing the ESP in âprogramm modeâ by pressind boot/en releasing en, and than sending the esptool command.
I than tried another ESP32 I had from another project, also a development board.
This immediately worked with
https://web.esphome.io/
flashing the default firmware, and I saw it in my WLAN.
Same here: Pressing boot/EN releasing EN, ⊠on the development board and it did the expected job.
So I assume that the ESP epaper driver booard is broken or needs very special treatment that I do not know.
I also made a
esptool.cfg
for the esptools commandline with these adapted timeouts
[esptool]
chip_erase_timeout = 140
serial_write_timeout = 8.5
write_block_attempts = 2
reset_delay = 3
mem_end_rom_timeout = 0.3
connect_attempts = 15
and it did not work flashing the esp e-paper driver board. (all on mac). I do want to try a windows machine, but there is none in my nearby.
So I am stuck.
thanks for any help
Juergen
everything was working until I updated HA
template:
# Bundle up all the data to send over to Weatherman (ESPHome device).
- trigger:
platform: time_pattern
minutes: "/1"
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.openweathermap
response_variable: hourly
sensor:
- name: Weatherman Data
state: "OK"
temperature_home_now_aqara: >
{{ states('sensor.temperatura_escritorio_temperature') | round }}
temperature_home_feels_like: >
{{ states('sensor.openweathermap_feels_like_temperature') | round }}
weather_condition_now: >
{% set cond_now = states('weather.openweathermap') %}
{% 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_condition_0: >
{% set cond0 = hourly["weather.openweathermap"].forecast[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.openweathermap"].forecast[0].datetime) %}
{% if cond0_time < next_rising and next_rising < next_setting %}
{% if cond0 == 'sunny' %} night {% elif cond0 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond0 }} {% endif %}
{% else %}
{{ cond0 }}
{% endif %}
weather_temperature_0: >
{{ hourly["weather.openweathermap"].forecast[0].temperature | round }}
weather_precipitation_0: >
{{ hourly["weather.openweathermap"].forecast[0].precipitation }}
weather_timestamp_0: >
{{ as_timestamp(hourly["weather.openweathermap"].forecast[0].datetime) | timestamp_custom("%H:%M")}}
weather_condition_1: >
{% set cond1 = hourly["weather.openweathermap"].forecast[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 cond1_time = as_timestamp(hourly["weather.openweathermap"].forecast[3].datetime) %}
{% if cond1_time < next_rising and next_rising < next_setting %}
{% if cond1 == 'sunny' %} night {% elif cond1 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond1 }} {% endif %}
{% else %}
{{ cond1 }}
{% endif %}
weather_temperature_1: >
{{ hourly["weather.openweathermap"].forecast[3].temperature | round }}
weather_precipitation_1: >
{{ hourly["weather.openweathermap"].forecast[3].precipitation }}
weather_timestamp_1: >
{{ as_timestamp(hourly["weather.openweathermap"].forecast[3].datetime) | timestamp_custom("%H:%M")}}
weather_condition_2: >
{% set cond2 = hourly["weather.openweathermap"].forecast[6].condition %}
{% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %}
{% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %}
{% set cond2_time = as_timestamp(hourly["weather.openweathermap"].forecast[6].datetime) %}
{% if cond2_time < next_rising and next_rising < next_setting %}
{% if cond2 == 'sunny' %} night {% elif cond2 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond2 }} {% endif %}
{% else %}
{{ cond2 }}
{% endif %}
weather_temperature_2: >
{{ hourly["weather.openweathermap"].forecast[6].temperature | round }}
weather_precipitation_2: >
{{ hourly["weather.openweathermap"].forecast[6].precipitation }}
weather_timestamp_2: >
{{ as_timestamp(hourly["weather.openweathermap"].forecast[6].datetime) | timestamp_custom("%H:%M")}}
weather_condition_3: >
{% set cond3 = hourly["weather.openweathermap"].forecast[9].condition %}
{% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %}
{% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %}
{% set cond3_time = as_timestamp(hourly["weather.openweathermap"].forecast[9].datetime) %}
{% if cond3_time < next_rising and next_rising < next_setting %}
{% if cond3 == 'sunny' %} night {% elif cond3 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond3 }} {% endif %}
{% else %}
{{ cond3 }}
{% endif %}
weather_temperature_3: >
{{ hourly["weather.openweathermap"].forecast[9].temperature | round }}
weather_precipitation_3: >
{{ hourly["weather.openweathermap"].forecast[9].precipitation }}
weather_timestamp_3: >
{{ as_timestamp(hourly["weather.openweathermap"].forecast[9].datetime) | timestamp_custom("%H:%M")}}
open_doors: >
{% set doors = [
states.binary_sensor.sensor_porta_contact,
states.binary_sensor.franska_balkongdorren
] %}
{% set doors_on = doors | selectattr('state','eq','on') | list | count %}
{{ doors_on }}
frost_risk: >
{{ states('sensor.thermal_comfort_frost_risk') }}
gympa: >
{{ states('calendar.gympa_local') }}
frukt: >
{{ states('calendar.frukt_local') }}
laxa: >
{{ states('calendar.laxa_local') }}
service: >
{{ states('input_boolean.e_ink_service') }}
temp_trend: >
{% set temp_rising = states('binary_sensor.temp_rising') %}
{% set temp_falling = states('binary_sensor.temp_falling') %}
{% if (temp_rising) == 'on' or (temp_falling) == 'on' %}
{% if (temp_rising) == 'on' %}warm{%- endif %}
{% if (temp_falling) == 'on' %}cold{%- endif %}
{% else %}
off
{% endif %}