Refactor Method Name For Open and Close.
parent
7ef2075520
commit
ec88733b57
|
@ -45,13 +45,13 @@ def is_closed(hass, entity_id=None):
|
|||
return hass.states.is_state(entity_id, STATE_CLOSED)
|
||||
|
||||
|
||||
def close(hass, entity_id=None):
|
||||
def close_door(hass, entity_id=None):
|
||||
""" Closes all or specified garage door. """
|
||||
data = {ATTR_ENTITY_ID: entity_id} if entity_id else None
|
||||
hass.services.call(DOMAIN, SERVICE_CLOSE, data)
|
||||
|
||||
|
||||
def open(hass, entity_id=None):
|
||||
def open_door(hass, entity_id=None):
|
||||
""" Open all or specified garage door. """
|
||||
data = {ATTR_ENTITY_ID: entity_id} if entity_id else None
|
||||
hass.services.call(DOMAIN, SERVICE_OPEN, data)
|
||||
|
@ -70,9 +70,9 @@ def setup(hass, config):
|
|||
|
||||
for item in target_locks:
|
||||
if service.service == SERVICE_CLOSE:
|
||||
item.close()
|
||||
item.close_door()
|
||||
else:
|
||||
item.open()
|
||||
item.open_door()
|
||||
|
||||
if item.should_poll:
|
||||
item.update_ha_state(True)
|
||||
|
@ -96,11 +96,11 @@ class GarageDoorDevice(Entity):
|
|||
""" Is the garage door closed or opened. """
|
||||
return None
|
||||
|
||||
def close(self):
|
||||
def close_door(self):
|
||||
""" Closes the garage door. """
|
||||
raise NotImplementedError()
|
||||
|
||||
def open(self):
|
||||
def open_door(self):
|
||||
""" Opens the garage door. """
|
||||
raise NotImplementedError()
|
||||
|
||||
|
|
|
@ -58,10 +58,10 @@ class WinkGarageDoorDevice(GarageDoorDevice):
|
|||
""" True if device is closed. """
|
||||
return self.wink.state() == 0
|
||||
|
||||
def close(self):
|
||||
def close_door(self):
|
||||
""" Close the device. """
|
||||
self.wink.set_state(0)
|
||||
|
||||
def open(self):
|
||||
def open_door(self):
|
||||
""" Open the device. """
|
||||
self.wink.set_state(1)
|
||||
|
|
Loading…
Reference in New Issue