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
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
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)
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)
def stop_cover(self, **kwargs): """Stop the cover""" from pymfy.api.devices.roller_shutter import RollerShutter RollerShutter(self.device, self.api).stop()
def open_cover(self, **kwargs): """Open the cover.""" from pymfy.api.devices.roller_shutter import RollerShutter RollerShutter(self.device, self.api).open()
def close_cover(self, **kwargs): """Close the cover.""" from pymfy.api.devices.roller_shutter import RollerShutter RollerShutter(self.device, self.api).close()