Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.zha.helpers Namespace Reference

Classes

class  EntityData
 
class  EntityReference
 
class  GroupEntityReference
 
class  HAZHAData
 
class  LogRelayHandler
 
class  ZHADeviceProxy
 
class  ZHAGatewayProxy
 
class  ZHAGroupProxy
 

Functions

str _clean_serial_port_path (str path)
 
def _EntityT
 
None async_add_entities (AddEntitiesCallback _async_add_entities, type[ZHAEntity] entity_class, list[EntityData] entities, **kwargs)
 
dict[str, int] async_capture_log_levels ()
 
def async_cluster_exists (HomeAssistant hass, cluster_id, skip_coordinator=True)
 
ZHADeviceProxy async_get_zha_device_proxy (HomeAssistant hass, str device_id)
 
None async_set_logger_levels (dict[str, int] levels)
 
vol.Schema cluster_command_schema_to_vol_schema (CommandSchema schema)
 
dict[str, Any] convert_to_zcl_values (dict[str, Any] fields, CommandSchema schema)
 
ZHAData create_zha_config (HomeAssistant hass, HAZHAData ha_zha_data)
 
dict[str, Any] exclude_none_values (Mapping[str, Any] obj)
 
ConfigEntry get_config_entry (HomeAssistant hass)
 
HAZHAData get_zha_data (HomeAssistant hass)
 
Gateway get_zha_gateway (HomeAssistant hass)
 
ZHAGatewayProxy get_zha_gateway_proxy (HomeAssistant hass)
 
Any schema_type_to_vol (Any field_type)
 

Variables

 _LogFilterType
 
 _LOGGER = logging.getLogger(__name__)
 
 CONF_ZHA_ALARM_SCHEMA
 
 CONF_ZHA_OPTIONS_SCHEMA
 
string DEBUG_COMP_BELLOWS = "bellows"
 
string DEBUG_COMP_ZHA = "homeassistant.components.zha"
 
string DEBUG_COMP_ZIGPY = "zigpy"
 
string DEBUG_COMP_ZIGPY_DECONZ = "zigpy_deconz"
 
string DEBUG_COMP_ZIGPY_XBEE = "zigpy_xbee"
 
string DEBUG_COMP_ZIGPY_ZIGATE = "zigpy_zigate"
 
string DEBUG_COMP_ZIGPY_ZNP = "zigpy_znp"
 
string DEBUG_LEVEL_CURRENT = "current"
 
string DEBUG_LEVEL_ORIGINAL = "original"
 
dictionary DEBUG_LEVELS
 
string DEBUG_LIB_ZHA = "zha"
 
list DEBUG_RELAY_LOGGERS = [DEBUG_COMP_ZHA, DEBUG_COMP_ZIGPY, DEBUG_LIB_ZHA]
 
string DEPTH = "depth"
 
string DEST_NWK = "dest_nwk"
 
string DEVICE_REG_ID = "device_reg_id"
 
string ENTITIES = "entities"
 
string EXTENDED_PAN_ID = "extended_pan_id"
 
list GROUP_ENTITY_DOMAINS = [Platform.LIGHT, Platform.SWITCH, Platform.FAN]
 
string MANY_TO_ONE = "many_to_one"
 
string MEMORY_CONSTRAINED = "memory_constrained"
 
string NEXT_HOP = "next_hop"
 
string PERMIT_JOINING = "permit_joining"
 
string RELATIONSHIP = "relationship"
 
string ROUTE_RECORD_REQUIRED = "route_record_required"
 
string ROUTE_STATUS = "route_status"
 
string RX_ON_WHEN_IDLE = "rx_on_when_idle"
 
string SIGNAL_ADD_ENTITIES = "zha_add_entities"
 
string SIGNAL_REMOVE_ENTITIES = "zha_remove_entities"
 
string USER_GIVEN_NAME = "user_given_name"
 
string ZHA_GW_MSG_LOG_ENTRY = "log_entry"
 
string ZHA_GW_MSG_LOG_OUTPUT = "log_output"
 

Detailed Description

Helper functions for the ZHA integration.

Function Documentation

◆ _clean_serial_port_path()

str homeassistant.components.zha.helpers._clean_serial_port_path ( str  path)
private
Clean the serial port path, applying corrections where necessary.

Definition at line 1184 of file helpers.py.

◆ _EntityT()

def homeassistant.components.zha.helpers._EntityT
private

Definition at line 1327 of file helpers.py.

◆ async_add_entities()

None homeassistant.components.zha.helpers.async_add_entities ( AddEntitiesCallback  _async_add_entities,
type[ZHAEntity entity_class,
list[EntityData entities,
**  kwargs 
)
Add entities helper.

Definition at line 1156 of file helpers.py.

◆ async_capture_log_levels()

dict[str, int] homeassistant.components.zha.helpers.async_capture_log_levels ( )
Capture current logger levels for ZHA.

Definition at line 927 of file helpers.py.

◆ async_cluster_exists()

def homeassistant.components.zha.helpers.async_cluster_exists ( HomeAssistant  hass,
  cluster_id,
  skip_coordinator = True 
)
Determine if a device containing the specified in cluster is paired.

Definition at line 1138 of file helpers.py.

◆ async_get_zha_device_proxy()

ZHADeviceProxy homeassistant.components.zha.helpers.async_get_zha_device_proxy ( HomeAssistant  hass,
str  device_id 
)
Get a ZHA device for the given device registry id.

Definition at line 1053 of file helpers.py.

◆ async_set_logger_levels()

None homeassistant.components.zha.helpers.async_set_logger_levels ( dict[str, int]  levels)
Set logger levels for ZHA.

Definition at line 950 of file helpers.py.

◆ cluster_command_schema_to_vol_schema()

vol.Schema homeassistant.components.zha.helpers.cluster_command_schema_to_vol_schema ( CommandSchema  schema)
Convert a cluster command schema to a voluptuous schema.

Definition at line 1070 of file helpers.py.

◆ convert_to_zcl_values()

dict[str, Any] homeassistant.components.zha.helpers.convert_to_zcl_values ( dict[str, Any]  fields,
CommandSchema   schema 
)
Convert user input to ZCL values.

Definition at line 1101 of file helpers.py.

◆ create_zha_config()

ZHAData homeassistant.components.zha.helpers.create_zha_config ( HomeAssistant  hass,
HAZHAData  ha_zha_data 
)
Create ZHA lib configuration from HA config objects.

Definition at line 1228 of file helpers.py.

◆ exclude_none_values()

dict[str, Any] homeassistant.components.zha.helpers.exclude_none_values ( Mapping[str, Any]  obj)
Return a new dictionary excluding keys with None values.

Definition at line 1342 of file helpers.py.

◆ get_config_entry()

ConfigEntry homeassistant.components.zha.helpers.get_config_entry ( HomeAssistant  hass)
Get the ZHA gateway object.

Definition at line 1044 of file helpers.py.

◆ get_zha_data()

HAZHAData homeassistant.components.zha.helpers.get_zha_data ( HomeAssistant  hass)
Get the global ZHA data object.

Definition at line 1020 of file helpers.py.

◆ get_zha_gateway()

Gateway homeassistant.components.zha.helpers.get_zha_gateway ( HomeAssistant  hass)
Get the ZHA gateway object.

Definition at line 1028 of file helpers.py.

◆ get_zha_gateway_proxy()

ZHAGatewayProxy homeassistant.components.zha.helpers.get_zha_gateway_proxy ( HomeAssistant  hass)
Get the ZHA gateway object.

Definition at line 1036 of file helpers.py.

◆ schema_type_to_vol()

Any homeassistant.components.zha.helpers.schema_type_to_vol ( Any  field_type)
Convert a schema type to a voluptuous type.

Definition at line 1082 of file helpers.py.

Variable Documentation

◆ _LogFilterType

homeassistant.components.zha.helpers._LogFilterType
private

Definition at line 173 of file helpers.py.

◆ _LOGGER

homeassistant.components.zha.helpers._LOGGER = logging.getLogger(__name__)
private

Definition at line 175 of file helpers.py.

◆ CONF_ZHA_ALARM_SCHEMA

homeassistant.components.zha.helpers.CONF_ZHA_ALARM_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  vol.Required(CONF_ALARM_MASTER_CODE, default="1234"): cv.string,
4  vol.Required(CONF_ALARM_FAILED_TRIES, default=3): cv.positive_int,
5  vol.Required(CONF_ALARM_ARM_REQUIRES_CODE, default=False): cv.boolean,
6  }
7 )

