Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update service domain for ifttt from 'alarm_control_panel' to 'ifttt' #29129

Merged
merged 3 commits into from Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 0 additions & 10 deletions homeassistant/components/alarm_control_panel/services.yaml
Expand Up @@ -80,16 +80,6 @@ alarmdecoder_alarm_toggle_chime:
description: A required code to toggle the alarm control panel chime with.
example: 1234

ifttt_push_alarm_state:
description: Update the alarm state to the specified value.
fields:
entity_id:
description: Name of the alarm control panel which state has to be updated.
example: 'alarm_control_panel.downstairs'
state:
description: The state to which the alarm control panel has to be set.
example: 'armed_night'

elkm1_alarm_arm_vacation:
description: Arm the ElkM1 in vacation mode.
fields:
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/ifttt/__init__.py
Expand Up @@ -23,6 +23,7 @@

CONF_KEY = "key"

SERVICE_PUSH_ALARM_STATE = "push_alarm_state"
SERVICE_TRIGGER = "trigger"

SERVICE_TRIGGER_SCHEMA = vol.Schema(
Expand Down
20 changes: 11 additions & 9 deletions homeassistant/components/ifttt/alarm_control_panel.py
Expand Up @@ -4,8 +4,12 @@

import voluptuous as vol

import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel import DOMAIN, PLATFORM_SCHEMA
from homeassistant.components.alarm_control_panel import (
AlarmControlPanel,
FORMAT_NUMBER,
FORMAT_TEXT,
)
from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_HOME,
Expand All @@ -24,7 +28,7 @@
)
import homeassistant.helpers.config_validation as cv

from . import ATTR_EVENT, DOMAIN as IFTTT_DOMAIN, SERVICE_TRIGGER
from . import ATTR_EVENT, DOMAIN, SERVICE_PUSH_ALARM_STATE, SERVICE_TRIGGER

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -60,8 +64,6 @@
}
)

SERVICE_PUSH_ALARM_STATE = "ifttt_push_alarm_state"

PUSH_ALARM_STATE_SERVICE_SCHEMA = vol.Schema(
{vol.Required(ATTR_ENTITY_ID): cv.entity_ids, vol.Required(ATTR_STATE): cv.string}
)
Expand Down Expand Up @@ -106,7 +108,7 @@ async def push_state_update(service):
)


class IFTTTAlarmPanel(alarm.AlarmControlPanel):
class IFTTTAlarmPanel(AlarmControlPanel):
"""Representation of an alarm control panel controlled through IFTTT."""

def __init__(
Expand Down Expand Up @@ -148,8 +150,8 @@ def code_format(self):
if self._code is None:
return None
if isinstance(self._code, str) and re.search("^\\d+$", self._code):
return alarm.FORMAT_NUMBER
return alarm.FORMAT_TEXT
return FORMAT_NUMBER
return FORMAT_TEXT

def alarm_disarm(self, code=None):
"""Send disarm command."""
Expand Down Expand Up @@ -179,7 +181,7 @@ def set_alarm_state(self, event, state):
"""Call the IFTTT trigger service to change the alarm state."""
data = {ATTR_EVENT: event}

self.hass.services.call(IFTTT_DOMAIN, SERVICE_TRIGGER, data)
self.hass.services.call(DOMAIN, SERVICE_TRIGGER, data)
_LOGGER.debug("Called IFTTT integration to trigger event %s", event)
if self._optimistic:
self._state = state
Expand Down
11 changes: 10 additions & 1 deletion homeassistant/components/ifttt/services.yaml
@@ -1,5 +1,14 @@
# Describes the format for available ifttt services

push_alarm_state:
description: Update the alarm state to the specified value.
fields:
entity_id:
description: Name of the alarm control panel which state has to be updated.
example: 'alarm_control_panel.downstairs'
state:
description: The state to which the alarm control panel has to be set.
example: 'armed_night'

trigger:
description: Triggers the configured IFTTT Webhook.
Expand All @@ -15,4 +24,4 @@ trigger:
example: 'some additional data'
value3:
description: Generic field to send data via the event.
example: 'even more data'
example: 'even more data'