hass-core/homeassistant/components/zwave_js
2023-11-07 09:11:38 -05:00
..
docs Add zwave_js dev docs readme (#47621) 2021-03-15 15:08:45 +01:00
scripts Fix zwave_js cover bug for Window Covering CC values (#103289) 2023-11-03 15:36:48 +01:00
triggers Don't require passing identifiers to DeviceRegistry.async_get_device (#96479) 2023-07-13 13:39:25 -04:00
__init__.py Notify users when zwave device gets reset (#101362) 2023-10-04 10:18:48 +02:00
addon.py Move zwave_js addon manager to hassio integration (#81354) 2022-11-10 10:09:52 +01:00
api.py Update zwave_js/hard_reset_controller WS cmd (#102280) 2023-10-24 21:31:03 -04:00
binary_sensor.py Add zwave config parameter entities (#92223) 2023-05-30 11:49:55 -04:00
button.py Add error handling for all zwave_js service calls (#93846) 2023-05-31 11:09:01 -04:00
climate.py Revert "Fix temperature setting for multi-setpoint z-wave device (#102395)" (#103022) 2023-10-29 19:15:19 +01:00
config_flow.py Use asyncio.timeout [s-z] (#98452) 2023-08-15 14:34:18 +02:00
config_validation.py Improve zwave_js custom triggers and services (#67461) 2022-03-05 09:00:31 +01:00
const.py Add zwave_js.refresh_notifications service (#101370) 2023-11-07 09:11:38 -05:00
cover.py Fix zwave_js cover bug for Window Covering CC values (#103289) 2023-11-03 15:36:48 +01:00
device_action.py Bump zwave-js-server-python to 0.50.1 (#94760) 2023-08-10 01:28:08 -04:00
device_automation_helpers.py Bump zwave-js-server-python to 0.50.1 (#94760) 2023-08-10 01:28:08 -04:00
device_condition.py Bump zwave-js-server-python to 0.50.1 (#94760) 2023-08-10 01:28:08 -04:00
device_trigger.py Teach zwave_js device trigger about entity registry ids (#96303) 2023-07-22 17:29:24 +02:00
diagnostics.py Bump zwave-js-server-python to 0.50.1 (#94760) 2023-08-10 01:28:08 -04:00
discovery.py Add support for zwave_js event entities (#102285) 2023-10-20 19:11:08 -04:00
discovery_data_template.py Handle invalid scale for zwave_js multilevel/meter sensors (#101173) 2023-10-04 22:55:18 -04:00
entity.py Fix zwave_js siren name (#103016) 2023-10-29 17:44:15 +01:00
event.py Add support for zwave_js event entities (#102285) 2023-10-20 19:11:08 -04:00
fan.py Add error handling for all zwave_js service calls (#93846) 2023-05-31 11:09:01 -04:00
helpers.py Notify users when zwave device gets reset (#101362) 2023-10-04 10:18:48 +02:00
humidifier.py Add error handling for all zwave_js service calls (#93846) 2023-05-31 11:09:01 -04:00
light.py Make Basic CC Z-Wave values a light (#101438) 2023-10-13 11:11:44 -04:00
lock.py Improve logic for zwave_js.lock.is_locked attr (#93947) 2023-06-02 06:12:32 -04:00
logbook.py Use platform constants from root (#78032) 2022-09-08 12:24:45 +02:00
manifest.json Bump zwave-js-server-python to 0.53.1 (#102790) 2023-10-25 17:22:33 +02:00
migrate.py Collection of code styling tweaks (#87344) 2023-02-03 23:51:27 +01:00
number.py Add error handling for all zwave_js service calls (#93846) 2023-05-31 11:09:01 -04:00
README.md Add script to convert zwave_js device diagnostics to fixture (#102799) 2023-10-25 16:07:22 -04:00
repairs.py Handle disconnects in zwave_js repair flow (#99964) 2023-09-12 04:21:44 +02:00
select.py Add error handling for all zwave_js service calls (#93846) 2023-05-31 11:09:01 -04:00
sensor.py Use shorthand attrs for device_class zwave_js sensor (#100414) 2023-09-16 10:13:27 +02:00
services.py Add zwave_js.refresh_notifications service (#101370) 2023-11-07 09:11:38 -05:00
services.yaml Add zwave_js.refresh_notifications service (#101370) 2023-11-07 09:11:38 -05:00
siren.py Fix zwave_js siren name (#103016) 2023-10-29 17:44:15 +01:00
strings.json Add zwave_js.refresh_notifications service (#101370) 2023-11-07 09:11:38 -05:00
switch.py Add zwave config parameter entities (#92223) 2023-05-30 11:49:55 -04:00
trigger.py Improve test coverage for zwave_js.trigger (#93260) 2023-05-22 17:55:03 +02:00
update.py Add test for firmware update scenario (#103314) 2023-11-04 13:12:06 +01:00

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 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. To learn how to generate fixtures, see the following section.

Generating device fixtures

To generate a device fixture, download a diagnostics dump of the device from your Home Assistant instance. The dumped data will need to be modified to match the expected format. You can always do this transformation by hand, but the integration provides a helper script that will generate the appropriate fixture data from a device diagnostics dump for you. To use it, run the script with the path to the diagnostics dump you downloaded:

python homeassistant/components/zwave_js/scripts/convert_device_diagnostics_to_fixture.py <path/to/diagnostics/dump>

The script will print the fixture data to standard output, and you can use Unix piping to create a file from the fixture data:

python homeassistant/components/zwave_js/scripts/convert_device_diagnostics_to_fixture.py <path/to/diagnostics/dump> > <path_to_fixture_output>

You can alternatively pass the --file flag to the script and it will create the file for you in the fixtures folder: python homeassistant/components/zwave_js/scripts/convert_device_diagnostics_to_fixture.py <path/to/diagnostics/dump> --file

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.