mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Add zigate support to zha (#25552)
* Add zigpy-zigate support * update requirements * fix * update * fix flake8 * update requirements * fix * update * add test to make codecov happy * fix flake8 * Try to add test * add test * remove unneeded test * exclude registries.py from coverage exclude homeassistant/components/zha/core/registries.py since untestable * Fix merge: black formatting and flake8.
This commit is contained in:
parent
8dbac9176e
commit
5b02555255
@ -741,6 +741,7 @@ omit =
|
|||||||
homeassistant/components/zha/core/device.py
|
homeassistant/components/zha/core/device.py
|
||||||
homeassistant/components/zha/core/gateway.py
|
homeassistant/components/zha/core/gateway.py
|
||||||
homeassistant/components/zha/core/helpers.py
|
homeassistant/components/zha/core/helpers.py
|
||||||
|
homeassistant/components/zha/core/registries.py
|
||||||
homeassistant/components/zha/device_entity.py
|
homeassistant/components/zha/device_entity.py
|
||||||
homeassistant/components/zha/entity.py
|
homeassistant/components/zha/entity.py
|
||||||
homeassistant/components/zha/light.py
|
homeassistant/components/zha/light.py
|
||||||
|
@ -79,6 +79,7 @@ DEBUG_COMP_ZHA = "homeassistant.components.zha"
|
|||||||
DEBUG_COMP_ZIGPY = "zigpy"
|
DEBUG_COMP_ZIGPY = "zigpy"
|
||||||
DEBUG_COMP_ZIGPY_DECONZ = "zigpy_deconz"
|
DEBUG_COMP_ZIGPY_DECONZ = "zigpy_deconz"
|
||||||
DEBUG_COMP_ZIGPY_XBEE = "zigpy_xbee"
|
DEBUG_COMP_ZIGPY_XBEE = "zigpy_xbee"
|
||||||
|
DEBUG_COMP_ZIGPY_ZIGATE = "zigpy_zigate"
|
||||||
DEBUG_LEVEL_CURRENT = "current"
|
DEBUG_LEVEL_CURRENT = "current"
|
||||||
DEBUG_LEVEL_ORIGINAL = "original"
|
DEBUG_LEVEL_ORIGINAL = "original"
|
||||||
DEBUG_LEVELS = {
|
DEBUG_LEVELS = {
|
||||||
@ -87,6 +88,7 @@ DEBUG_LEVELS = {
|
|||||||
DEBUG_COMP_ZIGPY: logging.DEBUG,
|
DEBUG_COMP_ZIGPY: logging.DEBUG,
|
||||||
DEBUG_COMP_ZIGPY_XBEE: logging.DEBUG,
|
DEBUG_COMP_ZIGPY_XBEE: logging.DEBUG,
|
||||||
DEBUG_COMP_ZIGPY_DECONZ: logging.DEBUG,
|
DEBUG_COMP_ZIGPY_DECONZ: logging.DEBUG,
|
||||||
|
DEBUG_COMP_ZIGPY_ZIGATE: logging.DEBUG,
|
||||||
}
|
}
|
||||||
DEBUG_RELAY_LOGGERS = [DEBUG_COMP_ZHA, DEBUG_COMP_ZIGPY]
|
DEBUG_RELAY_LOGGERS = [DEBUG_COMP_ZHA, DEBUG_COMP_ZIGPY]
|
||||||
|
|
||||||
@ -109,6 +111,7 @@ class RadioType(enum.Enum):
|
|||||||
ezsp = "ezsp"
|
ezsp = "ezsp"
|
||||||
xbee = "xbee"
|
xbee = "xbee"
|
||||||
deconz = "deconz"
|
deconz = "deconz"
|
||||||
|
zigate = "zigate"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def list(cls):
|
def list(cls):
|
||||||
|
@ -41,6 +41,7 @@ from .const import (
|
|||||||
DEBUG_COMP_ZIGPY,
|
DEBUG_COMP_ZIGPY,
|
||||||
DEBUG_COMP_ZIGPY_DECONZ,
|
DEBUG_COMP_ZIGPY_DECONZ,
|
||||||
DEBUG_COMP_ZIGPY_XBEE,
|
DEBUG_COMP_ZIGPY_XBEE,
|
||||||
|
DEBUG_COMP_ZIGPY_ZIGATE,
|
||||||
DEBUG_LEVEL_CURRENT,
|
DEBUG_LEVEL_CURRENT,
|
||||||
DEBUG_LEVEL_ORIGINAL,
|
DEBUG_LEVEL_ORIGINAL,
|
||||||
DEBUG_LEVELS,
|
DEBUG_LEVELS,
|
||||||
@ -412,6 +413,9 @@ def async_capture_log_levels():
|
|||||||
DEBUG_COMP_ZIGPY_DECONZ: logging.getLogger(
|
DEBUG_COMP_ZIGPY_DECONZ: logging.getLogger(
|
||||||
DEBUG_COMP_ZIGPY_DECONZ
|
DEBUG_COMP_ZIGPY_DECONZ
|
||||||
).getEffectiveLevel(),
|
).getEffectiveLevel(),
|
||||||
|
DEBUG_COMP_ZIGPY_ZIGATE: logging.getLogger(
|
||||||
|
DEBUG_COMP_ZIGPY_ZIGATE
|
||||||
|
).getEffectiveLevel(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -423,6 +427,7 @@ def async_set_logger_levels(levels):
|
|||||||
logging.getLogger(DEBUG_COMP_ZIGPY).setLevel(levels[DEBUG_COMP_ZIGPY])
|
logging.getLogger(DEBUG_COMP_ZIGPY).setLevel(levels[DEBUG_COMP_ZIGPY])
|
||||||
logging.getLogger(DEBUG_COMP_ZIGPY_XBEE).setLevel(levels[DEBUG_COMP_ZIGPY_XBEE])
|
logging.getLogger(DEBUG_COMP_ZIGPY_XBEE).setLevel(levels[DEBUG_COMP_ZIGPY_XBEE])
|
||||||
logging.getLogger(DEBUG_COMP_ZIGPY_DECONZ).setLevel(levels[DEBUG_COMP_ZIGPY_DECONZ])
|
logging.getLogger(DEBUG_COMP_ZIGPY_DECONZ).setLevel(levels[DEBUG_COMP_ZIGPY_DECONZ])
|
||||||
|
logging.getLogger(DEBUG_COMP_ZIGPY_ZIGATE).setLevel(levels[DEBUG_COMP_ZIGPY_ZIGATE])
|
||||||
|
|
||||||
|
|
||||||
class LogRelayHandler(logging.Handler):
|
class LogRelayHandler(logging.Handler):
|
||||||
|
@ -56,6 +56,11 @@ async def check_zigpy_connection(usb_path, radio_type, database_path):
|
|||||||
from zigpy_deconz.zigbee.application import ControllerApplication
|
from zigpy_deconz.zigbee.application import ControllerApplication
|
||||||
|
|
||||||
radio = zigpy_deconz.api.Deconz()
|
radio = zigpy_deconz.api.Deconz()
|
||||||
|
elif radio_type == RadioType.zigate.name:
|
||||||
|
import zigpy_zigate.api
|
||||||
|
from zigpy_zigate.zigbee.application import ControllerApplication
|
||||||
|
|
||||||
|
radio = zigpy_zigate.api.ZiGate()
|
||||||
try:
|
try:
|
||||||
await radio.connect(usb_path, DEFAULT_BAUDRATE)
|
await radio.connect(usb_path, DEFAULT_BAUDRATE)
|
||||||
controller = ControllerApplication(radio, database_path)
|
controller = ControllerApplication(radio, database_path)
|
||||||
|
@ -93,17 +93,6 @@ def establish_device_mappings():
|
|||||||
ZHA_GW_RADIO_DESCRIPTION: "EZSP",
|
ZHA_GW_RADIO_DESCRIPTION: "EZSP",
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_xbee_radio():
|
|
||||||
import zigpy_xbee.api
|
|
||||||
from zigpy_xbee.zigbee.application import ControllerApplication
|
|
||||||
|
|
||||||
return {ZHA_GW_RADIO: zigpy_xbee.api.XBee(), CONTROLLER: ControllerApplication}
|
|
||||||
|
|
||||||
RADIO_TYPES[RadioType.xbee.name] = {
|
|
||||||
ZHA_GW_RADIO: get_xbee_radio,
|
|
||||||
ZHA_GW_RADIO_DESCRIPTION: "XBee",
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_deconz_radio():
|
def get_deconz_radio():
|
||||||
import zigpy_deconz.api
|
import zigpy_deconz.api
|
||||||
from zigpy_deconz.zigbee.application import ControllerApplication
|
from zigpy_deconz.zigbee.application import ControllerApplication
|
||||||
@ -118,6 +107,31 @@ def establish_device_mappings():
|
|||||||
ZHA_GW_RADIO_DESCRIPTION: "Deconz",
|
ZHA_GW_RADIO_DESCRIPTION: "Deconz",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def get_xbee_radio():
|
||||||
|
import zigpy_xbee.api
|
||||||
|
from zigpy_xbee.zigbee.application import ControllerApplication
|
||||||
|
|
||||||
|
return {ZHA_GW_RADIO: zigpy_xbee.api.XBee(), CONTROLLER: ControllerApplication}
|
||||||
|
|
||||||
|
RADIO_TYPES[RadioType.xbee.name] = {
|
||||||
|
ZHA_GW_RADIO: get_xbee_radio,
|
||||||
|
ZHA_GW_RADIO_DESCRIPTION: "XBee",
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_zigate_radio():
|
||||||
|
import zigpy_zigate.api
|
||||||
|
from zigpy_zigate.zigbee.application import ControllerApplication
|
||||||
|
|
||||||
|
return {
|
||||||
|
ZHA_GW_RADIO: zigpy_zigate.api.ZiGate(),
|
||||||
|
CONTROLLER: ControllerApplication,
|
||||||
|
}
|
||||||
|
|
||||||
|
RADIO_TYPES[RadioType.zigate.name] = {
|
||||||
|
ZHA_GW_RADIO: get_zigate_radio,
|
||||||
|
ZHA_GW_RADIO_DESCRIPTION: "ZiGate",
|
||||||
|
}
|
||||||
|
|
||||||
BINARY_SENSOR_CLUSTERS.add(SMARTTHINGS_ACCELERATION_CLUSTER)
|
BINARY_SENSOR_CLUSTERS.add(SMARTTHINGS_ACCELERATION_CLUSTER)
|
||||||
BINARY_SENSOR_CLUSTERS.add(zcl.clusters.general.OnOff.cluster_id)
|
BINARY_SENSOR_CLUSTERS.add(zcl.clusters.general.OnOff.cluster_id)
|
||||||
BINARY_SENSOR_CLUSTERS.add(zcl.clusters.measurement.OccupancySensing.cluster_id)
|
BINARY_SENSOR_CLUSTERS.add(zcl.clusters.measurement.OccupancySensing.cluster_id)
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
"zha-quirks==0.0.20",
|
"zha-quirks==0.0.20",
|
||||||
"zigpy-deconz==0.2.1",
|
"zigpy-deconz==0.2.1",
|
||||||
"zigpy-homeassistant==0.7.0",
|
"zigpy-homeassistant==0.7.0",
|
||||||
"zigpy-xbee-homeassistant==0.4.0"
|
"zigpy-xbee-homeassistant==0.4.0",
|
||||||
|
"zigpy-zigate==0.1.0"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": ["@dmulcahey", "@adminiuga"]
|
"codeowners": ["@dmulcahey", "@adminiuga"]
|
||||||
|
@ -1985,5 +1985,8 @@ zigpy-homeassistant==0.7.0
|
|||||||
# homeassistant.components.zha
|
# homeassistant.components.zha
|
||||||
zigpy-xbee-homeassistant==0.4.0
|
zigpy-xbee-homeassistant==0.4.0
|
||||||
|
|
||||||
|
# homeassistant.components.zha
|
||||||
|
zigpy-zigate==0.1.0
|
||||||
|
|
||||||
# homeassistant.components.zoneminder
|
# homeassistant.components.zoneminder
|
||||||
zm-py==0.3.3
|
zm-py==0.3.3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user