mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Remove IHC XML Element from discovery data (#15719)
This commit is contained in:
parent
29e668e887
commit
867f80715e
@ -3,8 +3,6 @@
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.ihc/
|
https://home-assistant.io/components/binary_sensor.ihc/
|
||||||
"""
|
"""
|
||||||
from xml.etree.ElementTree import Element
|
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
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,
|
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
||||||
sensor_type: str, inverting: bool,
|
sensor_type: str, inverting: bool,
|
||||||
product: Element = None) -> None:
|
product=None) -> None:
|
||||||
"""Initialize the IHC binary sensor."""
|
"""Initialize the IHC binary sensor."""
|
||||||
super().__init__(ihc_controller, name, ihc_id, info, product)
|
super().__init__(ihc_controller, name, ihc_id, info, product)
|
||||||
self._state = None
|
self._state = None
|
||||||
|
@ -167,7 +167,10 @@ def get_discovery_info(component_setup, groups):
|
|||||||
name = '{}_{}'.format(groupname, ihc_id)
|
name = '{}_{}'.format(groupname, ihc_id)
|
||||||
device = {
|
device = {
|
||||||
'ihc_id': ihc_id,
|
'ihc_id': ihc_id,
|
||||||
'product': product,
|
'product': {
|
||||||
|
'name': product.attrib['name'],
|
||||||
|
'note': product.attrib['note'],
|
||||||
|
'position': product.attrib['position']},
|
||||||
'product_cfg': product_cfg}
|
'product_cfg': product_cfg}
|
||||||
discovery_data[name] = device
|
discovery_data[name] = device
|
||||||
return discovery_data
|
return discovery_data
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
"""Implementation of a base class for all IHC devices."""
|
"""Implementation of a base class for all IHC devices."""
|
||||||
import asyncio
|
import asyncio
|
||||||
from xml.etree.ElementTree import Element
|
|
||||||
|
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
@ -14,16 +13,16 @@ class IHCDevice(Entity):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
||||||
product: Element = None) -> None:
|
product=None) -> None:
|
||||||
"""Initialize IHC attributes."""
|
"""Initialize IHC attributes."""
|
||||||
self.ihc_controller = ihc_controller
|
self.ihc_controller = ihc_controller
|
||||||
self._name = name
|
self._name = name
|
||||||
self.ihc_id = ihc_id
|
self.ihc_id = ihc_id
|
||||||
self.info = info
|
self.info = info
|
||||||
if product:
|
if product:
|
||||||
self.ihc_name = product.attrib['name']
|
self.ihc_name = product['name']
|
||||||
self.ihc_note = product.attrib['note']
|
self.ihc_note = product['note']
|
||||||
self.ihc_position = product.attrib['position']
|
self.ihc_position = product['position']
|
||||||
else:
|
else:
|
||||||
self.ihc_name = ''
|
self.ihc_name = ''
|
||||||
self.ihc_note = ''
|
self.ihc_note = ''
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/light.ihc/
|
https://home-assistant.io/components/light.ihc/
|
||||||
"""
|
"""
|
||||||
from xml.etree.ElementTree import Element
|
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.ihc import (
|
from homeassistant.components.ihc import (
|
||||||
@ -64,7 +62,7 @@ class IhcLight(IHCDevice, Light):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
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."""
|
"""Initialize the light."""
|
||||||
super().__init__(ihc_controller, name, ihc_id, info, product)
|
super().__init__(ihc_controller, name, ihc_id, info, product)
|
||||||
self._brightness = 0
|
self._brightness = 0
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/sensor.ihc/
|
https://home-assistant.io/components/sensor.ihc/
|
||||||
"""
|
"""
|
||||||
from xml.etree.ElementTree import Element
|
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.ihc import (
|
from homeassistant.components.ihc import (
|
||||||
@ -62,7 +60,7 @@ class IHCSensor(IHCDevice, Entity):
|
|||||||
"""Implementation of the IHC sensor."""
|
"""Implementation of the IHC sensor."""
|
||||||
|
|
||||||
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
||||||
unit, product: Element = None) -> None:
|
unit, product=None) -> None:
|
||||||
"""Initialize the IHC sensor."""
|
"""Initialize the IHC sensor."""
|
||||||
super().__init__(ihc_controller, name, ihc_id, info, product)
|
super().__init__(ihc_controller, name, ihc_id, info, product)
|
||||||
self._state = None
|
self._state = None
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/switch.ihc/
|
https://home-assistant.io/components/switch.ihc/
|
||||||
"""
|
"""
|
||||||
from xml.etree.ElementTree import Element
|
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.ihc import (
|
from homeassistant.components.ihc import (
|
||||||
@ -53,7 +51,7 @@ class IHCSwitch(IHCDevice, SwitchDevice):
|
|||||||
"""IHC Switch."""
|
"""IHC Switch."""
|
||||||
|
|
||||||
def __init__(self, ihc_controller, name: str, ihc_id: int,
|
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."""
|
"""Initialize the IHC switch."""
|
||||||
super().__init__(ihc_controller, name, ihc_id, product)
|
super().__init__(ihc_controller, name, ihc_id, product)
|
||||||
self._state = False
|
self._state = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user