Skip to content

Commit 67a1a37

Browse files
author
Mike Stegeman
authored
Add visible attribute to properties. (#1)
1 parent de0d59e commit 67a1a37

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gateway_addon/property.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def __init__(self, device, name, description):
1616
self.name = name
1717
self.value = None
1818
self.description = {}
19+
self.visible = True
20+
21+
if 'visible' in description:
22+
self.visible = description['visible']
1923

2024
fields = ['type', 'unit', 'description', 'min', 'max']
2125
for field in fields:
@@ -31,6 +35,7 @@ def as_dict(self):
3135
prop = {
3236
'name': self.name,
3337
'value': self.value,
38+
'visible': self.visible,
3439
}
3540
prop.update(self.description)
3641
return prop
@@ -43,6 +48,10 @@ def as_property_description(self):
4348
"""
4449
return self.description
4550

51+
def is_visible(self):
52+
"""Return whether or not this property is visible."""
53+
return self.visible
54+
4655
def set_cached_value(self, value):
4756
"""
4857
Set the cached value of the property, making adjustments as necessary.

0 commit comments

Comments
 (0)