From 3730e09df4d2881397a7b86b560b76ed04af375a Mon Sep 17 00:00:00 2001 From: Glenn Waters Date: Wed, 10 Oct 2018 14:26:56 -0400 Subject: [PATCH 1/8] Initial sensor version. --- homeassistant/components/elkm1/__init__.py | 3 +- homeassistant/components/sensor/elkm1.py | 314 +++++++++++++++++++++ 2 files changed, 316 insertions(+), 1 deletion(-) create mode 100644 homeassistant/components/sensor/elkm1.py diff --git a/homeassistant/components/elkm1/__init__.py b/homeassistant/components/elkm1/__init__.py index da322232bdf6da..844fc1ad03b9cd 100644 --- a/homeassistant/components/elkm1/__init__.py +++ b/homeassistant/components/elkm1/__init__.py @@ -35,7 +35,8 @@ _LOGGER = logging.getLogger(__name__) -SUPPORTED_DOMAINS = ['alarm_control_panel', 'light', 'scene', 'switch'] +SUPPORTED_DOMAINS = ['alarm_control_panel', 'light', 'scene', 'sensor', + 'switch'] def _host_validator(config): diff --git a/homeassistant/components/sensor/elkm1.py b/homeassistant/components/sensor/elkm1.py new file mode 100644 index 00000000000000..6b6456c2b7c573 --- /dev/null +++ b/homeassistant/components/sensor/elkm1.py @@ -0,0 +1,314 @@ +""" +Support for control of ElkM1 sensors. On the ElkM1 there are 6 types +of sensors: +- Counters that are integers that can be read +- Keypads that have temperature (not all models, but no way to know) +- Panel that monitors the state of the connection, versions, etc. +- Settings that are used to trigger Elk-M1 automations +- Thermostats that have temperature +- Zones that are multi-state, voltage, or temperature. + +For more details about this platform, please refer to the documentation at +https://home-assistant.io/components/sensor.elkm1/ +""" + +import voluptuous as vol + +from homeassistant.components.elkm1 import ( + DOMAIN as ELK_DOMAIN, create_elk_entities, ElkEntity) +from homeassistant.components.sensor import DOMAIN +from homeassistant.const import ATTR_ENTITY_ID +import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.dispatcher import ( + async_dispatcher_connect, async_dispatcher_send) + +DEPENDENCIES = [ELK_DOMAIN] + +SPEAK_SERVICE_SCHEMA = vol.Schema({ + vol.Optional(ATTR_ENTITY_ID): cv.entity_ids, + vol.Required('number'): vol.Range(min=0, max=999), +}) + +SIGNAL_SPEAK_WORD = 'elkm1_speak_word' +SIGNAL_SPEAK_PHRASE = 'elkm1_speak_phrase' + + +async def async_setup_platform(hass, config, async_add_entities, + discovery_info=None): + """Setup the Elk sensor platform.""" + if discovery_info is None: + return + + elk = hass.data[ELK_DOMAIN]['elk'] + entities = create_elk_entities( + hass, elk.counters, 'counter', ElkCounter, []) + entities = create_elk_entities( + hass, elk.keypads, 'keypad', ElkKeypad, entities) + entities = create_elk_entities( + hass, [elk.panel], 'panel', ElkPanel, entities) + entities = create_elk_entities( + hass, elk.settings, 'setting', ElkSetting, entities) + entities = create_elk_entities( + hass, elk.thermostats, 'thermostat', ElkThermostat, entities) + entities = create_elk_entities( + hass, elk.zones, 'zone', ElkZone, entities) + async_add_entities(entities, True) + + def _dispatch(signal, entity_ids, *args): + for entity_id in entity_ids: + async_dispatcher_send( + hass, '{}_{}'.format(signal, entity_id), *args) + + def _speak_word_service(service): + entity_ids = service.data.get(ATTR_ENTITY_ID, []) + args = (service.data.get('number')) + _dispatch(SIGNAL_SPEAK_WORD, entity_ids, *args) + + def _speak_phrase_service(service): + entity_ids = service.data.get(ATTR_ENTITY_ID, []) + args = (service.data.get('number')) + _dispatch(SIGNAL_SPEAK_PHRASE, entity_ids, *args) + + hass.services.async_register(DOMAIN, 'elkm1_sensor_speak_word', + _speak_word_service, SPEAK_SERVICE_SCHEMA) + hass.services.async_register(DOMAIN, 'elkm1_sensor_speak_phrase', + _speak_phrase_service, SPEAK_SERVICE_SCHEMA) + + +def temperature_to_state(temperature, undefined_temperature): + """Convert temperature to a state.""" + return temperature if temperature > undefined_temperature else None + + +class ElkSensor(ElkEntity): + """Base representation of Elk-M1 sensor.""" + + def __init__(self, element, elk, elk_data): + """Initialize the base of all Elk sensors.""" + super().__init__(element, elk, elk_data) + self._state = None + + @property + def state(self): + """Return the state of the sensor.""" + return self._state + + +class ElkCounter(ElkSensor): + """Representation of an Elk-M1 Counter.""" + + @property + def icon(self): + """Icon to use in the frontend.""" + return 'mdi:numeric' + + def _element_changed(self, element, changeset): + self._state = self._element.value + + +class ElkKeypad(ElkSensor): + """Representation of an Elk-M1 Keypad.""" + + @property + def temperature_unit(self): + """Return the temperature unit.""" + return self._temperature_unit + + @property + def unit_of_measurement(self): + """Return the unit of measurement.""" + return self._temperature_unit + + @property + def icon(self): + """Icon to use in the frontend.""" + return 'mdi:thermometer-lines' + + @property + def device_state_attributes(self): + """Attributes of the sensor.""" + from elkm1_lib.util import username + + attrs = self.initial_attrs() + attrs['area'] = self._element.area + 1 + attrs['temperature'] = self._element.temperature + attrs['last_user_time'] = self._element.last_user_time.isoformat() + attrs['last_user'] = self._element.last_user + 1 + attrs['code'] = self._element.code + attrs['last_user_name'] = username(self._elk, self._element.last_user) + return attrs + + def _element_changed(self, element, changeset): + self._state = temperature_to_state(self._element.temperature, -40) + + async def async_added_to_hass(self): + """Register callback for ElkM1 changes and update entity state.""" + await super().async_added_to_hass() + self.hass.data[ELK_DOMAIN]['keypads'][ + self._element.index] = self.entity_id + + +class ElkPanel(ElkSensor): + """Representation of an Elk-M1 Panel.""" + + async def async_added_to_hass(self): + """Register callback for ElkM1 changes.""" + await super().async_added_to_hass() + async_dispatcher_connect( + self.hass, '{}_{}'.format(SIGNAL_SPEAK_WORD, self.entity_id), + self._speak_word) + async_dispatcher_connect( + self.hass, '{}_{}'.format(SIGNAL_SPEAK_PHRASE, self.entity_id), + self._speak_phrase) + + @property + def icon(self): + """Icon to use in the frontend.""" + return "mdi:home" + + @property + def device_state_attributes(self): + """Attributes of the sensor.""" + attrs = self.initial_attrs() + attrs['elkm1_version'] = self._element.elkm1_version + attrs['system_trouble_status'] = self._element.system_trouble_status + attrs['xep_version'] = self._element.xep_version + return attrs + + def _element_changed(self, element, changeset): + if self._elk.is_connected(): + self._state = 'Paused' if self._element.remote_programming_status \ + else 'Connected' + else: + self._state = 'Disconnected' + + async def _speak_word(self, number): + """Speak a word on the panel.""" + self._element.speak_word(number) + + async def _speak_phrase(self, number): + """Speak a phrase on the panel.""" + self._element.speak_phrase(number) + + +class ElkSetting(ElkSensor): + """Representation of an Elk-M1 Setting.""" + + @property + def icon(self): + """Icon to use in the frontend.""" + return 'mdi:numeric' + + def _element_changed(self, element, changeset): + self._state = self._element.value + + @property + def device_state_attributes(self): + """Attributes of the sensor.""" + from elkm1_lib.const import SettingFormat + attrs = self.initial_attrs() + attrs['value_format'] = SettingFormat( + self._element.value_format).name.lower() + return attrs + + +class ElkThermostat(ElkSensor): + """Representation of an Elk-M1 Thermostat.""" + + @property + def temperature_unit(self): + """Return the temperature unit.""" + return self._temperature_unit + + @property + def unit_of_measurement(self): + """Return the unit of measurement.""" + return self._temperature_unit + + @property + def icon(self): + """Icon to use in the frontend.""" + return 'mdi:thermometer-lines' + + def _element_changed(self, element, changeset): + self._state = temperature_to_state(self._element.current_temp, 0) + + +class ElkZone(ElkSensor): + """Representation of an Elk-M1 Zone.""" + + @property + def icon(self): + """Icon to use in the frontend.""" + from elkm1_lib.const import ZoneType + zone_icons = { + ZoneType.FIRE_ALARM.value: 'fire', + ZoneType.FIRE_VERIFIED.value: 'fire', + ZoneType.FIRE_SUPERVISORY.value: 'fire', + ZoneType.KEYFOB.value: 'key', + ZoneType.NON_ALARM.value: 'alarm-off', + ZoneType.MEDICAL_ALARM.value: 'medical-bag', + ZoneType.POLICE_ALARM.value: 'alarm-light', + ZoneType.POLICE_NO_INDICATION.value: 'alarm-light', + ZoneType.KEY_MOMENTARY_ARM_DISARM.value: 'power', + ZoneType.KEY_MOMENTARY_ARM_AWAY.value: 'power', + ZoneType.KEY_MOMENTARY_ARM_STAY.value: 'power', + ZoneType.KEY_MOMENTARY_DISARM.value: 'power', + ZoneType.KEY_ON_OFF.value: 'toggle-switch', + ZoneType.MUTE_AUDIBLES.value: 'volume-mute', + ZoneType.POWER_SUPERVISORY.value: 'power-plug', + ZoneType.TEMPERATURE.value: 'thermometer-lines', + ZoneType.ANALOG_ZONE.value: 'speedometer', + ZoneType.PHONE_KEY.value: 'phone-classic', + ZoneType.INTERCOM_KEY.value: 'deskphone' + } + return 'mdi:{}'.format( + zone_icons.get(self._element.definition, 'alarm-bell')) + + @property + def device_state_attributes(self): + """Attributes of the sensor.""" + from elkm1_lib.const import ( + ZoneLogicalStatus, ZonePhysicalStatus, ZoneType) + + attrs = self.initial_attrs() + attrs['physical_status'] = ZonePhysicalStatus( + self._element.physical_status).name.lower() + attrs['logical_status'] = ZoneLogicalStatus( + self._element.logical_status).name.lower() + attrs['definition'] = ZoneType( + self._element.definition).name.lower() + attrs['area'] = self._element.area + 1 + attrs['bypassed'] = self._element.bypassed + attrs['triggered_alarm'] = self._element.triggered_alarm + return attrs + + @property + def temperature_unit(self): + """Return the temperature unit.""" + from elkm1_lib.const import ZoneType + if self._element.definition == ZoneType.TEMPERATURE.value: + return self._temperature_unit + return None + + @property + def unit_of_measurement(self): + """Return the unit of measurement.""" + from elkm1_lib.const import ZoneType + if self._element.definition == ZoneType.TEMPERATURE.value: + return self._temperature_unit + if self._element.definition == ZoneType.ANALOG_ZONE.value: + return 'V' + return None + + def _element_changed(self, element, changeset): + from elkm1_lib.const import ZoneLogicalStatus, ZoneType + from elkm1_lib.util import pretty_const + + if self._element.definition == ZoneType.TEMPERATURE.value: + self._state = temperature_to_state(self._element.temperature, -60) + elif self._element.definition == ZoneType.ANALOG_ZONE.value: + self._state = self._element.voltage + else: + self._state = pretty_const(ZoneLogicalStatus( + self._element.logical_status).name) From de025847c7d301fd17275bcf25777d424e2d5874 Mon Sep 17 00:00:00 2001 From: Glenn Waters Date: Thu, 11 Oct 2018 19:37:51 -0400 Subject: [PATCH 2/8] Add Elk-M1 sensor services. Initial version of services.yaml. --- homeassistant/components/sensor/services.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 homeassistant/components/sensor/services.yaml diff --git a/homeassistant/components/sensor/services.yaml b/homeassistant/components/sensor/services.yaml new file mode 100644 index 00000000000000..ad10f47d3aa1aa --- /dev/null +++ b/homeassistant/components/sensor/services.yaml @@ -0,0 +1,21 @@ +# Describes the format for available ElkM1 alarm control panel services + +elkm1_sensor_speak_word: + description: Speak a word. See list of words in ElkM1 ASCII Protocol documentation. + fields: + entity_id: + description: Name of panel to speak word on. + example: 'sensor.elkm1_panel_001' + number: + description: Word number to speak. + example: 458 + +elkm1_sensor_speak_phrase: + description: Speak a phrase. See list of phrases in ElkM1 ASCII Protocol documentation. + fields: + entity_id: + description: Name of panel to speak phrase on. + example: 'sensor.elkm1_panel_001' + number: + description: Phrase number to speak. + example: 42 From 265c10e2063d78564d3ee611aa9fcfc729b0e356 Mon Sep 17 00:00:00 2001 From: Glenn Waters Date: Thu, 11 Oct 2018 21:47:28 -0400 Subject: [PATCH 3/8] Fix lint errors. --- homeassistant/components/sensor/elkm1.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/sensor/elkm1.py b/homeassistant/components/sensor/elkm1.py index 6b6456c2b7c573..fb72d3ad221c03 100644 --- a/homeassistant/components/sensor/elkm1.py +++ b/homeassistant/components/sensor/elkm1.py @@ -1,6 +1,7 @@ """ -Support for control of ElkM1 sensors. On the ElkM1 there are 6 types -of sensors: +Support for control of ElkM1 sensors. + +On the ElkM1 there are 6 types of sensors: - Counters that are integers that can be read - Keypads that have temperature (not all models, but no way to know) - Panel that monitors the state of the connection, versions, etc. @@ -35,7 +36,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): - """Setup the Elk sensor platform.""" + """Create the Elk-M1 sensor platform.""" if discovery_info is None: return From 7b2a4ad66912083fcd1a090733f4ed4fab2f3899 Mon Sep 17 00:00:00 2001 From: Glenn Waters Date: Wed, 17 Oct 2018 13:45:29 -0400 Subject: [PATCH 4/8] Fix PR comments. --- homeassistant/components/elkm1/__init__.py | 19 ++++ homeassistant/components/sensor/elkm1.py | 87 ------------------- homeassistant/components/sensor/services.yaml | 21 ----- homeassistant/components/services.yaml | 14 +++ 4 files changed, 33 insertions(+), 108 deletions(-) delete mode 100644 homeassistant/components/sensor/services.yaml diff --git a/homeassistant/components/elkm1/__init__.py b/homeassistant/components/elkm1/__init__.py index 844fc1ad03b9cd..a15a2539897b99 100644 --- a/homeassistant/components/elkm1/__init__.py +++ b/homeassistant/components/elkm1/__init__.py @@ -38,6 +38,10 @@ SUPPORTED_DOMAINS = ['alarm_control_panel', 'light', 'scene', 'sensor', 'switch'] +SPEAK_SERVICE_SCHEMA = vol.Schema({ + vol.Required('number'): vol.Range(min=0, max=999), +}) + def _host_validator(config): """Validate that a host is properly configured.""" @@ -136,6 +140,8 @@ def _included(ranges, set_to, values): 'password': conf[CONF_PASSWORD]}) elk.connect() + _create_elk_services(hass, elk) + hass.data[DOMAIN] = {'elk': elk, 'config': config, 'keypads': {}} for component in SUPPORTED_DOMAINS: hass.async_create_task( @@ -144,6 +150,19 @@ def _included(ranges, set_to, values): return True +def _create_elk_services(hass, elk): + def _speak_word_service(service): + elk.panel.speak_word(service.data.get('number')) + + def _speak_phrase_service(service): + elk.panel.speak_phrase(service.data.get('number')) + + hass.services.async_register( + DOMAIN, 'speak_word', _speak_word_service, SPEAK_SERVICE_SCHEMA) + hass.services.async_register( + DOMAIN, 'speak_phrase', _speak_phrase_service, SPEAK_SERVICE_SCHEMA) + + def create_elk_entities(hass, elk_elements, element_type, class_, entities): """Create the ElkM1 devices of a particular class.""" elk_data = hass.data[DOMAIN] diff --git a/homeassistant/components/sensor/elkm1.py b/homeassistant/components/sensor/elkm1.py index fb72d3ad221c03..32f462dcef9e71 100644 --- a/homeassistant/components/sensor/elkm1.py +++ b/homeassistant/components/sensor/elkm1.py @@ -1,38 +1,15 @@ """ Support for control of ElkM1 sensors. -On the ElkM1 there are 6 types of sensors: -- Counters that are integers that can be read -- Keypads that have temperature (not all models, but no way to know) -- Panel that monitors the state of the connection, versions, etc. -- Settings that are used to trigger Elk-M1 automations -- Thermostats that have temperature -- Zones that are multi-state, voltage, or temperature. - For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.elkm1/ """ -import voluptuous as vol - from homeassistant.components.elkm1 import ( DOMAIN as ELK_DOMAIN, create_elk_entities, ElkEntity) -from homeassistant.components.sensor import DOMAIN -from homeassistant.const import ATTR_ENTITY_ID -import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.dispatcher import ( - async_dispatcher_connect, async_dispatcher_send) DEPENDENCIES = [ELK_DOMAIN] -SPEAK_SERVICE_SCHEMA = vol.Schema({ - vol.Optional(ATTR_ENTITY_ID): cv.entity_ids, - vol.Required('number'): vol.Range(min=0, max=999), -}) - -SIGNAL_SPEAK_WORD = 'elkm1_speak_word' -SIGNAL_SPEAK_PHRASE = 'elkm1_speak_phrase' - async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): @@ -49,32 +26,10 @@ async def async_setup_platform(hass, config, async_add_entities, hass, [elk.panel], 'panel', ElkPanel, entities) entities = create_elk_entities( hass, elk.settings, 'setting', ElkSetting, entities) - entities = create_elk_entities( - hass, elk.thermostats, 'thermostat', ElkThermostat, entities) entities = create_elk_entities( hass, elk.zones, 'zone', ElkZone, entities) async_add_entities(entities, True) - def _dispatch(signal, entity_ids, *args): - for entity_id in entity_ids: - async_dispatcher_send( - hass, '{}_{}'.format(signal, entity_id), *args) - - def _speak_word_service(service): - entity_ids = service.data.get(ATTR_ENTITY_ID, []) - args = (service.data.get('number')) - _dispatch(SIGNAL_SPEAK_WORD, entity_ids, *args) - - def _speak_phrase_service(service): - entity_ids = service.data.get(ATTR_ENTITY_ID, []) - args = (service.data.get('number')) - _dispatch(SIGNAL_SPEAK_PHRASE, entity_ids, *args) - - hass.services.async_register(DOMAIN, 'elkm1_sensor_speak_word', - _speak_word_service, SPEAK_SERVICE_SCHEMA) - hass.services.async_register(DOMAIN, 'elkm1_sensor_speak_phrase', - _speak_phrase_service, SPEAK_SERVICE_SCHEMA) - def temperature_to_state(temperature, undefined_temperature): """Convert temperature to a state.""" @@ -152,16 +107,6 @@ async def async_added_to_hass(self): class ElkPanel(ElkSensor): """Representation of an Elk-M1 Panel.""" - async def async_added_to_hass(self): - """Register callback for ElkM1 changes.""" - await super().async_added_to_hass() - async_dispatcher_connect( - self.hass, '{}_{}'.format(SIGNAL_SPEAK_WORD, self.entity_id), - self._speak_word) - async_dispatcher_connect( - self.hass, '{}_{}'.format(SIGNAL_SPEAK_PHRASE, self.entity_id), - self._speak_phrase) - @property def icon(self): """Icon to use in the frontend.""" @@ -171,9 +116,7 @@ def icon(self): def device_state_attributes(self): """Attributes of the sensor.""" attrs = self.initial_attrs() - attrs['elkm1_version'] = self._element.elkm1_version attrs['system_trouble_status'] = self._element.system_trouble_status - attrs['xep_version'] = self._element.xep_version return attrs def _element_changed(self, element, changeset): @@ -183,14 +126,6 @@ def _element_changed(self, element, changeset): else: self._state = 'Disconnected' - async def _speak_word(self, number): - """Speak a word on the panel.""" - self._element.speak_word(number) - - async def _speak_phrase(self, number): - """Speak a phrase on the panel.""" - self._element.speak_phrase(number) - class ElkSetting(ElkSensor): """Representation of an Elk-M1 Setting.""" @@ -213,28 +148,6 @@ def device_state_attributes(self): return attrs -class ElkThermostat(ElkSensor): - """Representation of an Elk-M1 Thermostat.""" - - @property - def temperature_unit(self): - """Return the temperature unit.""" - return self._temperature_unit - - @property - def unit_of_measurement(self): - """Return the unit of measurement.""" - return self._temperature_unit - - @property - def icon(self): - """Icon to use in the frontend.""" - return 'mdi:thermometer-lines' - - def _element_changed(self, element, changeset): - self._state = temperature_to_state(self._element.current_temp, 0) - - class ElkZone(ElkSensor): """Representation of an Elk-M1 Zone.""" diff --git a/homeassistant/components/sensor/services.yaml b/homeassistant/components/sensor/services.yaml deleted file mode 100644 index ad10f47d3aa1aa..00000000000000 --- a/homeassistant/components/sensor/services.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# Describes the format for available ElkM1 alarm control panel services - -elkm1_sensor_speak_word: - description: Speak a word. See list of words in ElkM1 ASCII Protocol documentation. - fields: - entity_id: - description: Name of panel to speak word on. - example: 'sensor.elkm1_panel_001' - number: - description: Word number to speak. - example: 458 - -elkm1_sensor_speak_phrase: - description: Speak a phrase. See list of phrases in ElkM1 ASCII Protocol documentation. - fields: - entity_id: - description: Name of panel to speak phrase on. - example: 'sensor.elkm1_panel_001' - number: - description: Phrase number to speak. - example: 42 diff --git a/homeassistant/components/services.yaml b/homeassistant/components/services.yaml index 62da489aab4c5f..72d2971f8079ec 100644 --- a/homeassistant/components/services.yaml +++ b/homeassistant/components/services.yaml @@ -601,3 +601,17 @@ nest: trip_id: description: Optional identity of a trip. Using the same trip_ID will update the estimation. example: trip_back_home + +elkm1: + sensor_speak_word: + description: Speak a word. See list of words in ElkM1 ASCII Protocol documentation. + fields: + number: + description: Word number to speak. + example: 142 + speak_phrase: + description: Speak a phrase. See list of phrases in ElkM1 ASCII Protocol documentation. + fields: + number: + description: Phrase number to speak. + example: 42 From c4edb88dca04583e59ff0a9ea16d70503e5e6df6 Mon Sep 17 00:00:00 2001 From: Glenn Waters Date: Wed, 17 Oct 2018 14:02:16 -0400 Subject: [PATCH 5/8] fix PR comment --- homeassistant/components/elkm1/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/elkm1/__init__.py b/homeassistant/components/elkm1/__init__.py index a15a2539897b99..5c379c7438ba5d 100644 --- a/homeassistant/components/elkm1/__init__.py +++ b/homeassistant/components/elkm1/__init__.py @@ -39,7 +39,8 @@ 'switch'] SPEAK_SERVICE_SCHEMA = vol.Schema({ - vol.Required('number'): vol.Range(min=0, max=999), + vol.Required('number'): + vol.All(vol.Coerce(int), vol.Range(min=0, max=999)) }) From 209da24b1d26abf924b53794ddf7505eb9ccc126 Mon Sep 17 00:00:00 2001 From: Glenn Waters Date: Wed, 17 Oct 2018 17:48:03 -0400 Subject: [PATCH 6/8] Fix PR comment --- homeassistant/components/elkm1/services.yaml | 13 +++++++++++++ homeassistant/components/services.yaml | 14 -------------- 2 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 homeassistant/components/elkm1/services.yaml diff --git a/homeassistant/components/elkm1/services.yaml b/homeassistant/components/elkm1/services.yaml new file mode 100644 index 00000000000000..705ce3c95f57b1 --- /dev/null +++ b/homeassistant/components/elkm1/services.yaml @@ -0,0 +1,13 @@ +elkm1: + sensor_speak_word: + description: Speak a word. See list of words in ElkM1 ASCII Protocol documentation. + fields: + number: + description: Word number to speak. + example: 142 + speak_phrase: + description: Speak a phrase. See list of phrases in ElkM1 ASCII Protocol documentation. + fields: + number: + description: Phrase number to speak. + example: 42 diff --git a/homeassistant/components/services.yaml b/homeassistant/components/services.yaml index 72d2971f8079ec..62da489aab4c5f 100644 --- a/homeassistant/components/services.yaml +++ b/homeassistant/components/services.yaml @@ -601,17 +601,3 @@ nest: trip_id: description: Optional identity of a trip. Using the same trip_ID will update the estimation. example: trip_back_home - -elkm1: - sensor_speak_word: - description: Speak a word. See list of words in ElkM1 ASCII Protocol documentation. - fields: - number: - description: Word number to speak. - example: 142 - speak_phrase: - description: Speak a phrase. See list of phrases in ElkM1 ASCII Protocol documentation. - fields: - number: - description: Phrase number to speak. - example: 42 From 1083cfbd90895282a8ebcf569998d81a2602876c Mon Sep 17 00:00:00 2001 From: Glenn Waters Date: Thu, 18 Oct 2018 07:41:52 -0400 Subject: [PATCH 7/8] Fix PR comments --- homeassistant/components/elkm1/services.yaml | 25 ++++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/elkm1/services.yaml b/homeassistant/components/elkm1/services.yaml index 705ce3c95f57b1..405716569630ee 100644 --- a/homeassistant/components/elkm1/services.yaml +++ b/homeassistant/components/elkm1/services.yaml @@ -1,13 +1,12 @@ -elkm1: - sensor_speak_word: - description: Speak a word. See list of words in ElkM1 ASCII Protocol documentation. - fields: - number: - description: Word number to speak. - example: 142 - speak_phrase: - description: Speak a phrase. See list of phrases in ElkM1 ASCII Protocol documentation. - fields: - number: - description: Phrase number to speak. - example: 42 +speak_word: + description: Speak a word. See list of words in ElkM1 ASCII Protocol documentation. + fields: + number: + description: Word number to speak. + example: 142 +speak_phrase: + description: Speak a phrase. See list of phrases in ElkM1 ASCII Protocol documentation. + fields: + number: + description: Phrase number to speak. + example: 42 From 76722e9e4c48223ac411d0541c7a98d3998cf697 Mon Sep 17 00:00:00 2001 From: Glenn Waters Date: Fri, 19 Oct 2018 12:25:38 -0400 Subject: [PATCH 8/8] fix --- homeassistant/components/sensor/elkm1.py | 1 - 1 file changed, 1 deletion(-) diff --git a/homeassistant/components/sensor/elkm1.py b/homeassistant/components/sensor/elkm1.py index 32f462dcef9e71..288f968b2f7103 100644 --- a/homeassistant/components/sensor/elkm1.py +++ b/homeassistant/components/sensor/elkm1.py @@ -4,7 +4,6 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.elkm1/ """ - from homeassistant.components.elkm1 import ( DOMAIN as ELK_DOMAIN, create_elk_entities, ElkEntity)