Closed Donovan-CK-Energy closed 11 months ago
Problem has been resolved. It is my second API key and on the same public IP address and hence they were blocking this as account abuse.
I restarted my ONT and received a new public IP address and problem is solved.
The API is not pulling the load shedding stage and as a result the forecast is not available. See the log below:
Logger: homeassistant.helpers.event Source: helpers/template.py:570 First occurred: 07:42:22 (71 occurrences) Last logged: 07:56:48
Error while processing template: Template<template=({% set stage_sensor = "sensor.load_shedding_stage_capetown" %} {% set area_sensor = "sensor.load_shedding_area_westerncape_12_george" %} {% set area_schedule = state_attr(area_sensor, "forecast") %} {% if area_schedule %} {% set start_time = area_schedule[0].start_time %} {% set end_time = area_schedule[0].end_time %} {% if is_state(area_sensor, "off") %} {% set starts_in = timedelta(minutes=state_attr(area_sensor, "starts_in")).total_seconds() | int // 60 %} {% set mins = starts_in % 60 %} {% set hrs = starts_in // 60 % 24 %} {% set days = starts_in // 1440 %} {% set alert = "Load Shedding starts in {d}d {h}h {m}m ({next})".format(d=days, m=mins, h=hrs, next=as_timestamp(start_time) | timestamp_custom("%H:%M", True)) %} {% if starts_in > 1440 %}{{ states(stage_sensor) }} {% elif 60 < starts_in <= 1440 %} {{ alert }} {% else %} {{ alert }} {% endif %} {% else %} {% set ends_in = timedelta(minutes=state_attr(area_sensor, "ends_in")).total_seconds() | int // 60 %} {% set mins = ends_in % 60 %} {% set hrs = ends_in // 60 % 24 %} {% set days = ends_in // 1440 %} {% set alert = "Load Shedding ends in {d}d {h}h {m}m ({next})".format(d=days, m=mins, h=hrs, next=as_timestamp(end_time) | timestamp_custom("%H:%M", True)) %} {{ alert }} {% endif %} {% else %} {% set stage = state_attr(stage_sensor, "next_stage") %} {% set start_time = state_attr(stage_sensor, "next_start_time") %} {% set end_time = state_attr(stage_sensor, "next_end_time") %} {% set starts_in = timedelta(minutes=state_attr(stage_sensor, "starts_in")).total_seconds() | int // 60 %} {% set mins = starts_in % 60 %} {% set hrs = starts_in // 60 % 24 %} {% set days = starts_in // 1440 %} {% if (start_time == 0 or end_time == 0) %} {% set alert = "No Load Shedding" %} {% else %} {% set alert = "Stage {stage} starts in {d}d {h}h {m}m ({next})".format(stage=stage, d=days, m=mins, h=hrs, next=as_timestamp(start_time) | timestamp_custom("%H:%M", True)) %} {% endif %} {{ alert }} {% endif %}) renders=68>
Error while processing template: Template<template=({% set stage_sensor = "sensor.load_shedding_stage_capetown" %} {% set area_sensor = "sensor.load_sheddingarea" %} {% set area_schedule = state_attr(area_sensor, "forecast") %} {% if area_schedule %} {% set start_time = area_schedule[0].start_time %} {% set end_time = area_schedule[0].end_time %} {% if is_state(area_sensor, "off") %} {% set starts_in = timedelta(minutes=state_attr(area_sensor, "starts_in")).total_seconds() | int // 60 %} {% set mins = starts_in % 60 %} {% set hrs = starts_in // 60 % 24 %} {% set days = starts_in // 1440 %} {% set alert = "Load Shedding starts in {d}d {h}h {m}m ({next})".format(d=days, m=mins, h=hrs, next=as_timestamp(start_time) | timestamp_custom("%H:%M", True)) %} {% if starts_in > 1440 %} {{ states(stage_sensor) }} {% elif 60 < starts_in <= 1440 %} {{ alert }} {% else %} {{ alert }} {% endif %} {% else %} {% set ends_in = timedelta(minutes=state_attr(area_sensor, "ends_in")).total_seconds() | int // 60 %} {% set mins = ends_in % 60 %} {% set hrs = ends_in // 60 % 24 %} {% set days = ends_in // 1440 %} {% set alert = "Load Shedding ends in {d}d {h}h {m}m ({next})".format(d=days, m=mins, h=hrs, next=as_timestamp(end_time) | timestamp_custom("%H:%M", True)) %} {{ alert }} {% endif %} {% else %} {% set stage = state_attr(stage_sensor, "next_stage") %} {% set start_time = state_attr(stage_sensor, "next_start_time") %} {% set end_time = state_attr(stage_sensor, "next_end_time") %} {% set starts_in = timedelta(minutes=state_attr(stage_sensor, "starts_in")).total_seconds() | int // 60 %} {% set mins = starts_in % 60 %} {% set hrs = starts_in // 60 % 24 %} {% set days = starts_in // 1440 %} {% if (start_time == 0 or end_time == 0) %} {% set alert = "No Load Shedding" %} {% else %} {% set alert = "Stage {stage} starts in {d}d {h}h {m}m ({next})".format(stage=stage, d=days, m=mins, h=hrs, next=as_timestamp(start_time) | timestamp_custom("%H:%M", True)) %} {% endif %} {{ alert }} {% endif %}) renders=30>
Error while processing template: Template<template=({% set stage_sensor = "sensor.load_shedding_stage_capetown" %} {% set area_sensor = "sensor.load_shedding_area_westerncape_12_george" %} {% set area_schedule = state_attr(area_sensor, "forecast") %} {% if area_schedule %} {% set start_time = area_schedule[0].start_time %} {% set end_time = area_schedule[0].end_time %} {% if is_state(area_sensor, "off") %} {% set starts_in = timedelta(minutes=state_attr(area_sensor, "starts_in")).total_seconds() | int // 60 %} {% set mins = starts_in % 60 %} {% set hrs = starts_in // 60 % 24 %} {% set days = starts_in // 1440 %} {% set alert = "Load Shedding starts in {d}d {h}h {m}m ({next})".format(d=days, m=mins, h=hrs, next=as_timestamp(start_time) | timestamp_custom("%H:%M", True)) %} {% if starts_in > 1440 %} {{ states(stage_sensor) }} {% elif 60 < starts_in <= 1440 %} {{ alert }} {% else %} {{ alert }} {% endif %} {% else %} {% set ends_in = timedelta(minutes=state_attr(area_sensor, "ends_in")).total_seconds() | int // 60 %} {% set mins = ends_in % 60 %} {% set hrs = ends_in // 60 % 24 %} {% set days = ends_in // 1440 %} {% set alert = "Load Shedding ends in {d}d {h}h {m}m ({next})".format(d=days, m=mins, h=hrs, next=as_timestamp(end_time) | timestamp_custom("%H:%M", True)) %} {{ alert }} {% endif %} {% else %} {% set stage = state_attr(stage_sensor, "next_stage") %} {% set start_time = state_attr(stage_sensor, "next_start_time") %} {% set end_time = state_attr(stage_sensor, "next_end_time") %} {% set starts_in = timedelta(minutes=state_attr(stage_sensor, "starts_in")).total_seconds() | int // 60 %} {% set mins = starts_in % 60 %} {% set hrs = starts_in // 60 % 24 %} {% set days = starts_in // 1440 %} {% if (start_time == 0 or end_time == 0) %} {% set alert = "No Load Shedding" %} {% else %} {% set alert = "Stage {stage} starts in {d}d {h}h {m}m ({next})".format(stage=stage, d=days, m=mins, h=hrs, next=as_timestamp(start_time) | timestamp_custom("%H:%M", True)) %} {% endif %} {{ alert }} {% endif %}) renders=70>
Error while processing template: Template<template=({% set stage_sensor = "sensor.load_shedding_stage_capetown" %} {% set area_sensor = "sensor.load_shedding_area_westerncape_12_george" %} {% set area_schedule = state_attr(area_sensor, "forecast") %} {% if area_schedule %} {% set start_time = area_schedule[0].start_time %} {% set end_time = area_schedule[0].end_time %} {% if is_state(area_sensor, "off") %} {% set starts_in = timedelta(minutes=state_attr(area_sensor, "starts_in")).total_seconds() | int // 60 %} {% set mins = starts_in % 60 %} {% set hrs = starts_in // 60 % 24 %} {% set days = starts_in // 1440 %} {% set alert = "Load Shedding starts in {d}d {h}h {m}m ({next})".format(d=days, m=mins, h=hrs, next=as_timestamp(start_time) | timestamp_custom("%H:%M", True)) %} {% if starts_in > 1440 %} {{ states(stage_sensor) }} {% elif 60 < starts_in <= 1440 %} {{ alert }} {% else %} {{ alert }} {% endif %} {% else %} {% set ends_in = timedelta(minutes=state_attr(area_sensor, "ends_in")).total_seconds() | int // 60 %} {% set mins = ends_in % 60 %} {% set hrs = ends_in // 60 % 24 %} {% set days = ends_in // 1440 %} {% set alert = "Load Shedding ends in {d}d {h}h {m}m ({next})".format(d=days, m=mins, h=hrs, next=as_timestamp(end_time) | timestamp_custom("%H:%M", True)) %} {{ alert }} {% endif %} {% else %} {% set stage = state_attr(stage_sensor, "next_stage") %} {% set start_time = state_attr(stage_sensor, "next_start_time") %} {% set end_time = state_attr(stage_sensor, "next_end_time") %} {% set starts_in = timedelta(minutes=state_attr(stage_sensor, "starts_in")).total_seconds() | int // 60 %} {% set mins = starts_in % 60 %} {% set hrs = starts_in // 60 % 24 %} {% set days = starts_in // 1440 %} {% if (start_time == 0 or end_time == 0) %} {% set alert = "No Load Shedding" %} {% else %} {% set alert = "Stage {stage} starts in {d}d {h}h {m}m ({next})".format(stage=stage, d=days, m=mins, h=hrs, next=as_timestamp(start_time) | timestamp_custom("%H:%M", True)) %} {% endif %} {{ alert }} {% endif %}) renders=72>
Error while processing template: Template<template=({% set stage_sensor = "sensor.load_shedding_stage_capetown" %} {% set area_sensor = "sensor.load_shedding_area_westerncape_12_george" %} {% set area_schedule = state_attr(area_sensor, "forecast") %} {% if area_schedule %} {% set start_time = area_schedule[0].start_time %} {% set end_time = area_schedule[0].end_time %} {% if is_state(area_sensor, "off") %} {% set starts_in = timedelta(minutes=state_attr(area_sensor, "starts_in")).total_seconds() | int // 60 %} {% set mins = starts_in % 60 %} {% set hrs = starts_in // 60 % 24 %} {% set days = starts_in // 1440 %} {% set alert = "Load Shedding starts in {d}d {h}h {m}m ({next})".format(d=days, m=mins, h=hrs, next=as_timestamp(start_time) | timestamp_custom("%H:%M", True)) %} {% if starts_in > 1440 %} {{ states(stage_sensor) }} {% elif 60 < starts_in <= 1440 %} {{ alert }} {% else %} {{ alert }} {% endif %} {% else %} {% set ends_in = timedelta(minutes=state_attr(area_sensor, "ends_in")).total_seconds() | int // 60 %} {% set mins = ends_in % 60 %} {% set hrs = ends_in // 60 % 24 %} {% set days = ends_in // 1440 %} {% set alert = "Load Shedding ends in {d}d {h}h {m}m ({next})".format(d=days, m=mins, h=hrs, next=as_timestamp(end_time) | timestamp_custom("%H:%M", True)) %} {{ alert }} {% endif %} {% else %} {% set stage = state_attr(stage_sensor, "next_stage") %} {% set start_time = state_attr(stage_sensor, "next_start_time") %} {% set end_time = state_attr(stage_sensor, "next_end_time") %} {% set starts_in = timedelta(minutes=state_attr(stage_sensor, "starts_in")).total_seconds() | int // 60 %} {% set mins = starts_in % 60 %} {% set hrs = starts_in // 60 % 24 %} {% set days = starts_in // 1440 %} {% if (start_time == 0 or end_time == 0) %} {% set alert = "No Load Shedding" %} {% else %} {% set alert = "Stage {stage} starts in {d}d {h}h {m}m ({next})".format(stage=stage, d=days, m=mins, h=hrs, next=as_timestamp(start_time) | timestamp_custom("%H:%M", True)) %} {% endif %} {{ alert }} {% endif %}) renders=74>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 568, in async_render
render_result = _render_with_context(self.template, compiled, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2198, in _render_with_context
return template.render(kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "", line 35, in top-level template code
File "/usr/local/lib/python3.11/site-packages/jinja2/sandbox.py", line 393, in call
return context.call(obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported type for timedelta minutes component: NoneType
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 694, in async_render_to_info render_info._result = self.async_render( ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 570, in async_render raise TemplateError(err) from err homeassistant.exceptions.TemplateError: TypeError: unsupported type for timedelta minutes component: NoneType