Why does this sensor fail at HA Start but if I then reload REST entities from the Dev tools it works?
I appreciate that you won’t be able to directly test this without an api code but I’m hoping that won’t be necessary.
Thanks.
sensor:
- platform: rest
name: tomorrow_io_data
unique_id: tomorrow_io_data
resource_template: >
{% set latitude = state_attr('zone.home', 'latitude') %}
{% set longitude = state_attr('zone.home', 'longitude') %}
{% set fields = [
"temperature",
"temperatureApparent",
"dewPoint",
"windSpeed",
"windDirection",
"windGust",
"humidity",
"precipitationIntensity",
"rainIntensity",
"freezingRainIntensity",
"snowIntensity",
"sleetIntensity",
"precipitationProbability",
"precipitationType",
"rainAccumulation",
"snowAccumulation",
"visibility",
"cloudCover",
"cloudBase",
"cloudCeiling",
"uvIndex",
"uvHealthConcern",
"evapotranspiration",
"weatherCode",
"weatherCodeDay",
"weatherCodeNight"
] %}
{% set timesteps = ["current", "1h", "1d"] %}
{% set start_time = states('sensor.date_time_iso') %}
{% set end_time = (as_datetime(start_time) + timedelta(days = 1)) | replace(' ', 'T') %}
{% set get_url = 'https://api.tomorrow.io/v4/timelines?location=' ~
latitude ~ ',' ~
longitude ~
'&fields=' ~ fields | join(',') ~
'×teps=' ~ timesteps | join(',') ~
'&startTime=' ~ start_time ~
'&endTime=' ~ end_time ~
'&timezone=Europe/London' ~
'&units=metric' ~
'&apikey=xxxxx' %}
{{ get_url }}
value_template: >
Timestamp: {{ now() }}
json_attributes_path: $.data
json_attributes:
- timelines
scan_interval:
minutes: 15
After reload…