Hi there, apologize for my lack of knowledge but I copied and pasted some code from some tutorials for retrieving calendar entities and creating a forecast for a weather entity. I added a few different ones and the only thing that is working is the first calendar sensor named “family calendar feed”. I am not sure if I am placing them in the correct location (template.yaml or sensors.yaml- i don’t know the difference and why one should go in there versus the other). I also noticed that when i created these sensors i got a legacy syntax issue with “platform” so I changed it to “trigger” and it would for the first calendar sensor but not the rest. I have no idea if I just am adding more sensors incorrectly or what. Any help would be appreaciated. Code from the template.yaml is below. PS- I get this error in Studio Code Server whenever I try to save anything: “Failed to save ‘template.yaml’: The content of the file is newer. Please compare your version with the file contents or overwrite the content of the file with your changes.”
- trigger:
- trigger: time_pattern
hours: /1
- trigger: homeassistant
event: start
action:
- action: calendar.get_events
target:
entity_id:
- calendar.family
data:
duration:
days: 30
response_variable: calendar_events
sensor:
- name: Family Calendar Feed
unique_id: calenddar_family_feed
icon: mdi:calendar
state: "{{ calendar_events['calendar.family'].events | count() }}"
attributes:
events: "{{ calendar_events['calendar.family'].events }}"
- trigger:
- trigger: time_pattern
hours: /1
- trigger: homeassistant
event: start
action:
- action: calendar.get_events
target:
entity_id:
- calendar.jen
data:
duration:
days: 30
response_variable: calendar_events
sensor:
- name: Ben's Calendar Feed
unique_id: calendar_ben_feed
icon: mdi:calendar
state: "{{ calendar_events['calendar.Ben'].events | count() }}"
attributes:
events: "{{ calendar_events['calendar.Ben'].events }}"
- trigger:
- trigger: time_pattern
hours: /1
- trigger: homeassistant
event: start
action:
- action: calendar.get_events
target:
entity_id:
- calendar.bob
data:
duration:
days: 30
response_variable: calendar_events
sensor:
- name: Bob's Calendar Feed
unique_id: calenddar_bob_feed
icon: mdi:calendar
state: "{{ calendar_events['calendar.bob'].events | count() }}"
attributes:
events: "{{ calendar_events['calendar.bob'].events }}"
- trigger:
- trigger: time_pattern
hours: /1
- trigger: homeassistant
event: start
action:
- action: calendar.get_events
target:
entity_id:
- calendar.d
data:
duration:
days: 30
response_variable: calendar_events
sensor:
- name: D's Calendar Feed
unique_id: calendar_d_feed
icon: mdi:calendar
state: "{{ calendar_events['calendar.d'].events | count() }}"
attributes:
events: "{{ calendar_events['calendar.d'].events }}"
- trigger:
- trigger: time_pattern
hours: /1
- trigger: homeassistant
event: start
action:
- action: calendar.get_events
target:
entity_id:
- calendar.ziggy
data:
duration:
days: 30
response_variable: calendar_events
sensor:
- name: Ziggy's Calendar Feed
unique_id: calendar_ziggy_feed
icon: mdi:calendar
state: "{{ calendar_events['calendar.ziggy'].events | count() }}"
attributes:
events: "{{ calendar_events['calendar.ziggy'].events }}"
- trigger:
- trigger: time_pattern
hours: /1
- trigger: homeassistant
event: start
action:
- action: calendar.get_events
target:
entity_id:
- calendar.natsra
data:
duration:
days: 30
response_variable: calendar_events
sensor:
- name: natsra Calendar Feed
unique_id: calenddar_natsra_feed
icon: mdi:calendar
state: "{{ calendar_events['calendar.natsra'].events | count() }}"
attributes:
events: "{{ calendar_events['calendar.natsra'].events }}"
- trigger:
- trigger: time_pattern
hours: /1
- trigger: homeassistant
event: start
action:
- action: calendar.get_events
target:
entity_id:
- calendar.birthdays
data:
duration:
days: 30
response_variable: calendar_events
sensor:
- name: Birthdays Calendar Feed
unique_id: calendar_birthdays_feed
icon: mdi:calendar
state: "{{ calendar_events['calendar.birthdays'].events | count() }}"
attributes:
events: "{{ calendar_events['calendar.birthdays'].events }}"
- trigger:
- trigger: time_pattern
hours: /1
- trigger: homeassistant
event: start
action:
- action: calendar.get_events
target:
entity_id:
- calendar.school
data:
duration:
days: 30
response_variable: calendar_events
sensor:
- name: School Calendar Feed
unique_id: calendar_school_feed
icon: mdi:calendar
state: "{{ calendar_events['calendar.school'].events | count() }}"
attributes:
events: "{{ calendar_events['calendar.school'].events }}"
- trigger:
- trigger: time_pattern
hours: /1
- trigger: homeassistant
event: start
action:
- action: weather.get_forecasts
target:
entity_id: weather.homefc
data:
type: hourly
response_variable: hourly
- action: weather.get_forecasts
target: entity_id:weather.homefc
data:
type: daily
response_variable: daily
sensor:
- name: Weather Forecast Test
unique_id: weather_forecast_test
state: "{{ now().isoformat() }}"
attributes:
now_condition: "{{ daily['weather.homefc'].forecast[0].condition }}"
now_icon: >
{% set weather = hourly['weather.homefc'].forecast[0].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/weather/' + weather + '.svg' }}
{% else %}
{{ '/local/weather/' + weather + '_night.svg' }}
{% endif %}
now_temp: "{{ hourly['weather.homefc'].forecast[0].temperature }}"
now_wind_speed: "{{ ((hourly['weather.homefc'].forecast[0].wind_speed | float) / 3.6) | round(1) }}"
now_wind_bearing: "{{ hourly['weather.homefc'].forecast[0].wind_bearing }}"
now_precipitation: "{{ hourly['weather.homefc'].forecast[0].precipitation }}"
now_precipitation_probability: "{{ hourly['weather.homefc'].forecast[0].precipitation_probability }}"
now_humidity: "{{ hourly['weather.homefc'].forecast[0].humidity }}"
now_feels_like: >
{% set T = (hourly['weather.homefc'].forecast[0].temperature | float) %}
{% set K = (hourly['weather.homefc'].forecast[0].wind_speed | float)/3.6 %}
{% set V = (K/1000*60*60) %}
{% set A = 13.12 + 0.6215*T - 11.37*(V**0.16) + 0.3965*T*(V**0.16) %}
{{ (A) | round(1) }}
now_wind_direction: >
{% set direction = ['N','NNØ','NØ','ØNØ','Ø','ØSØ','SØ','SSØ','S','SSV','SV','VSV','V','VNV','NV','NNV','N'] %}
{% set degree = (hourly['weather.homefc'].forecast[0].wind_bearing | float) %}
{{ direction[((degree+11.25)/22.5)|int] }}
now_wind_desc: "{{ hourly['weather.homefc'].forecast[0].wind_speed | float }}"
today_condition: "{{ daily['weather.homefc'].forecast[0].condition }}"
today_icon: >
{% set weather = daily['weather.homefc'].forecast[0].condition %}
{{ '/local/weather/' + weather + '.svg' }}
today_temp: "{{ daily['weather.homefc'].forecast[0].temperature }}"
today_wind_speed: "{{ ((daily['weather.homefc'].forecast[0].wind_speed | float) / 3.6) | round(1) }}"
today_wind_bearing: "{{ daily['weather.homefc'].forecast[0].wind_bearing }}"
today_precipitation: "{{ daily['weather.homefc'].forecast[0].precipitation }}"
today_precipitation_probability: "{{ daily['weather.homefc'].forecast[0].precipitation_probability }}"
today_humidity: "{{ daily['weather.homefc'].forecast[0].humidity }}"
today_feels_like: >
{% set T = (daily['weather.homefc'].forecast[0].temperature | float) %}
{% set K = (daily['weather.homefc'].forecast[0].wind_speed | float)/3.6 %}
{% set V = (K/1000*60*60) %}
{% set A = 13.12 + 0.6215*T - 11.37*(V**0.16) + 0.3965*T*(V**0.16) %}
{{ (A) | round(1) }}
today_wind_direction: >
{% set direction = ['N','NNØ','NØ','ØNØ','Ø','ØSØ','SØ','SSØ','S','SSV','SV','VSV','V','VNV','NV','NNV','N'] %}
{% set degree = (daily['weather.homefc'].forecast[0].wind_bearing | float) %}
{{ direction[((degree+11.25)/22.5)|int] }}
today_wind_desc: "{{ daily['weather.homefc'].forecast[0].wind_speed | float }}"
forc1_datetime: "{{ daily['weather.homefc'].forecast[1].datetime }}"
forc1_condition: "{{ daily['weather.homefc'].forecast[1].condition }}"
forc1_icon: >
{% set weather = ['dailyweather.homefc'].forecast[1].condition %}
{{ '/local/weather/' + weather + '.svg' }}
forc1_temp: "{{ daily['weather.homefc'].forecast[1].temperature }}"
forc1_precipitation: "{{ daily['weather.homefc'].forecast[1].precipitation }}"
forc2_datetime: "{{ daily['weather.homefc'].forecast[2].datetime }}"
forc2_condition: "{{ daily['weather.homefc'].forecast[2].condition }}"
forc2_icon: >
{% set weather = ['dailyweather.homefc'].forecast[2].condition %}
{{ '/local/weather/' + weather + '.svg' }}
forc2_temp: "{{ daily['weather.homefc'].forecast[2].temperature }}"
forc2_precipitation: "{{ daily['weather.homefc'].forecast[2].precipitation }}"
forc3_datetime: "{{ daily['weather.homefc'].forecast[3].datetime }}"
forc3_condition: "{{ daily['weather.homefc'].forecast[3].condition }}"
forc3_icon: >
{% set weather = daily['weather.homefc'].forecast[3].condition %}
{{ '/local/weather/' + weather + '.svg' }}
forc3_temp: "{{ daily['weather.homefc'].forecast[3].temperature }}"
forc3_precipitation: "{{ daily['weather.homefc'].forecast[3].precipitation }}"
forc4_datetime: "{{ daily['weather.homefc'].forecast[4].datetime }}"
forc4_condition: "{{ daily['weather.homefc'].forecast[4].condition }}"
forc4_icon: >
{% set weather = ['dailyweather.homefc'].forecast[4].condition %}
{{ '/local/weather/' + weather + '.svg' }}
forc4_temp: "{{ daily['weather.homefc'].forecast[4].temperature }}"
forc4_precipitation: "{{ daily['weather.homefc'].forecast[4].precipitation }}"
forc5_datetime: "{{ daily['weather.homefc'].forecast[5].datetime }}"
forc5_condition: "{{ daily['weather.homefc'].forecast[5].condition }}"
forc5_icon: >
{% set weather = daily['weather.homefc'].forecast[5].condition %}
{{ '/local/weather/' + weather + '.svg' }}
forc5_temp: "{{ daily['weather.homefc'].forecast[5].temperature }}"
forc5_precipitation: "{{ daily['weather.homefc'].forecast[5].precipitation }}"
- trigger:
- trigger: time_pattern
hours: /1
- trigger: homeassistant
event: start
action:
- service: weather.get_forecasts
target:
entity_id: weather.homefc
data:
type: daily
response_variable: daily
sensor:
- name: Tutorial Weather Forecast
unique_id: tutorial_weather_forecast
state: "Something"
attributes:
condition: "{{ daily['weather.homefc'].forecast[0].condition }}"
temperature: "{{ daily['weather.homefc'].forecast[0].temperature }}"
precipitation: "{{ daily['weather.homefc'].forecast[0].precipitation }}"
precipitation_percent: "{{ daily['weather.homefc'].forecast[0].precipitation_probability }}"
wind_speed: "{{ daily['weather.homefc'].forecast[0].wind_speed }}"
cond_icon: >
{% set weather = daily['weather.homefc'].forecast[0].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/ic/weather_icons/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather_icons/' + weather + '_night.svg' }}
{% endif %}
feels_like: >
{% set T = (daily['weather.homefc'].forecast[0].temperature | float) %}
{% set K = (daily['weather.homefc'].forecast[0].wind_speed | float)/3.6 %}
{% set V = (K/1000*60*60) %}
{% set A = 13.12 + 0.6215*T - 11.37*(V**0.16) + 0.3965*T*(V**0.16) %}
{{ (A) | round(1) }}
wind_dir: >
{% set direction = ['N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW','N'] %}
{% set degree = (daily['weather.homefc'].forecast[0].wind_bearing | float) %}
{{ direction[((degree+11.25)/22.5)|int] }}
wind_desc: >
{% set sensor = (daily['weather.homefc'].forecast[0].wind_speed | float) %}
{% if sensor > 0 and sensor < 0.99 %}
Calm
{% elif sensor > 1 and sensor < 6.99 %}
Light air
{% elif sensor > 7 and sensor < 11.99 %}
Light breeze
{% elif sensor > 12 and sensor < 19.99 %}
Gentle breeze
{% elif sensor > 20 and sensor < 29.99 %}
Moderate breeze
{% elif sensor > 30 and sensor < 39.99 %}
Fresh breeze
{% elif sensor > 40 and sensor < 50.99 %}
Strong breeze
{% elif sensor > 51 and sensor < 62.99 %}
Near gale
{% elif sensor > 63 and sensor < 75.99 %}
Gale
{% elif sensor > 76 and sensor < 87.99 %}
Strong gale
{% elif sensor > 88 and sensor < 102.99 %}
Storm
{% elif sensor > 103 and sensor < 117.99 %}
Violent storm
{% else %}
Hurricane
{% endif %}
datetime1: "{{ daily['weather.homefc'].forecast[1].datetime }}"
condition1: "{{ daily['weather.homefc'].forecast[1].condition }}"
cond_icon1: >
{% set weather = daily['weather.homefc'].forecast[1].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/ic/weather_icons/animated3/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather_icons/animated3/' + weather + '_night.svg' }}
{% endif %}
temperature1: "{{ daily['weather.homefc'].forecast[1].temperature }}"
precipitation1: "{{ daily['weather.homefc'].forecast[1].precipitation }}"
datetime2: "{{ daily['weather.homefc'].forecast[2].datetime }}"
condition2: "{{ daily['weather.homefc'].forecast[2].condition }}"
cond_icon2: >
{% set weather = daily['weather.homefc'].forecast[2].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/ic/weather_icons/animated3/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather_icons/animated3/' + weather + '_night.svg' }}
{% endif %}
temperature2: "{{ daily['weather.homefc'].forecast[2].temperature }}"
precipitation2: "{{ daily['weather.homefc'].forecast[2].precipitation }}"
datetime3: "{{ daily['weather.homefc'].forecast[3].datetime }}"
condition3: "{{ daily['weather.homefc'].forecast[3].condition }}"
cond_icon3: >
{% set weather = daily['weather.homefc'].forecast[3].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/ic/weather_icons/animated3/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather_icons/animated3/' + weather + '_night.svg' }}
{% endif %}
temperature3: "{{ daily['weather.homefc'].forecast[3].temperature }}"
precipitation3: "{{ daily['weather.homefc'].forecast[3].precipitation }}"
datetime4: "{{ daily['weather.homefc'].forecast[4].datetime }}"
condition4: "{{ daily['weather.homefc'].forecast[4].condition }}"
cond_icon4: >
{% set weather = daily['weather.homefc'].forecast[4].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/ic/weather_icons/animated3/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather_icons/animated3/' + weather + '_night.svg' }}
{% endif %}
temperature4: "{{ daily['weather.homefc'].forecast[4].temperature }}"
precipitation4: "{{ daily['weather.homefc'].forecast[4].precipitation }}"
datetime5: "{{ daily['weather.homefc'].forecast[5].datetime }}"
condition5: "{{ daily['weather.homefc'].forecast[5].condition }}"
cond_icon5: >
{% set weather = daily['weather.homefc'].forecast[5].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/ic/weather_icons/animated3/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather_icons/animated3/' + weather + '_night.svg' }}
{% endif %}
temperature5: "{{ daily['weather.homefc'].forecast[5].temperature }}"
precipitation5: "{{ daily['weather.homefc'].forecast[5].precipitation }}"