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