2023-10-10 12:18:31.997 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=(#### TERREMOTI - ULTIME 24h [<img src="https://www.hsit.it/images/favicon.png"/> Hai Sentito Il Terremoto](http://www.haisentitoilterremoto.it/)
<!-- Setting -->
{%- set person = 'person.maurizio' -%}
{%- set url = "https://shakemap.rm.ingv.it/shake/{}/download/{}.jpg" -%}
{%- set entityid = 'binary_sensor.lastquake' -%}
{%- set id = state_attr(entityid, 'event_id') -%}
{%- set data_utc = state_attr(entityid, 'publication_date') -%}
{%- set magnitudo = (state_attr(entityid, 'magnitude')|float) if not none else '0' -%}
{%- set code = {0:'White', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} -%}
{%- set color = code[state_attr('binary_sensor.lastquake', 'level')|int] -%}
{%- set lat = state_attr(entityid, 'lat') -%}
{%- set long = state_attr(entityid, 'long') -%}
<font>
**<font color="{{color}}">{{as_timestamp(data_utc)|timestamp_custom ('%H:%M:%S del %d/%m/%Y')}}</font>**<br><br> Un terremoto di magnitudo **<font color="{{color}}">{{magnitudo}}</font>**<br> è avvenuto nella zona: [{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=12/{{lat}}/{{long}})<br> a <font color="{{color}}">**{{state_attr(entityid, 'distance')}}**</font> km da casa,<br> con coordinate geografiche (lat, long) {{lat}},{{long}}.<br> {{("Tu ti trovi a " ~ distance(lat, long, person)) ~ " km dall'epicentro." if is_state(person, 'not_home') else ''}} </font> {% if magnitudo >= 3 %}<br> [Shakemap]({{url.format(id,'intensity')}}) ~ [PGA]({{url.format(id,'pga')}}) ~ [PGV]({{url.format(id,'pgv')}}) ~ [TvMap]({{url.format(id,'tvmap')}}) ~ [TvMap2]({{url.format(id,'tvmap_bare')}}) ~ [HaiSentitoIlTerremoto](http://eventi.haisentitoilterremoto.it/{{id}}/{{id}}_mcs.jpg)
<!-- Scegli il tipo di immagine da visualizzare [intensity,pga,pgv,tvmap,tvmap_bare] -->
<img src="{{url.format(id,'intensity')}}"/>
<!-- <img src="{{url.format(id,'pga')}}"/> -->
{% endif %}
<!--
Map Google
[{{state_attr(entityid, 'region')}}](http://maps.google.com/maps?z=8&q=loc:{{lat}}+{{long}})
Map Open Streat Map
[{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=8/{{lat}}/{{long}})
-->) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1925, in forgiving_float_filter
return float(value)
^^^^^^^^^^^^
ValueError: could not convert string to float: ''
During handling of the above exception, another exception occurred:
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 2196, 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 "<template>", line 8, in top-level template code
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1928, in forgiving_float_filter
raise_no_default("float", value)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1626, in raise_no_default
raise ValueError(
ValueError: Template error: float got invalid input '' when rendering template '#### TERREMOTI - ULTIME 24h [<img src="https://www.hsit.it/images/favicon.png"/> Hai Sentito Il Terremoto](http://www.haisentitoilterremoto.it/)
<!-- Setting -->
{%- set person = 'person.maurizio' -%}
{%- set url = "https://shakemap.rm.ingv.it/shake/{}/download/{}.jpg" -%}
{%- set entityid = 'binary_sensor.lastquake' -%}
{%- set id = state_attr(entityid, 'event_id') -%}
{%- set data_utc = state_attr(entityid, 'publication_date') -%}
{%- set magnitudo = (state_attr(entityid, 'magnitude')|float) if not none else '0' -%}
{%- set code = {0:'White', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} -%}
{%- set color = code[state_attr('binary_sensor.lastquake', 'level')|int] -%}
{%- set lat = state_attr(entityid, 'lat') -%}
{%- set long = state_attr(entityid, 'long') -%}
<font>
**<font color="{{color}}">{{as_timestamp(data_utc)|timestamp_custom ('%H:%M:%S del %d/%m/%Y')}}</font>**<br><br> Un terremoto di magnitudo **<font color="{{color}}">{{magnitudo}}</font>**<br> è avvenuto nella zona: [{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=12/{{lat}}/{{long}})<br> a <font color="{{color}}">**{{state_attr(entityid, 'distance')}}**</font> km da casa,<br> con coordinate geografiche (lat, long) {{lat}},{{long}}.<br> {{("Tu ti trovi a " ~ distance(lat, long, person)) ~ " km dall'epicentro." if is_state(person, 'not_home') else ''}} </font> {% if magnitudo >= 3 %}<br> [Shakemap]({{url.format(id,'intensity')}}) ~ [PGA]({{url.format(id,'pga')}}) ~ [PGV]({{url.format(id,'pgv')}}) ~ [TvMap]({{url.format(id,'tvmap')}}) ~ [TvMap2]({{url.format(id,'tvmap_bare')}}) ~ [HaiSentitoIlTerremoto](http://eventi.haisentitoilterremoto.it/{{id}}/{{id}}_mcs.jpg)
<!-- Scegli il tipo di immagine da visualizzare [intensity,pga,pgv,tvmap,tvmap_bare] -->
<img src="{{url.format(id,'intensity')}}"/>
<!-- <img src="{{url.format(id,'pga')}}"/> -->
{% endif %}
<!--
Map Google
[{{state_attr(entityid, 'region')}}](http://maps.google.com/maps?z=8&q=loc:{{lat}}+{{long}})
Map Open Streat Map
[{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=8/{{lat}}/{{long}})
-->' but no default was specified
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: ValueError: Template error: float got invalid input '' when rendering template '#### TERREMOTI - ULTIME 24h [<img src="https://www.hsit.it/images/favicon.png"/> Hai Sentito Il Terremoto](http://www.haisentitoilterremoto.it/)
<!-- Setting -->
{%- set person = 'person.maurizio' -%}
{%- set url = "https://shakemap.rm.ingv.it/shake/{}/download/{}.jpg" -%}
{%- set entityid = 'binary_sensor.lastquake' -%}
{%- set id = state_attr(entityid, 'event_id') -%}
{%- set data_utc = state_attr(entityid, 'publication_date') -%}
{%- set magnitudo = (state_attr(entityid, 'magnitude')|float) if not none else '0' -%}
{%- set code = {0:'White', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} -%}
{%- set color = code[state_attr('binary_sensor.lastquake', 'level')|int] -%}
{%- set lat = state_attr(entityid, 'lat') -%}
{%- set long = state_attr(entityid, 'long') -%}
<font>
**<font color="{{color}}">{{as_timestamp(data_utc)|timestamp_custom ('%H:%M:%S del %d/%m/%Y')}}</font>**<br><br> Un terremoto di magnitudo **<font color="{{color}}">{{magnitudo}}</font>**<br> è avvenuto nella zona: [{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=12/{{lat}}/{{long}})<br> a <font color="{{color}}">**{{state_attr(entityid, 'distance')}}**</font> km da casa,<br> con coordinate geografiche (lat, long) {{lat}},{{long}}.<br> {{("Tu ti trovi a " ~ distance(lat, long, person)) ~ " km dall'epicentro." if is_state(person, 'not_home') else ''}} </font> {% if magnitudo >= 3 %}<br> [Shakemap]({{url.format(id,'intensity')}}) ~ [PGA]({{url.format(id,'pga')}}) ~ [PGV]({{url.format(id,'pgv')}}) ~ [TvMap]({{url.format(id,'tvmap')}}) ~ [TvMap2]({{url.format(id,'tvmap_bare')}}) ~ [HaiSentitoIlTerremoto](http://eventi.haisentitoilterremoto.it/{{id}}/{{id}}_mcs.jpg)
<!-- Scegli il tipo di immagine da visualizzare [intensity,pga,pgv,tvmap,tvmap_bare] -->
<img src="{{url.format(id,'intensity')}}"/>
<!-- <img src="{{url.format(id,'pga')}}"/> -->
{% endif %}
<!--
Map Google
[{{state_attr(entityid, 'region')}}](http://maps.google.com/maps?z=8&q=loc:{{lat}}+{{long}})
Map Open Streat Map
[{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=8/{{lat}}/{{long}})
-->' but no default was specified
Never seen before....