Remove IHC XML Element from discovery data (#15719)
parent
29e668e887
commit
867f80715e
homeassistant/components
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue