Esempio n. 1
0
 def current_cover_position(self):
     """Return the current position of cover shutter."""
     position = None
     try:
         from pymfy.api.devices.roller_shutter import RollerShutter
         shutter = RollerShutter(self.device, self.api)
         position = 100 - shutter.get_position()
     except StopIteration:
         pass
     return position
Esempio n. 2
0
 def is_closed(self):
     """Return if the cover is closed."""
     is_closed = None
     try:
         from pymfy.api.devices.roller_shutter import RollerShutter
         is_closed = RollerShutter(self.device, self.api).is_closed()
     except StopIteration:
         pass
     return is_closed
Esempio n. 3
0
 def device(self):
     api = SomfyApi("foo", "faa", "https://whatever.com")
     device_path = os.path.join(CURRENT_DIR, "roller_shutter.json")
     with open(device_path, "r") as get_device:
         device = Device(**json.loads(get_device.read()))
     return RollerShutter(device, api)
Esempio n. 4
0
 def set_cover_position(self, **kwargs):
     """Move the cover shutter to a specific position."""
     position = kwargs.get(ATTR_POSITION)
     from pymfy.api.devices.roller_shutter import RollerShutter
     RollerShutter(self.device, self.api).set_position(100 - position)
Esempio n. 5
0
 def stop_cover(self, **kwargs):
     """Stop the cover"""
     from pymfy.api.devices.roller_shutter import RollerShutter
     RollerShutter(self.device, self.api).stop()
Esempio n. 6
0
 def open_cover(self, **kwargs):
     """Open the cover."""
     from pymfy.api.devices.roller_shutter import RollerShutter
     RollerShutter(self.device, self.api).open()
Esempio n. 7
0
 def close_cover(self, **kwargs):
     """Close the cover."""
     from pymfy.api.devices.roller_shutter import RollerShutter
     RollerShutter(self.device, self.api).close()