Definition at line 1219 of file helpers.py.

◆ CONF_ZHA_OPTIONS_SCHEMA

homeassistant.components.zha.helpers.CONF_ZHA_OPTIONS_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  vol.Optional(CONF_DEFAULT_LIGHT_TRANSITION, default=0): vol.All(
4  vol.Coerce(float), vol.Range(min=0, max=2**16 / 10)
5  ),
6  vol.Required(CONF_ENABLE_ENHANCED_LIGHT_TRANSITION, default=False): cv.boolean,
7  vol.Required(CONF_ENABLE_LIGHT_TRANSITIONING_FLAG, default=True): cv.boolean,
8  vol.Required(CONF_GROUP_MEMBERS_ASSUME_STATE, default=True): cv.boolean,
9  vol.Required(CONF_ENABLE_IDENTIFY_ON_JOIN, default=True): cv.boolean,
10  vol.Optional(
11  CONF_CONSIDER_UNAVAILABLE_MAINS,
12  default=CONF_DEFAULT_CONSIDER_UNAVAILABLE_MAINS,
13  ): cv.positive_int,
14  vol.Optional(
15  CONF_CONSIDER_UNAVAILABLE_BATTERY,
16  default=CONF_DEFAULT_CONSIDER_UNAVAILABLE_BATTERY,
17  ): cv.positive_int,
18  vol.Required(CONF_ENABLE_MAINS_STARTUP_POLLING, default=True): cv.boolean,
19  },
20  extra=vol.REMOVE_EXTRA,
21 )

Definition at line 1197 of file helpers.py.

◆ DEBUG_COMP_BELLOWS

string homeassistant.components.zha.helpers.DEBUG_COMP_BELLOWS = "bellows"

Definition at line 177 of file helpers.py.

◆ DEBUG_COMP_ZHA

string homeassistant.components.zha.helpers.DEBUG_COMP_ZHA = "homeassistant.components.zha"

Definition at line 178 of file helpers.py.

◆ DEBUG_COMP_ZIGPY

string homeassistant.components.zha.helpers.DEBUG_COMP_ZIGPY = "zigpy"

Definition at line 180 of file helpers.py.

◆ DEBUG_COMP_ZIGPY_DECONZ

string homeassistant.components.zha.helpers.DEBUG_COMP_ZIGPY_DECONZ = "zigpy_deconz"

Definition at line 182 of file helpers.py.

◆ DEBUG_COMP_ZIGPY_XBEE

string homeassistant.components.zha.helpers.DEBUG_COMP_ZIGPY_XBEE = "zigpy_xbee"

Definition at line 183 of file helpers.py.

◆ DEBUG_COMP_ZIGPY_ZIGATE

string homeassistant.components.zha.helpers.DEBUG_COMP_ZIGPY_ZIGATE = "zigpy_zigate"

Definition at line 184 of file helpers.py.

◆ DEBUG_COMP_ZIGPY_ZNP

string homeassistant.components.zha.helpers.DEBUG_COMP_ZIGPY_ZNP = "zigpy_znp"

Definition at line 181 of file helpers.py.

◆ DEBUG_LEVEL_CURRENT

string homeassistant.components.zha.helpers.DEBUG_LEVEL_CURRENT = "current"

Definition at line 185 of file helpers.py.

◆ DEBUG_LEVEL_ORIGINAL

string homeassistant.components.zha.helpers.DEBUG_LEVEL_ORIGINAL = "original"

Definition at line 186 of file helpers.py.

◆ DEBUG_LEVELS

dictionary homeassistant.components.zha.helpers.DEBUG_LEVELS
Initial value:
1 = {
2  DEBUG_COMP_BELLOWS: logging.DEBUG,
3  DEBUG_COMP_ZHA: logging.DEBUG,
4  DEBUG_COMP_ZIGPY: logging.DEBUG,
5  DEBUG_COMP_ZIGPY_ZNP: logging.DEBUG,
6  DEBUG_COMP_ZIGPY_DECONZ: logging.DEBUG,
7  DEBUG_COMP_ZIGPY_XBEE: logging.DEBUG,
8  DEBUG_COMP_ZIGPY_ZIGATE: logging.DEBUG,
9  DEBUG_LIB_ZHA: logging.DEBUG,
10 }

