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

Classes

class  ZwaveValueID
 
class  ZwaveValueMatcher
 

Functions

str|None _zwave_js_config_entry (HomeAssistant hass, dr.DeviceEntry device)
 
None async_disable_server_logging_if_needed (HomeAssistant hass, ConfigEntry entry, Driver driver)
 
None async_enable_server_logging_if_needed (HomeAssistant hass, ConfigEntry entry, Driver driver)
 
None async_enable_statistics (Driver driver)
 
ZwaveNode async_get_node_from_device_id (HomeAssistant hass, str device_id, dr.DeviceRegistry|None dev_reg=None)
 
ZwaveNode async_get_node_from_entity_id (HomeAssistant hass, str entity_id, er.EntityRegistry|None ent_reg=None, dr.DeviceRegistry|None dev_reg=None)
 
str|None async_get_node_status_sensor_entity_id (HomeAssistant hass, str device_id, er.EntityRegistry|None ent_reg=None, dr.DeviceRegistry|None dev_reg=None)
 
set[ZwaveNode] async_get_nodes_from_area_id (HomeAssistant hass, str area_id, er.EntityRegistry|None ent_reg=None, dr.DeviceRegistry|None dev_reg=None)
 
set[ZwaveNode] async_get_nodes_from_targets (HomeAssistant hass, dict[str, Any] val, er.EntityRegistry|None ent_reg=None, dr.DeviceRegistry|None dev_reg=None, logging.Logger logger=LOGGER)
 
Callable[[ConfigType], ConfigType] check_type_schema_map (dict[str, vol.Schema] schema_map)
 
None copy_available_params (dict[str, Any] input_dict, dict[str, Any] output_dict, list[str] params)
 
tuple[str, str] get_device_id (Driver driver, ZwaveNode node)
 
tuple[str, str]|None get_device_id_ext (Driver driver, ZwaveNode node)
 
DeviceInfo get_device_info (Driver driver, ZwaveNode node)
 
tuple[str, int]|None get_home_and_node_id_from_device_entry (dr.DeviceEntry device_entry)
 
str get_network_identifier_for_notification (HomeAssistant hass, ConfigEntry config_entry, Controller controller)
 
int|None get_state_key_from_unique_id (str unique_id)
 
str get_unique_id (Driver driver, str value_id)
 
str|None get_value_id_from_unique_id (str unique_id)
 
Any|None get_value_of_zwave_value (ZwaveValue|None value)
 
VolSchemaType|vol.Coerce|vol.In|None get_value_state_schema (ZwaveValue value)
 
str get_valueless_base_unique_id (Driver driver, ZwaveNode node)
 
ZwaveValue get_zwave_value_from_config (ZwaveNode node, ConfigType config)
 
ConfigType remove_keys_with_empty_values (ConfigType config)
 
bool value_matches_matcher (ZwaveValueMatcher matcher, ValueDataType value_data)
 

Detailed Description

Helper functions for Z-Wave JS integration.

Function Documentation

◆ _zwave_js_config_entry()

str | None homeassistant.components.zwave_js.helpers._zwave_js_config_entry ( HomeAssistant  hass,
dr.DeviceEntry  device 
)
private
Find zwave_js config entry from a device.

Definition at line 416 of file helpers.py.

◆ async_disable_server_logging_if_needed()

None homeassistant.components.zwave_js.helpers.async_disable_server_logging_if_needed ( HomeAssistant  hass,
ConfigEntry  entry,
Driver   driver 
)
Disable logging of zwave-js-server in the lib if still connected to server.

Definition at line 173 of file helpers.py.

◆ async_enable_server_logging_if_needed()

None homeassistant.components.zwave_js.helpers.async_enable_server_logging_if_needed ( HomeAssistant  hass,
ConfigEntry  entry,
Driver   driver 
)
Enable logging of zwave-js-server in the lib.

Definition at line 139 of file helpers.py.

◆ async_enable_statistics()

None homeassistant.components.zwave_js.helpers.async_enable_statistics ( Driver  driver)
Enable statistics on the driver.

Definition at line 134 of file helpers.py.

◆ async_get_node_from_device_id()

ZwaveNode homeassistant.components.zwave_js.helpers.async_get_node_from_device_id ( HomeAssistant  hass,
str  device_id,
dr.DeviceRegistry | None   dev_reg = None 
)
Get node from a device ID.

Raises ValueError if device is invalid or node can't be found.

Definition at line 251 of file helpers.py.

◆ async_get_node_from_entity_id()

ZwaveNode homeassistant.components.zwave_js.helpers.async_get_node_from_entity_id ( HomeAssistant  hass,
str  entity_id,
er.EntityRegistry | None   ent_reg = None,
dr.DeviceRegistry | None   dev_reg = None 
)
Get node from an entity ID.

Raises ValueError if entity is invalid.

Definition at line 301 of file helpers.py.

◆ async_get_node_status_sensor_entity_id()

str | None homeassistant.components.zwave_js.helpers.async_get_node_status_sensor_entity_id ( HomeAssistant  hass,
str  device_id,
er.EntityRegistry | None   ent_reg = None,
dr.DeviceRegistry | None   dev_reg = None 
)
Get the node status sensor entity ID for a given Z-Wave JS device.

