Skip to content
Snippets Groups Projects
Commit 12a6651a authored by jkerdreu's avatar jkerdreu
Browse files

Better cover feature support


git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2992 b32b6428-25c9-4566-ad07-03861ab6144f
parent ec460988
No related branches found
No related tags found
No related merge requests found
...@@ -18,10 +18,10 @@ class Factory(EntityFactory): ...@@ -18,10 +18,10 @@ class Factory(EntityFactory):
def new_entity(self, device): def new_entity(self, device):
entity = None entity = None
if device.dev_type.startswith('shutter.basic'): if device.dev_type == 'shutter.basic':
entity = Shutter(device, self._bridge) entity = Shutter(device, self._bridge)
if device.dev_type.startswith('shutter.position'): if device.dev_type == 'shutter.position':
entity = ShutterPosition(device, self._bridge) entity = ShutterPosition(device, self._bridge)
if entity: if entity:
...@@ -35,13 +35,7 @@ class Shutter(XAALEntity, CoverEntity): ...@@ -35,13 +35,7 @@ class Shutter(XAALEntity, CoverEntity):
@property @property
def supported_features(self) -> int: def supported_features(self) -> int:
supported_features = 0 return CoverEntityFeature.OPEN|CoverEntityFeature.CLOSE|CoverEntityFeature.STOP
supported_features |= (
CoverEntityFeature.OPEN
| CoverEntityFeature.CLOSE
| CoverEntityFeature.STOP
)
return supported_features
@property @property
def is_closed(self) -> bool | None: def is_closed(self) -> bool | None:
...@@ -60,14 +54,7 @@ class ShutterPosition(Shutter): ...@@ -60,14 +54,7 @@ class ShutterPosition(Shutter):
@property @property
def supported_features(self) -> int: def supported_features(self) -> int:
supported_features = 0 return super().supported_features|CoverEntityFeature.SET_POSITION
supported_features |= (
CoverEntityFeature.OPEN
| CoverEntityFeature.CLOSE
| CoverEntityFeature.STOP
| CoverEntityFeature.SET_POSITION
)
return supported_features
@property @property
def is_closed(self) -> bool | None: def is_closed(self) -> bool | None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment