Update service domain for alarmdecoder from 'alarm_control_panel' to 'alarmdecoder' (#29127)

* update alarmdecoder service domain

* update alarmdecoder service name

* black formatting
This commit is contained in:
Raman Gupta 2019-11-27 19:51:40 -05:00 committed by Paulus Schoutsen
parent 88376bf363
commit f1a4e212cc
3 changed files with 20 additions and 17 deletions

View file

@ -59,13 +59,3 @@ alarm_trigger:
code: code:
description: An optional code to trigger the alarm control panel with. description: An optional code to trigger the alarm control panel with.
example: 1234 example: 1234
alarmdecoder_alarm_toggle_chime:
description: Send the alarm the toggle chime command.
fields:
entity_id:
description: Name of the alarm control panel to trigger.
example: 'alarm_control_panel.downstairs'
code:
description: A required code to toggle the alarm control panel chime with.
example: 1234

View file

@ -3,7 +3,10 @@ import logging
import voluptuous as vol import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm from homeassistant.components.alarm_control_panel import (
AlarmControlPanel,
FORMAT_NUMBER,
)
from homeassistant.components.alarm_control_panel.const import ( from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY, SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_HOME, SUPPORT_ALARM_ARM_HOME,
@ -18,11 +21,11 @@ from homeassistant.const import (
) )
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from . import DATA_AD, DOMAIN as DOMAIN_ALARMDECODER, SIGNAL_PANEL_MESSAGE from . import DATA_AD, DOMAIN, SIGNAL_PANEL_MESSAGE
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
SERVICE_ALARM_TOGGLE_CHIME = "alarmdecoder_alarm_toggle_chime" SERVICE_ALARM_TOGGLE_CHIME = "alarm_toggle_chime"
ALARM_TOGGLE_CHIME_SCHEMA = vol.Schema({vol.Required(ATTR_CODE): cv.string}) ALARM_TOGGLE_CHIME_SCHEMA = vol.Schema({vol.Required(ATTR_CODE): cv.string})
SERVICE_ALARM_KEYPRESS = "alarm_keypress" SERVICE_ALARM_KEYPRESS = "alarm_keypress"
@ -41,7 +44,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
device.alarm_toggle_chime(code) device.alarm_toggle_chime(code)
hass.services.register( hass.services.register(
alarm.DOMAIN, DOMAIN,
SERVICE_ALARM_TOGGLE_CHIME, SERVICE_ALARM_TOGGLE_CHIME,
alarm_toggle_chime_handler, alarm_toggle_chime_handler,
schema=ALARM_TOGGLE_CHIME_SCHEMA, schema=ALARM_TOGGLE_CHIME_SCHEMA,
@ -53,14 +56,14 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
device.alarm_keypress(keypress) device.alarm_keypress(keypress)
hass.services.register( hass.services.register(
DOMAIN_ALARMDECODER, DOMAIN,
SERVICE_ALARM_KEYPRESS, SERVICE_ALARM_KEYPRESS,
alarm_keypress_handler, alarm_keypress_handler,
schema=ALARM_KEYPRESS_SCHEMA, schema=ALARM_KEYPRESS_SCHEMA,
) )
class AlarmDecoderAlarmPanel(alarm.AlarmControlPanel): class AlarmDecoderAlarmPanel(AlarmControlPanel):
"""Representation of an AlarmDecoder-based alarm panel.""" """Representation of an AlarmDecoder-based alarm panel."""
def __init__(self): def __init__(self):
@ -120,7 +123,7 @@ class AlarmDecoderAlarmPanel(alarm.AlarmControlPanel):
@property @property
def code_format(self): def code_format(self):
"""Return one or more digits/characters.""" """Return one or more digits/characters."""
return alarm.FORMAT_NUMBER return FORMAT_NUMBER
@property @property
def state(self): def state(self):

View file

@ -7,3 +7,13 @@ alarm_keypress:
keypress: keypress:
description: 'String to send to the alarm panel.' description: 'String to send to the alarm panel.'
example: '*71' example: '*71'
alarm_toggle_chime:
description: Send the alarm the toggle chime command.
fields:
entity_id:
description: Name of the alarm control panel to trigger.
example: 'alarm_control_panel.downstairs'
code:
description: A required code to toggle the alarm control panel chime with.
example: 1234