Definition at line 426 of file helpers.py.

◆ async_get_nodes_from_area_id()

set[ZwaveNode] homeassistant.components.zwave_js.helpers.async_get_nodes_from_area_id ( HomeAssistant  hass,
str  area_id,
er.EntityRegistry | None   ent_reg = None,
dr.DeviceRegistry | None   dev_reg = None 
)
Get nodes for all Z-Wave JS devices and entities that are in an area.

Definition at line 325 of file helpers.py.

◆ async_get_nodes_from_targets()

set[ZwaveNode] homeassistant.components.zwave_js.helpers.async_get_nodes_from_targets ( HomeAssistant  hass,
dict[str, Any]  val,
er.EntityRegistry | None   ent_reg = None,
dr.DeviceRegistry | None   dev_reg = None,
logging.Logger   logger = LOGGER 
)
Get nodes for all targets.

Supports entity_id with group expansion, area_id, and device_id.

Definition at line 363 of file helpers.py.

◆ check_type_schema_map()

Callable[[ConfigType], ConfigType] homeassistant.components.zwave_js.helpers.check_type_schema_map ( dict[str, vol.Schema]  schema_map)
Check type specific schema against config.

Definition at line 459 of file helpers.py.

◆ copy_available_params()

None homeassistant.components.zwave_js.helpers.copy_available_params ( dict[str, Any]  input_dict,
dict[str, Any]  output_dict,
list[str]   params 
)
Copy available params from input into output.

Definition at line 471 of file helpers.py.

◆ get_device_id()

tuple[str, str] homeassistant.components.zwave_js.helpers.get_device_id ( Driver  driver,
ZwaveNode  node 
)
Get device registry identifier for Z-Wave node.

Definition at line 212 of file helpers.py.

◆ get_device_id_ext()

tuple[str, str] | None homeassistant.components.zwave_js.helpers.get_device_id_ext ( Driver  driver,
ZwaveNode  node 
)
Get extended device registry identifier for Z-Wave node.

Definition at line 217 of file helpers.py.

◆ get_device_info()

DeviceInfo homeassistant.components.zwave_js.helpers.get_device_info ( Driver  driver,
ZwaveNode  node 
)
Get DeviceInfo for node.

Definition at line 510 of file helpers.py.

◆ get_home_and_node_id_from_device_entry()

tuple[str, int] | None homeassistant.components.zwave_js.helpers.get_home_and_node_id_from_device_entry ( dr.DeviceEntry  device_entry)
Get home ID and node ID for Z-Wave device registry entry.

Returns (home_id, node_id) or None if not found.

Definition at line 229 of file helpers.py.

◆ get_network_identifier_for_notification()

str homeassistant.components.zwave_js.helpers.get_network_identifier_for_notification ( HomeAssistant  hass,
ConfigEntry  config_entry,
Controller   controller 
)
Return the network identifier string for persistent notifications.

Definition at line 522 of file helpers.py.

◆ get_state_key_from_unique_id()

int | None homeassistant.components.zwave_js.helpers.get_state_key_from_unique_id ( str  unique_id)
Get the state key from a unique ID.

Definition at line 117 of file helpers.py.

◆ get_unique_id()

str homeassistant.components.zwave_js.helpers.get_unique_id ( Driver  driver,
str  value_id 
)
Get unique ID from client and value ID.

Definition at line 207 of file helpers.py.

◆ get_value_id_from_unique_id()

str | None homeassistant.components.zwave_js.helpers.get_value_id_from_unique_id ( str  unique_id)
Get the value ID and optional state key from a unique ID.

Raises ValueError

Definition at line 104 of file helpers.py.

◆ get_value_of_zwave_value()

Any | None homeassistant.components.zwave_js.helpers.get_value_of_zwave_value ( ZwaveValue | None  value)
Return the value of a ZwaveValue.

Definition at line 129 of file helpers.py.

◆ get_value_state_schema()

VolSchemaType | vol.Coerce | vol.In | None homeassistant.components.zwave_js.helpers.get_value_state_schema ( ZwaveValue  value)
Return device automation schema for a config entry.

Definition at line 480 of file helpers.py.

◆ get_valueless_base_unique_id()

str homeassistant.components.zwave_js.helpers.get_valueless_base_unique_id ( Driver  driver,
ZwaveNode  node 
)
Return the base unique ID for an entity that is not based on a value.

Definition at line 202 of file helpers.py.

◆ get_zwave_value_from_config()

ZwaveValue homeassistant.components.zwave_js.helpers.get_zwave_value_from_config ( ZwaveNode  node,
ConfigType  config 
)
Get a Z-Wave JS Value from a config.

Definition at line 396 of file helpers.py.

◆ remove_keys_with_empty_values()

ConfigType homeassistant.components.zwave_js.helpers.remove_keys_with_empty_values ( ConfigType  config)
Remove keys from config where the value is an empty string or None.

Definition at line 454 of file helpers.py.

◆ value_matches_matcher()

bool homeassistant.components.zwave_js.helpers.value_matches_matcher ( ZwaveValueMatcher  matcher,
ValueDataType   value_data 
)
Return whether value matches matcher.

Definition at line 83 of file helpers.py.