Definition at line 187 of file helpers.py.

◆ DEBUG_LIB_ZHA

string homeassistant.components.zha.helpers.DEBUG_LIB_ZHA = "zha"

Definition at line 179 of file helpers.py.

◆ DEBUG_RELAY_LOGGERS

list homeassistant.components.zha.helpers.DEBUG_RELAY_LOGGERS = [DEBUG_COMP_ZHA, DEBUG_COMP_ZIGPY, DEBUG_LIB_ZHA]

Definition at line 197 of file helpers.py.

◆ DEPTH

string homeassistant.components.zha.helpers.DEPTH = "depth"

Definition at line 209 of file helpers.py.

◆ DEST_NWK

string homeassistant.components.zha.helpers.DEST_NWK = "dest_nwk"

Definition at line 211 of file helpers.py.

◆ DEVICE_REG_ID

string homeassistant.components.zha.helpers.DEVICE_REG_ID = "device_reg_id"

Definition at line 219 of file helpers.py.

◆ ENTITIES

string homeassistant.components.zha.helpers.ENTITIES = "entities"

Definition at line 203 of file helpers.py.

◆ EXTENDED_PAN_ID

string homeassistant.components.zha.helpers.EXTENDED_PAN_ID = "extended_pan_id"

Definition at line 207 of file helpers.py.

◆ GROUP_ENTITY_DOMAINS

list homeassistant.components.zha.helpers.GROUP_ENTITY_DOMAINS = [Platform.LIGHT, Platform.SWITCH, Platform.FAN]

Definition at line 201 of file helpers.py.

◆ MANY_TO_ONE

string homeassistant.components.zha.helpers.MANY_TO_ONE = "many_to_one"

Definition at line 214 of file helpers.py.

◆ MEMORY_CONSTRAINED

string homeassistant.components.zha.helpers.MEMORY_CONSTRAINED = "memory_constrained"

Definition at line 213 of file helpers.py.

◆ NEXT_HOP

string homeassistant.components.zha.helpers.NEXT_HOP = "next_hop"

Definition at line 216 of file helpers.py.

◆ PERMIT_JOINING

string homeassistant.components.zha.helpers.PERMIT_JOINING = "permit_joining"

Definition at line 208 of file helpers.py.

◆ RELATIONSHIP

string homeassistant.components.zha.helpers.RELATIONSHIP = "relationship"

Definition at line 206 of file helpers.py.

◆ ROUTE_RECORD_REQUIRED

string homeassistant.components.zha.helpers.ROUTE_RECORD_REQUIRED = "route_record_required"

Definition at line 215 of file helpers.py.

◆ ROUTE_STATUS

string homeassistant.components.zha.helpers.ROUTE_STATUS = "route_status"

Definition at line 212 of file helpers.py.

◆ RX_ON_WHEN_IDLE

string homeassistant.components.zha.helpers.RX_ON_WHEN_IDLE = "rx_on_when_idle"

Definition at line 205 of file helpers.py.

◆ SIGNAL_ADD_ENTITIES

string homeassistant.components.zha.helpers.SIGNAL_ADD_ENTITIES = "zha_add_entities"

Definition at line 202 of file helpers.py.

◆ SIGNAL_REMOVE_ENTITIES

string homeassistant.components.zha.helpers.SIGNAL_REMOVE_ENTITIES = "zha_remove_entities"

Definition at line 200 of file helpers.py.

◆ USER_GIVEN_NAME

string homeassistant.components.zha.helpers.USER_GIVEN_NAME = "user_given_name"

Definition at line 218 of file helpers.py.

◆ ZHA_GW_MSG_LOG_ENTRY

string homeassistant.components.zha.helpers.ZHA_GW_MSG_LOG_ENTRY = "log_entry"

Definition at line 198 of file helpers.py.

◆ ZHA_GW_MSG_LOG_OUTPUT

string homeassistant.components.zha.helpers.ZHA_GW_MSG_LOG_OUTPUT = "log_output"

Definition at line 199 of file helpers.py.