ha-core/homeassistant/components/zwave_js
Marc Mueller 386533a16f
Update mypy to 1.1.1 (#89268)
* Update mypy to 1.1.1
* Update pydantic to 1.10.6
2023-03-08 22:57:54 +01:00
..
docs
triggers
README.md Update zwave_js README with contributor instructions (#89158) 2023-03-06 12:06:53 +01:00
__init__.py Adjust entity registry access in integrations (1) (#88946) 2023-03-01 08:02:34 +01:00
addon.py
api.py Remove unused constant (#89071) 2023-03-02 23:21:40 -05:00
binary_sensor.py
button.py
climate.py
config_flow.py
config_validation.py
const.py
cover.py
device_action.py Adjust entity registry access in integrations (1) (#88946) 2023-03-01 08:02:34 +01:00
device_automation_helpers.py
device_condition.py
device_trigger.py Adjust entity registry access in integrations (1) (#88946) 2023-03-01 08:02:34 +01:00
diagnostics.py
discovery.py Update mypy to 1.1.1 (#89268) 2023-03-08 22:57:54 +01:00
discovery_data_template.py
entity.py
fan.py
helpers.py
humidifier.py
light.py
lock.py
logbook.py
manifest.json Bump zwave-js-server-python to 0.46.0 (#88520) 2023-02-21 07:15:55 +01:00
migrate.py
number.py
select.py
sensor.py
services.py
services.yaml
siren.py
strings.json
switch.py
trigger.py Improve type hint in zwave_js trigger (#88597) 2023-02-22 13:39:28 +01:00
update.py

README.md

Z-Wave Integration

This document covers details that new contributors may find helpful when getting started.

Improving device support

This section can help new contributors learn how to improve Z-Wave device support within Home Assistant.

The Z-Wave integration uses a discovery mechanism to create the necessary entities for each of your Z-Wave nodes. To perform this discovery, the integration iterates through each node's Values and compares them to a list of discovery rules. If there is a match between a particular discovery rule and the given Value, the integration creates an entity for that value using information sent from the discovery logic to indicate entity platform and instance type.

In cases where an entity's functionality requires interaction with multiple Values, the discovery rule for that particular entity type is based on the primary Value, or the Value that must be there to indicate that this entity needs to be created, and then the rest of the Values required are discovered by the class instance for that entity. A good example of this is the discovery logic for the climate entity. Currently, the discovery logic is tied to the discovery of a Value with a property of mode and a command class of Thermostat Mode, but the actual entity uses many more Values than that to be fully functional as evident in the code.

There are several ways that device support can be improved within Home Assistant, but regardless of the reason, it is important to add device specific tests in these use cases. To do so, add the device's data (from device diagnostics) to the fixtures folder and then define the new fixtures in conftest.py. Use existing tests as the model but the tests can go in the test_discovery.py module.

Switching HA support for a device from one entity type to another.

Sometimes manufacturers don't follow the spec properly and implement functionality using the wrong command class, resulting in HA discovering the feature as the wrong entity type. There is a section in the discovery rules for device specific discovery. This can be used to override the type of entity that HA discovers for that particular device's primary Value.

Adding feature support to complex entity types

Sometimes the generic Z-Wave entity logic does not provide all of the features a device is capable of. A great example of this is a climate entity where the current temperature is determined by one of multiple sensors that is configurable by a configuration parameter. In these cases, there is a section in the discovery rules for device specific discovery. By leveraging discovery_data_template.py, it is possible to create the same entity type but with different logic. Generally, we don't like to create entity classes that are device specific, so this mechanism allows us to generalize the implementation.

Architecture

This section describes the architecture of Z-Wave JS in Home Assistant and how the integration is connected all the way to the Z-Wave USB stick controller.

Connection diagram

alt text

Z-Wave USB stick

Communicates with devices via the Z-Wave radio and stores device pairing.

Z-Wave JS

Represents the USB stick serial protocol as devices.

Z-Wave JS Server

Forward the state of Z-Wave JS over a WebSocket connection.

Z-Wave JS Server Python

Consumes the WebSocket connection and makes the Z-Wave JS state available in Python.

Z-Wave integration

Represents Z-Wave devices in Home Assistant and allows control.

Home Assistant

Best home automation platform in the world.

Running Z-Wave JS Server

alt text

Z-Wave JS Server can be run as a standalone Node app.

It can also run as part of Z-Wave JS UI, which is also a standalone Node app.

Both apps are available as Home Assistant add-ons. There are also Docker containers etc.