Thank you. It looks like it might be pretty straightforward but I have 2 different target entities weather.tomorrow_io_cottage_hourly'
and weather.tomorrow_io_cottage_daily
and I see a response_variable: hourly
used in all the examples. I’m not sure how I would set mine up considering I’m calling on both hourly and daily?
Edit: Is it simply a case of using it twice such as:
service: weather.get_forecasts
target:
entity_id:
- weather.tomorrow_io_cottage
data:
type: hourly
response_variable: hourly
and
service: weather.get_forecasts
target:
entity_id:
- weather.tomorrow_io_cottage
data:
type: daily
response_variable: daily
?
My code:
sensor:
- name: Cottage Guests
state: "OK"
attributes:
guest_message: >
{% set num_guests = states('sensor.smoobu_guest_numbers') %}
{% if num_guests == "1" %} ' ' {% elif num_guests == "2" %} and Guest {% elif num_guests > "2" %} and Guests {% endif %}
guest_activity: > # 0=default 1=welcome 2=during 3=goodbye 4=same day guest arriving as one leaving
{% set status = "0" %}
{% if now().date().strftime('%Y-%m-%d') == states('sensor.smoobu_guest_arrival') %}
{% set status = "1" %}
{% elif now().date().strftime('%Y-%m-%d') > states('sensor.smoobu_guest_arrival') and now().date().strftime('%Y-%m-%d') < states('sensor.smoobu_guest_departure') %}
{% set status = "2" %}
{% elif now().date().strftime('%Y-%m-%d') == states('sensor.smoobu_guest_departure') and now().strftime('%H') | int < 12 %}
{% set status = "3" %}
{% elif now().date().strftime('%Y-%m-%d') == states('sensor.smoobu_second_guest_arrival') %}
{% set status = "4" %}
{% endif %}
{{ status }}
- name: My Weather Data
state: "OK"
attributes:
today_temp_low: >
{% set temp = state_attr('weather.tomorrow_io_cottage_daily','forecast')[0].templow %}
{% set lowest_temp = temp %}
{% if state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[0].temperature | round < lowest_temp %}
{% set lowest_temp = state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[0].temperature | round %} {% endif %}
{% if state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[1].temperature | round < lowest_temp %}
{% set lowest_temp = state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[1].temperature | round %} {% endif %}
{% if state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[2].temperature | round < lowest_temp %}
{% set lowest_temp = state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[2].temperature | round %} {% endif %}
{% if state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[3].temperature | round < lowest_temp %}
{% set lowest_temp = state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[3].temperature | round %} {% endif %}
{{ lowest_temp }}
today_temp_high: >
{% set temp = state_attr('weather.tomorrow_io_cottage_daily','forecast')[0].temperature %}
{% set highest_temp = temp %}
{% if state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[0].temperature | round > highest_temp %}
{% set highest_temp = state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[0].temperature | round %} {% endif %}
{% if state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[1].temperature | round > highest_temp %}
{% set highest_temp = state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[1].temperature | round %} {% endif %}
{% if state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[2].temperature | round > highest_temp %}
{% set highest_temp = state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[2].temperature | round %} {% endif %}
{% if state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[3].temperature | round > highest_temp %}
{% set highest_temp = state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[3].temperature | round %} {% endif %}
{{ highest_temp }}
- name: Weatherman Data
state: "OK"
attributes:
weather_condition_0: >
{% set cond0 = state_attr('weather.tomorrow_io_cottage_hourly', '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(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[0].datetime) %}
{% if ( cond0_time < next_rising and next_rising < next_setting ) or ( cond0_time > next_setting and cond0_time < next_rising ) %}
{% if cond0 == 'sunny' or 'clear-night' %} night {% elif cond0 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond0 }} {% endif %}
{% else %}
{{ cond0 }}
{% endif %}
weather_temperature_0: >
{{ state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[0].temperature | round }}
weather_timestamp_0: >
{{ as_timestamp(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[0].datetime) | timestamp_custom('%I') | int }}{{ as_timestamp(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[0].datetime) | timestamp_custom('%p') | lower}}
weather_condition_1: >
{% set cond1 = state_attr('weather.tomorrow_io_cottage_hourly', '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(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[1].datetime) %}
{% if ( cond1_time < next_rising and next_rising < next_setting ) or ( cond1_time > next_setting and cond1_time < next_rising ) %}
{% if cond1 == 'sunny' or 'clear-night' %} night {% elif cond1 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond1 }} {% endif %}
{% else %}
{{ cond1 }}
{% endif %}
weather_temperature_1: >
{{ state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[1].temperature | round }}
weather_timestamp_1: >
{{ as_timestamp(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[1].datetime) | timestamp_custom('%I') | int }}{{ as_timestamp(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[1].datetime) | timestamp_custom('%p') | lower}}
weather_condition_2: >
{% set cond2 = state_attr('weather.tomorrow_io_cottage_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 cond2_time = as_timestamp(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[2].datetime) %}
{% if ( cond2_time < next_rising and next_rising < next_setting ) or ( cond2_time > next_setting and cond2_time < next_rising ) %}
{% if cond2 == 'sunny' or 'clear-night' %} night {% elif cond2 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond2 }} {% endif %}
{% else %}
{{ cond2 }}
{% endif %}
weather_temperature_2: >
{{ state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[2].temperature | round }}
weather_timestamp_2: >
{{ as_timestamp(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[2].datetime) | timestamp_custom('%I') | int }}{{ as_timestamp(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[2].datetime) | timestamp_custom('%p') | lower}}
weather_condition_3: >
{% set cond3 = state_attr('weather.tomorrow_io_cottage_hourly', '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(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[3].datetime) %}
{% if ( cond3_time < next_rising and next_rising < next_setting ) or ( cond3_time > next_setting and cond3_time < next_rising ) %}
{% if cond3 == 'sunny' or 'clear-night' %} night {% elif cond3 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond3 }} {% endif %}
{% else %}
{{ cond3 }}
{% endif %}
weather_temperature_3: >
{{ state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[3].temperature | round }}
weather_timestamp_3: >
{{ as_timestamp(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[3].datetime) | timestamp_custom('%I') | int }}{{ as_timestamp(state_attr('weather.tomorrow_io_cottage_hourly', 'forecast')[3].datetime) | timestamp_custom('%p') | lower}}