Discover Fibaro FGMS001 v2.8 as a motion sensor for Z-Wave#169276
Conversation
|
Hey there @home-assistant/z-wave, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
Adds a targeted Z-Wave JS discovery schema so the Fibaro FGMS001 (firmware <= 2.8) is discovered as a motion binary_sensor when it only exposes a Sensor Binary CC v1 Any value.
Changes:
- Import
FirmwareVersionRangefor use in binary sensor discovery schemas. - Add a device-specific
NewZWaveDiscoverySchemamatching Fibaro FGMS001 identifiers, constrained to firmware <= 2.8, mapping Sensor BinaryAnytoBinarySensorDeviceClass.MOTION.
There was a problem hiding this comment.
Pull request overview
This PR adds a device-specific Z-Wave JS discovery schema so the Fibaro FGMS001 (firmware ≤ 2.8) is discovered as a motion binary_sensor when it only exposes a generic Binary Sensor CC “Any” value.
Changes:
- Add a targeted
NewZWaveDiscoverySchemafor Fibaro FGMS001 (firmware ≤ 2.8) mapping Binary Sensor “Any” toBinarySensorDeviceClass.MOTION. - Add a simulated-device node state fixture for FGMS001 v2.8.
- Add a discovery test to validate a motion
binary_sensoris created for that fixture.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| homeassistant/components/zwave_js/binary_sensor.py | Adds a Fibaro FGMS001 (≤ 2.8) binary-sensor discovery override to classify “Any” as motion. |
| tests/components/zwave_js/test_binary_sensor.py | Adds a test asserting the device is discovered as a motion binary sensor. |
| tests/components/zwave_js/conftest.py | Adds fixtures to load the FGMS001 v2.8 node state and instantiate a Node. |
| tests/components/zwave_js/fixtures/fibaro_fgms001_v2_8_state.json | Introduces the simulated device JSON fixture used by the new test. |
| type={ValueType.BOOLEAN}, | ||
| ), | ||
| entity_description=BinarySensorEntityDescription( | ||
| key="motion", |
There was a problem hiding this comment.
I think this is not necessarily needed, right? By default, the sensor's name matches the device.
There was a problem hiding this comment.
It's nice to include the sensor feature in the name since there often is more than one sensor on a device. Lights and switches etc don't need an extra name since those seldom are more than one per device.
There was a problem hiding this comment.
Pull request overview
Adds a device-specific Z-Wave JS discovery override so the Fibaro FGMS001 (firmware ≤ 2.8) is created as a motion binary_sensor (instead of being misclassified, e.g., as a light), and verifies it via a new discovery test + fixture.
Changes:
- Add a targeted
NewZWaveDiscoverySchemafor Fibaro FGMS001 firmware ≤ 2.8 mappingSensor Binary (Any)toBinarySensorDeviceClass.MOTION. - Add a new discovery test asserting exactly one enabled motion
binary_sensoris created and nolightentity is created. - Add node state + pytest fixtures for an FGMS001 (fw 2.8) from a simulated device.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
homeassistant/components/zwave_js/binary_sensor.py |
Adds a firmware-bounded, device-specific discovery schema to classify FGMS001 “Any” binary sensor values as motion. |
tests/components/zwave_js/test_discovery.py |
Adds an automated regression test covering the new discovery behavior and ensuring no light entity is created. |
tests/components/zwave_js/conftest.py |
Adds fixtures to load the FGMS001 v2.8 node state and construct a Node for tests. |
tests/components/zwave_js/fixtures/fibaro_fgms001_v2_8_state.json |
Provides the captured node state used by the new fixtures/test. |
MartinHjelmare
left a comment
There was a problem hiding this comment.
Let's merge here now. We can adjust the entity name in a follow up if wanted.
Proposed change
This PR adds a targeted discovery schema for the Fibaro FGMS001 Motion Sensor to actually detect it as a motion sensor rather than a light entity.
On firmware <= 2.8 the device supports Binary Sensor CC v1, which does not give us any information about the type of the sensor. As a result it is exposed via the generic "Any" sensor type, which fits no other discovery schema.
Note that this change will only take effect once zwave-js/zwave-js#8765 is released. Until then it does nothing.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: