diff --git a/homeassistant/components/binary_sensor/ihc.py b/homeassistant/components/binary_sensor/ihc.py index 96efa6e6c19..25435d373fd 100644 --- a/homeassistant/components/binary_sensor/ihc.py +++ b/homeassistant/components/binary_sensor/ihc.py @@ -3,8 +3,6 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/binary_sensor.ihc/ """ -from xml.etree.ElementTree import Element - import voluptuous as vol from homeassistant.components.binary_sensor import ( @@ -70,7 +68,7 @@ class IHCBinarySensor(IHCDevice, BinarySensorDevice): def __init__(self, ihc_controller, name, ihc_id: int, info: bool, sensor_type: str, inverting: bool, - product: Element = None) -> None: + product=None) -> None: """Initialize the IHC binary sensor.""" super().__init__(ihc_controller, name, ihc_id, info, product) self._state = None diff --git a/homeassistant/components/ihc/__init__.py b/homeassistant/components/ihc/__init__.py index 0c0100bc9f5..672964f765e 100644 --- a/homeassistant/components/ihc/__init__.py +++ b/homeassistant/components/ihc/__init__.py @@ -167,7 +167,10 @@ def get_discovery_info(component_setup, groups): name = '{}_{}'.format(groupname, ihc_id) device = { 'ihc_id': ihc_id, - 'product': product, + 'product': { + 'name': product.attrib['name'], + 'note': product.attrib['note'], + 'position': product.attrib['position']}, 'product_cfg': product_cfg} discovery_data[name] = device return discovery_data diff --git a/homeassistant/components/ihc/ihcdevice.py b/homeassistant/components/ihc/ihcdevice.py index de6db875def..2ccca366d90 100644 --- a/homeassistant/components/ihc/ihcdevice.py +++ b/homeassistant/components/ihc/ihcdevice.py @@ -1,6 +1,5 @@ """Implementation of a base class for all IHC devices.""" import asyncio -from xml.etree.ElementTree import Element from homeassistant.helpers.entity import Entity @@ -14,16 +13,16 @@ class IHCDevice(Entity): """ def __init__(self, ihc_controller, name, ihc_id: int, info: bool, - product: Element = None) -> None: + product=None) -> None: """Initialize IHC attributes.""" self.ihc_controller = ihc_controller self._name = name self.ihc_id = ihc_id self.info = info if product: - self.ihc_name = product.attrib['name'] - self.ihc_note = product.attrib['note'] - self.ihc_position = product.attrib['position'] + self.ihc_name = product['name'] + self.ihc_note = product['note'] + self.ihc_position = product['position'] else: self.ihc_name = '' self.ihc_note = '' diff --git a/homeassistant/components/light/ihc.py b/homeassistant/components/light/ihc.py index c9ceda8651a..5a7e85d50dc 100644 --- a/homeassistant/components/light/ihc.py +++ b/homeassistant/components/light/ihc.py @@ -3,8 +3,6 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/light.ihc/ """ -from xml.etree.ElementTree import Element - import voluptuous as vol from homeassistant.components.ihc import ( @@ -64,7 +62,7 @@ class IhcLight(IHCDevice, Light): """ def __init__(self, ihc_controller, name, ihc_id: int, info: bool, - dimmable=False, product: Element = None) -> None: + dimmable=False, product=None) -> None: """Initialize the light.""" super().__init__(ihc_controller, name, ihc_id, info, product) self._brightness = 0 diff --git a/homeassistant/components/sensor/ihc.py b/homeassistant/components/sensor/ihc.py index b30a242c17c..2dcf2c3f7be 100644 --- a/homeassistant/components/sensor/ihc.py +++ b/homeassistant/components/sensor/ihc.py @@ -3,8 +3,6 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.ihc/ """ -from xml.etree.ElementTree import Element - import voluptuous as vol from homeassistant.components.ihc import ( @@ -62,7 +60,7 @@ class IHCSensor(IHCDevice, Entity): """Implementation of the IHC sensor.""" def __init__(self, ihc_controller, name, ihc_id: int, info: bool, - unit, product: Element = None) -> None: + unit, product=None) -> None: """Initialize the IHC sensor.""" super().__init__(ihc_controller, name, ihc_id, info, product) self._state = None diff --git a/homeassistant/components/switch/ihc.py b/homeassistant/components/switch/ihc.py index 499a4ca53a7..3f461784693 100644 --- a/homeassistant/components/switch/ihc.py +++ b/homeassistant/components/switch/ihc.py @@ -3,8 +3,6 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.ihc/ """ -from xml.etree.ElementTree import Element - import voluptuous as vol from homeassistant.components.ihc import ( @@ -53,7 +51,7 @@ class IHCSwitch(IHCDevice, SwitchDevice): """IHC Switch.""" def __init__(self, ihc_controller, name: str, ihc_id: int, - info: bool, product: Element = None) -> None: + info: bool, product=None) -> None: """Initialize the IHC switch.""" super().__init__(ihc_controller, name, ihc_id, product) self._state = False