core: Islamic Prayer Times issue with the sensor integration after Core update - does not support platform setup
The problem
Hi HA community,
after I update the system to the recent version the slamic Prayer Times sensor stop working. it seems the new update time template is not compatiable with the integration. see below log
Logger: homeassistant.components.template.trigger Source: components/template/trigger.py:60 Integration: template (documentation, issues) First occurred: 11:22:39 PM (17 occurrences) Last logged: 11:22:39 PM
Error initializing ‘template’ trigger for ‘Sunrise’: ValueError: Template error: strptime got invalid input ‘2022-06-07T09:42:00+00:00’ when rendering template ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.sunrise_time”), “%Y-%m-%dT%H:%M:%S”)) }}’ but no default was specified
Error initializing ‘template’ trigger for ‘Duher reminder’: ValueError: Template error: strptime got invalid input ‘2022-06-07T17:21:00+00:00’ when rendering template ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.dhuhr_prayer”), “%Y-%m-%dT%H:%M:%S”)) -600 }}’ but no default was specified
Error initializing ‘template’ trigger for ‘Asr reminder’: ValueError: Template error: strptime got invalid input ‘2022-06-07T21:26:00+00:00’ when rendering template ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.asr_prayer”), “%Y-%m-%dT%H:%M:%S”)) -600 }}’ but no default was specified
Error initializing ‘template’ trigger for ‘Magrib reminder’: ValueError: Template error: strptime got invalid input ‘2022-06-08T01:00:00+00:00’ when rendering template ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.maghrib_prayer”), “%Y-%m-%dT%H:%M:%S”)) -600 }}’ but no default was specified
Error initializing ‘template’ trigger for ‘Isha reminder’: ValueError: Template error: strptime got invalid input ‘2022-06-08T02:48:00+00:00’ when rendering template ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.isha_prayer”), “%Y-%m-%dT%H:%M:%S”)) -600 }}’ but no default was specified
What version of Home Assistant Core has the issue?
Home Assistant Core 2022.6.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Islamic Prayer Times
Link to integration documentation on our website
https://www.home-assistant.io/integrations/islamic_prayer_times/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Error evaluating 'template' trigger for 'Sunrise': ValueError: Template error: strptime got invalid input '2022-06-07T09:42:00+00:00' when rendering template '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.sunrise_time"), "%Y-%m-%dT%H:%M:%S")) }}' but no default was specified
11:22:41 PM – (WARNING) template - message first occurred at 11:22:41 PM and shows up 17 times
Error while processing template: Template("{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.sunrise_time"), "%Y-%m-%dT%H:%M:%S")) }}")
11:22:39 PM – (ERROR) helpers/template.py - message first occurred at 11:22:39 PM and shows up 17 times
Error initializing 'template' trigger for 'Sunrise': ValueError: Template error: strptime got invalid input '2022-06-07T09:42:00+00:00' when rendering template '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.sunrise_time"), "%Y-%m-%dT%H:%M:%S")) }}' but no default was specified
11:22:39 PM – (WARNING) template - message first occurred at 11:22:39 PM and shows up 17 times
The islamic_prayer_times platform for the sensor integration does not support platform setup. Please remove it from your config.
11:22:22 PM – (ERROR) Sensor
2022-06-07 23:22:22 ERROR (MainThread) [homeassistant.components.sensor] The islamic_prayer_times platform for the sensor integration does not support platform setup. Please remove it from your config.
2022-06-07 23:22:39 WARNING (MainThread) [homeassistant.components.template.trigger] Error initializing 'template' trigger for 'Adhan': ValueError: Template error: strptime got invalid input 'unknown' when rendering template '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_times_fajr_prayer"), "%Y-%m-%dT%H:%M:%S")) }}' but no default was specified
2022-06-07 23:22:39 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_times_fajr_prayer"), "%Y-%m-%dT%H:%M:%S")) }}")
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1546, in strptime
return datetime.strptime(string, fmt)
File "/usr/local/lib/python3.9/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/local/lib/python3.9/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data 'unknown' does not match format '%Y-%m-%dT%H:%M:%S'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 409, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1842, in _render_with_context
return template.render(**kwargs)
File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/usr/local/lib/python3.9/site-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1549, in strptime
raise_no_default("strptime", string)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1331, in raise_no_default
raise ValueError(
ValueError: Template error: strptime got invalid input 'unknown' when rendering template '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_times_fajr_prayer"), "%Y-%m-%dT%H:%M:%S")) }}' 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 525, in async_render_to_info
render_info._result = self.async_render(variables, strict=strict, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 411, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: strptime got invalid input 'unknown' when rendering template '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_times_fajr_prayer"), "%Y-%m-%dT%H:%M:%S")) }}' but no default was specified
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (2 by maintainers)
@home-assistant close
Instead of a Template Trigger, use a Time Trigger. The sensor’s time format is ideal for use in a Time Trigger.