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
da9fc773
Unverified
Commit
da9fc773
authored
1 year ago
by
J. Nick Koston
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Save the HassJob type in wemo discovery to avoid checking it each time (#107998)
parent
8d3f6939
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
homeassistant/components/wemo/__init__.py
+5
-2
5 additions, 2 deletions
homeassistant/components/wemo/__init__.py
with
5 additions
and
2 deletions
homeassistant/components/wemo/__init__.py
+
5
−
2
View file @
da9fc773
...
...
@@ -12,7 +12,7 @@ import voluptuous as vol
from
homeassistant
import
config_entries
from
homeassistant.config_entries
import
ConfigEntry
from
homeassistant.const
import
CONF_DISCOVERY
,
EVENT_HOMEASSISTANT_STOP
,
Platform
from
homeassistant.core
import
CALLBACK_TYPE
,
Event
,
HomeAssistant
,
callback
from
homeassistant.core
import
CALLBACK_TYPE
,
Event
,
HassJob
,
HomeAssistant
,
callback
from
homeassistant.helpers
import
config_validation
as
cv
from
homeassistant.helpers.event
import
async_call_later
from
homeassistant.helpers.typing
import
ConfigType
...
...
@@ -252,6 +252,7 @@ class WemoDiscovery:
self
.
_stop
:
CALLBACK_TYPE
|
None
=
None
self
.
_scan_delay
=
0
self
.
_static_config
=
static_config
self
.
_discover_job
:
HassJob
[[
datetime
],
Coroutine
[
Any
,
Any
,
None
]]
|
None
=
None
async
def
async_discover_and_schedule
(
self
,
event_time
:
datetime
|
None
=
None
...
...
@@ -271,10 +272,12 @@ class WemoDiscovery:
self
.
_scan_delay
+
self
.
ADDITIONAL_SECONDS_BETWEEN_SCANS
,
self
.
MAX_SECONDS_BETWEEN_SCANS
,
)
if
not
self
.
_discover_job
:
self
.
_discover_job
=
HassJob
(
self
.
async_discover_and_schedule
)
self
.
_stop
=
async_call_later
(
self
.
_hass
,
self
.
_scan_delay
,
self
.
async
_discover_
and_schedule
,
self
.
_discover_
job
,
)
@callback
...
...
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