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
fa8bc0a3
Commit
fa8bc0a3
authored
8 years ago
by
John Arild Berentsen
Committed by
Paulus Schoutsen
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add Verisure smartcam capture service (#4559)
* Add verisure capture as service * docstyle
parent
1ae8256f
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
homeassistant/components/services.yaml
+9
-0
9 additions, 0 deletions
homeassistant/components/services.yaml
homeassistant/components/verisure.py
+27
-0
27 additions, 0 deletions
homeassistant/components/verisure.py
with
36 additions
and
0 deletions
homeassistant/components/services.yaml
+
9
−
0
View file @
fa8bc0a3
...
...
@@ -144,3 +144,12 @@ openalpr:
restart
:
description
:
Restart ffmpeg process of device.
verisure
:
capture_smartcam
:
description
:
Capture a new image from a smartcam.
fields
:
device_serial
:
description
:
The serial number of the smartcam you want to capture an image from.
example
:
'
2DEU
AT5Z'
This diff is collapsed.
Click to expand it.
homeassistant/components/verisure.py
+
27
−
0
View file @
fa8bc0a3
...
...
@@ -7,6 +7,7 @@ https://home-assistant.io/components/verisure/
import
logging
import
threading
import
time
import
os.path
from
datetime
import
timedelta
import
voluptuous
as
vol
...
...
@@ -14,12 +15,14 @@ import voluptuous as vol
from
homeassistant.const
import
CONF_PASSWORD
,
CONF_USERNAME
from
homeassistant.helpers
import
discovery
from
homeassistant.util
import
Throttle
import
homeassistant.config
as
conf_util
import
homeassistant.helpers.config_validation
as
cv
REQUIREMENTS
=
[
'
vsure==0.11.1
'
]
_LOGGER
=
logging
.
getLogger
(
__name__
)
ATTR_DEVICE_SERIAL
=
'
device_serial
'
CONF_ALARM
=
'
alarm
'
CONF_CODE_DIGITS
=
'
code_digits
'
CONF_HYDROMETERS
=
'
hygrometers
'
...
...
@@ -29,6 +32,7 @@ CONF_SMARTPLUGS = 'smartplugs'
CONF_THERMOMETERS
=
'
thermometers
'
CONF_SMARTCAM
=
'
smartcam
'
DOMAIN
=
'
verisure
'
SERVICE_CAPTURE_SMARTCAM
=
'
capture_smartcam
'
HUB
=
None
...
...
@@ -47,6 +51,10 @@ CONFIG_SCHEMA = vol.Schema({
}),
},
extra
=
vol
.
ALLOW_EXTRA
)
CAPTURE_IMAGE_SCHEMA
=
vol
.
Schema
({
vol
.
Required
(
ATTR_DEVICE_SERIAL
):
cv
.
string
})
def
setup
(
hass
,
config
):
"""
Setup the Verisure component.
"""
...
...
@@ -60,6 +68,20 @@ def setup(hass, config):
'
camera
'
):
discovery
.
load_platform
(
hass
,
component
,
DOMAIN
,
{},
config
)
descriptions
=
conf_util
.
load_yaml_config_file
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
services.yaml
'
))
def
capture_smartcam
(
service
):
"""
Capture a new picture from a smartcam.
"""
device_id
=
service
.
data
.
get
(
ATTR_DEVICE_SERIAL
)
HUB
.
smartcam_capture
(
device_id
)
_LOGGER
.
debug
(
'
Capturing new image from %s
'
,
ATTR_DEVICE_SERIAL
)
hass
.
services
.
register
(
DOMAIN
,
SERVICE_CAPTURE_SMARTCAM
,
capture_smartcam
,
descriptions
[
DOMAIN
][
SERVICE_CAPTURE_SMARTCAM
],
schema
=
CAPTURE_IMAGE_SCHEMA
)
return
True
...
...
@@ -150,6 +172,11 @@ class VerisureHub(object):
self
.
smartcam_dict
=
self
.
my_pages
.
smartcam
.
get_imagelist
()
_LOGGER
.
debug
(
'
New dict: %s
'
,
self
.
smartcam_dict
)
@Throttle
(
timedelta
(
seconds
=
30
))
def
smartcam_capture
(
self
,
device_id
):
"""
Capture a new image from a smartcam.
"""
self
.
my_pages
.
smartcam
.
capture
(
device_id
)
@property
def
available
(
self
):
"""
Return True if hub is available.
"""
...
...
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