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
0e9a8a7c
Commit
0e9a8a7c
authored
10 years ago
by
Ryan Kraus
Browse files
Options
Downloads
Patches
Plain Diff
Added custom program sensors to the isy994 component.
parent
510064d9
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/sensor/isy994.py
+21
-2
21 additions, 2 deletions
homeassistant/components/sensor/isy994.py
with
21 additions
and
2 deletions
homeassistant/components/sensor/isy994.py
+
21
−
2
View file @
0e9a8a7c
...
...
@@ -4,8 +4,8 @@ import logging
# homeassistant imports
from
homeassistant.components.isy994
import
ISY
,
ISYDeviceABC
from
homeassistant.
helpers.entity
import
Entity
from
homeassistant.const
import
STATE_OPEN
,
STATE_CLOSED
from
homeassistant.
const
import
(
STATE_OPEN
,
STATE_CLOSED
,
STATE_HOME
,
STATE_NOT_HOME
,
STATE_ON
,
STATE_OFF
)
def
setup_platform
(
hass
,
config
,
add_devices
,
discovery_info
=
None
):
...
...
@@ -26,6 +26,21 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
getattr
(
ISY
.
climate
,
prop
+
'
_units
'
))
devs
.
append
(
ISYSensorDevice
(
node
))
# import sensor programs
for
(
folder_name
,
states
)
in
(
(
'
HA.locations
'
,
[
STATE_HOME
,
STATE_NOT_HOME
]),
(
'
HA.sensors
'
,
[
STATE_OPEN
,
STATE_CLOSED
]),
(
'
HA.states
'
,
[
STATE_ON
,
STATE_OFF
])):
try
:
folder
=
ISY
.
programs
[
'
My Programs
'
][
folder_name
]
except
KeyError
:
# folder does not exist
pass
else
:
for
dtype
,
name
,
node_id
in
folder
.
children
:
node
=
folder
[
node_id
].
leaf
devs
.
append
(
ISYSensorDevice
(
node
,
states
))
add_devices
(
devs
)
...
...
@@ -43,3 +58,7 @@ class ISYSensorDevice(ISYDeviceABC):
"""
represents a isy sensor within home assistant.
"""
_domain
=
'
sensor
'
def
__init__
(
self
,
node
,
states
=
[]):
super
().
__init__
(
node
)
self
.
_states
=
states
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