Refactored Method Names.

This commit is contained in:
Eric Rolf 2016-02-11 09:57:56 -05:00
parent 175b49236c
commit be9a2a043e

View File

@ -34,19 +34,20 @@ DISCOVERY_PLATFORMS = {
_LOGGER = logging.getLogger(__name__)
def is_closed(hass, entity_id=None):
""" Returns if the garage door is closed based on the statemachine. """
entity_id = entity_id or ENTITY_ID_ALL_GARAGE_DOORS
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)
@ -65,9 +66,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)