Closed Abdelmounaim18 closed 2 years ago
Salemoua3laykoum @Abdelmounaim18
As a user of the mawaqit integration, I can confirm that the mawaqit integration is compatible with the following Core version: "core-2022.2.6" because for me it works well.
Maybe you can try this :
Salem
Salaam @MehdiTouns31,
I tried that a couple of times but still no success. It indeed works in the new update, this just happens when reinstalling the Mawaqit integration in version 2022.2.6. I guess it has something to do with the config flow
and not with the sensors themselves, because they were just working fine (before I reinstalled the integration).
Edit: I changed the Issue title to be more specific.
Barak Allahu fikum The brother @yac69 is on it, we will update the component asap inshallah
Salam Aleikom could you please try the version attached if working with the last version of Hassio? just remove the last mawaqit folder in custom_components, restart hassio, and replace it by the folder mawaqit_prayer_times of the attached zip file. then install mawaqit integration and restart hassio to update the list of near by mosques. Barak Allah fikom. mawaqit_prayer_times.zip
@yac69 Jazāk Allāhu Khayran! It is working again. The sensors are showing up again and the setup went smooth.
The only thing i am still seeing in the logs is the following:
2022-02-17 22:04:29 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'timestamp_custom' got invalid input '22:04' when rendering template '{% set asr_time = as_timestamp(states("sensor.asr_mawaqit")) | timestamp_custom("%H:%M") %} {% set time = states("sensor.date_time").split(" ")[1] | timestamp_custom("%H:%M") %} {{ time == asr_time }}' but no default was specified. Currently 'timestamp_custom' will return '22:04', however this template will fail to render in Home Assistant core 2022.1
I think it has to do with the templating rules of Home Assistant, is there something to do about it?
Barak Allahu Fikum
Barak Allah fik @Abdelmounaim18 I will check the template warning and be back to you InshAllah. this is related to the automation for Athan call.
Salaam @yac69,
Any update on the templating for the Adhaan automation?
Assalam Aleikom, Sorry for the late reply attached an updated version of the plugin mawaqit_prayer_times (3).zip
I also added a blueprint to easily configure notification on mobile or media player: the folder mawaqit should be placed under /config/blueprints/automation/ restart hassio, then in the configuration of hassio, add automation and select the "Mawaqit Time Notification" blueprint.
mawaqit.zip der mawaqit should be placed under /config/blueprints/automation/
with the new version and in addition to the blueprint, you can use the automation as below:
no need for the automation if you use and configure the blueprint
@ibrahim-zehhaf-mawaqit : please update the github with the new files of the two attached zip files. I don't have push allowed. you can sychronise the folder structure as done in https://github.com/yac69/home-assistant-component
I m still having this error when connecting with my mawaqit account
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/mawaqit_prayer_times/__init__.py:286
Integration: Mawaqit
First occurred: 10:52:51 AM (2 occurrences)
Last logged: 10:55:37 AM
Error setting up entry Mawaqit for mawaqit_prayer_times
Traceback (most recent call last):
File "/config/custom_components/mawaqit_prayer_times/__init__.py", line 285, in async_setup
await self.hass.async_add_executor_job(self.get_new_prayer_times)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/mawaqit_prayer_times/__init__.py", line 190, in get_new_prayer_times
n = text_file.write(str(calc.fetch_prayer_times()))
File "/usr/local/lib/python3.9/site-packages/mawaqit_times_calculator/pray_times_calculator.py", line 102, in fetch_prayer_times
'Sunrise': response.json()["shuruq"],
KeyError: 'shuruq'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/mawaqit_prayer_times/__init__.py", line 72, in async_setup_entry
if not await client.async_setup():
File "/config/custom_components/mawaqit_prayer_times/__init__.py", line 286, in async_setup
except (exceptions.InvalidResponseError, ConnError) as err:
NameError: name 'exceptions' is not defined
Fixed, It was a backend issue thanks to the brother Rachid
choukran brother, it works now!
Salemoua3laykoum @mouledla @Abdelmounaim18 @yac69
All the templates used for automations Adhans, notifications 15 min before, wake up 1 hour before Fajr doesn't work anymore in HA CORE 2022.5.5.
This is an example of template :
{% set before = (as_timestamp(states("sensor.asr_mawaqit")) - 15 * 60) | timestamp_custom("%H:%M") %} {% set time = states("sensor.date_time").split(" ")[1] | timestamp_custom("%H:%M") %} {{ time == before }}
This error appears :
ValueError: Template error: timestamp_custom got invalid input '02:24' when rendering template '{% set before = (as_timestamp(states("sensor.asr_mawaqit")) - 15 * 60) | timestamp_custom("%H:%M") %} {% set time = states("sensor.date_time").split(" ")[1] | timestamp_custom("%H:%M") %} {{ time == before }}' but no default was specified
Do you know the new syntax to use for this template work with HA CORE 2022.5.5 ?
Thanks you very much.
WaAlaikoum Salaam @MehdiTouns31,
Since Home Assistant changed their templating rules, I use this automation below to play the adhan or send a notification.
I can’t remember where I found it, but it works perfectly fine (exact on time) with no errors.
You can customize the code after each sequence:
to your needs!
alias: Adhan Automation
description: ''
trigger:
- platform: time
at: sensor.fajr_mawaqit
id: Fajr
- platform: time
id: Dhuhr
at: sensor.dhuhr_mawaqit
- platform: time
id: Asr
at: sensor.asr_mawaqit
- platform: time
at: sensor.maghrib_mawaqit
id: Maghrib
- platform: time
at: sensor.isha_mawaqit
id: Isha
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: Fajr
sequence:
- service: notify.notify
data:
title: Adhan Fajr
message: 🕌 - Time to Pray
- conditions:
- condition: trigger
id: Dhuhr
sequence:
- service: notify.notify
data:
title: Adhan Dhuhr
message: 🕌 - Time to Pray
- conditions:
- condition: trigger
id: Asr
sequence:
- service: notify.notify
data:
title: Adhan Asr
message: 🕌 - Time to Pray
- conditions:
- condition: trigger
id: Maghrib
sequence:
- service: notify.notify
data:
title: Adhan Maghrib
message: 🕌 - Time to Pray
- conditions:
- condition: trigger
id: Isha
sequence:
- service: notify.notify
data:
title: Adhan Isha
message: 🕌 - Time to Pray
default: []
mode: single
@Abdelmounaim18 Thanks for your answer.
The automation adhan work perfectly with this trigger thanks you.
But I have other automations that doesn't work anymore : Notification 15 minutes before adhan or wake up 1 hour before Fajr time... Because of Home Assistant new templating rules.
Do you have an idea to update templates of this automations and make them work with new templating rules ?
Assalamo'Alaykom,
Could you please test with this template ?
{% set before = (as_timestamp(states("sensor.asr_mawaqit")) - 15 * 60) | timestamp_custom("%H:%M", True) %} {% set time = states("sensor.date_time").split(" ")[1] | timestamp_custom("%H:%M", True) %} {{ time == before }}
timestamp_custom has changed the spec. Now I think we have to set local as True or False. timestamp_custom(format_string, local=True, default)
See section Time in Documentation : _Filter timestamp_custom(formatstring, local=True, default) converts an UNIX timestamp to its string representation based on a custom format, the use of a local timezone is the default. If that fails, returns the default value, or if omitted raises an error. Supports the standard Python time formatting options.
Tell me know !
Wa3laykoumousalem @hajtux
I tried this template in developer tool section and the same error appears :
An other idea?
@MehdiTouns31, could you please check with this :
{% set salat_time = as_timestamp(states("sensor.asr_mawaqit")) | timestamp_custom("%H:%M", True) %} {% set time = states("sensor.date_time").split(" ")[1] %} {{ time == salat_time }}
It's work !
Now, it would be perfect if we could subtract for example 15 minutes in the template...
@MehdiTouns31, yes you can add "- 15 * 60" for the before variable as following
{% set before = (as_timestamp(states("sensor.asr_mawaqit")) - 15 * 60) | timestamp_custom("%H:%M", True) %} {% set time = states("sensor.date_time").split(" ")[1] %} {{ time == before }}
Barrakallahufik brother @hajtux !!
It's work perfectly. I updated all my automations (notifications, announcement, and wake up) before prayers time.
@ibrahim-zehhaf-mawaqit @yac69 could you fixe the new syntaxe of "value_template" in "Quran before Prayer Time" section and "Annonce before Prayer Time" section of configuration.yaml file ? Because these value_template are no longer compatible with the HA version 2022.5.5.
As-salāmu ʿalaykum @yac69 @ibrahim-zehhaf-mawaqit,
As of today my Mawaqit instance in Home Assistant was not working properly, after updating to version:
So I tried removing the integration an reinstalling it again. But now am i getting this error when setting up a new instance.
The logs are not showing any errors, just the usual:
We found a custom integration mawaqit which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
I hope there is a fix for this, cause now my automations are not working.
FYI: Before it was working, i did see this error regarding the templating for the automation:
Template warning: 'as_timestamp' got invalid input 'unknown' when rendering template '{% set asr_time = as_timestamp(states("sensor.asr_mawaqit")) | timestamp_custom("%H:%M") %} {% set time = states("sensor.date_time").split(" ")[1] | timestamp_custom("%H:%M") %} {{ time == asr_time }}' but no default was specified. Currently 'as_timestamp' will return 'None', however this template will fail to render in Home Assistant core 2022.1