Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
e7d49823
Unverified
Commit
e7d49823
authored
1 month ago
by
Michael
Committed by
GitHub
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
Explicitly pass in the config_entry in islamic_prayer_times coordinator (#138133)
explicitly pass in the config_entry in coordinator
parent
4eccc9d9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
homeassistant/components/islamic_prayer_times/__init__.py
+8
-6
8 additions, 6 deletions
homeassistant/components/islamic_prayer_times/__init__.py
homeassistant/components/islamic_prayer_times/coordinator.py
+9
-4
9 additions, 4 deletions
homeassistant/components/islamic_prayer_times/coordinator.py
with
17 additions
and
10 deletions
homeassistant/components/islamic_prayer_times/__init__.py
+
8
−
6
View file @
e7d49823
...
@@ -4,20 +4,20 @@ from __future__ import annotations
...
@@ -4,20 +4,20 @@ from __future__ import annotations
import
logging
import
logging
from
homeassistant.config_entries
import
ConfigEntry
from
homeassistant.const
import
CONF_LATITUDE
,
CONF_LONGITUDE
,
Platform
from
homeassistant.const
import
CONF_LATITUDE
,
CONF_LONGITUDE
,
Platform
from
homeassistant.core
import
HomeAssistant
,
callback
from
homeassistant.core
import
HomeAssistant
,
callback
from
homeassistant.helpers
import
entity_registry
as
er
from
homeassistant.helpers
import
entity_registry
as
er
from
.coordinator
import
IslamicPrayerDataUpdateCoordinator
from
.coordinator
import
(
IslamicPrayerDataUpdateCoordinator
,
IslamicPrayerTimesConfigEntry
,
)
PLATFORMS
=
[
Platform
.
SENSOR
]
PLATFORMS
=
[
Platform
.
SENSOR
]
_LOGGER
=
logging
.
getLogger
(
__name__
)
_LOGGER
=
logging
.
getLogger
(
__name__
)
type
IslamicPrayerTimesConfigEntry
=
ConfigEntry
[
IslamicPrayerDataUpdateCoordinator
]
async
def
async_setup_entry
(
async
def
async_setup_entry
(
hass
:
HomeAssistant
,
config_entry
:
IslamicPrayerTimesConfigEntry
hass
:
HomeAssistant
,
config_entry
:
IslamicPrayerTimesConfigEntry
...
@@ -36,7 +36,7 @@ async def async_setup_entry(
...
@@ -36,7 +36,7 @@ async def async_setup_entry(
await
er
.
async_migrate_entries
(
hass
,
config_entry
.
entry_id
,
update_unique_id
)
await
er
.
async_migrate_entries
(
hass
,
config_entry
.
entry_id
,
update_unique_id
)
coordinator
=
IslamicPrayerDataUpdateCoordinator
(
hass
)
coordinator
=
IslamicPrayerDataUpdateCoordinator
(
hass
,
config_entry
)
await
coordinator
.
async_config_entry_first_refresh
()
await
coordinator
.
async_config_entry_first_refresh
()
config_entry
.
runtime_data
=
coordinator
config_entry
.
runtime_data
=
coordinator
...
@@ -48,7 +48,9 @@ async def async_setup_entry(
...
@@ -48,7 +48,9 @@ async def async_setup_entry(
return
True
return
True
async
def
async_migrate_entry
(
hass
:
HomeAssistant
,
config_entry
:
ConfigEntry
)
->
bool
:
async
def
async_migrate_entry
(
hass
:
HomeAssistant
,
config_entry
:
IslamicPrayerTimesConfigEntry
)
->
bool
:
"""
Migrate old entry.
"""
"""
Migrate old entry.
"""
_LOGGER
.
debug
(
"
Migrating from version %s
"
,
config_entry
.
version
)
_LOGGER
.
debug
(
"
Migrating from version %s
"
,
config_entry
.
version
)
...
...
This diff is collapsed.
Click to expand it.
homeassistant/components/islamic_prayer_times/coordinator.py
+
9
−
4
View file @
e7d49823
...
@@ -29,21 +29,26 @@ from .const import (
...
@@ -29,21 +29,26 @@ from .const import (
_LOGGER
=
logging
.
getLogger
(
__name__
)
_LOGGER
=
logging
.
getLogger
(
__name__
)
type
IslamicPrayerTimesConfigEntry
=
ConfigEntry
[
IslamicPrayerDataUpdateCoordinator
]
class
IslamicPrayerDataUpdateCoordinator
(
DataUpdateCoordinator
[
dict
[
str
,
datetime
]]):
class
IslamicPrayerDataUpdateCoordinator
(
DataUpdateCoordinator
[
dict
[
str
,
datetime
]]):
"""
Islamic Prayer Client Object.
"""
"""
Islamic Prayer Client Object.
"""
config_entry
:
ConfigEntry
config_entry
:
IslamicPrayerTimes
ConfigEntry
def
__init__
(
self
,
hass
:
HomeAssistant
)
->
None
:
def
__init__
(
self
,
hass
:
HomeAssistant
,
config_entry
:
IslamicPrayerTimesConfigEntry
)
->
None
:
"""
Initialize the Islamic Prayer client.
"""
"""
Initialize the Islamic Prayer client.
"""
super
().
__init__
(
super
().
__init__
(
hass
,
hass
,
_LOGGER
,
_LOGGER
,
config_entry
=
config_entry
,
name
=
DOMAIN
,
name
=
DOMAIN
,
)
)
self
.
latitude
=
self
.
config_entry
.
data
[
CONF_LATITUDE
]
self
.
latitude
=
config_entry
.
data
[
CONF_LATITUDE
]
self
.
longitude
=
self
.
config_entry
.
data
[
CONF_LONGITUDE
]
self
.
longitude
=
config_entry
.
data
[
CONF_LONGITUDE
]
self
.
event_unsub
:
CALLBACK_TYPE
|
None
=
None
self
.
event_unsub
:
CALLBACK_TYPE
|
None
=
None
@property
@property
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment