1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-17 23:53:49 +01:00

Fix zwave_js fan speed mapping for GE/Jasco Enbrighten 55258 / ZW4002 (#166169)

This commit is contained in:
Tommy Goode
2026-03-23 05:55:46 -05:00
committed by Franck Nijhof
parent a81146a227
commit 622b92682e
4 changed files with 953 additions and 2 deletions

View File

@@ -205,14 +205,13 @@ DISCOVERY_SCHEMAS = [
FanValueMapping(speeds=[(1, 33), (34, 67), (68, 99)]),
),
),
# GE/Jasco - In-Wall Smart Fan Controls - 14287 / 55258 / ZW4002 and 14314 / ZW4002
# GE/Jasco - In-Wall Smart Fan Controls - 14314 / ZW4002
ZWaveDiscoverySchema(
platform=Platform.FAN,
hint="has_fan_value_mapping",
manufacturer_id={0x0063},
product_id={
0x3131,
0x3337, # 14287 / 55258 / ZW4002
0x3138, # 14314 / ZW4002
},
product_type={0x4944},
@@ -221,6 +220,18 @@ DISCOVERY_SCHEMAS = [
FanValueMapping(speeds=[(1, 32), (33, 66), (67, 99)]),
),
),
# GE/Jasco - In-Wall Smart Fan Controls - 14287 / 55258 / ZW4002
ZWaveDiscoverySchema(
platform=Platform.FAN,
hint="has_fan_value_mapping",
manufacturer_id={0x0063},
product_id={0x3337},
product_type={0x4944},
primary_value=SWITCH_MULTILEVEL_CURRENT_VALUE_SCHEMA,
data_template=FixedFanValueMappingDataTemplate(
FanValueMapping(speeds=[(1, 33), (34, 66), (67, 99)]),
),
),
# GE/Jasco - In-Wall Smart Fan Controls - 58446 / ZWA4013
ZWaveDiscoverySchema(
platform=Platform.FAN,

View File

@@ -346,6 +346,12 @@ def jasco_14314_state_fixture() -> dict[str, Any]:
return load_json_object_fixture("fan_jasco_14314_state.json", DOMAIN)
@pytest.fixture(name="enbrighten_55258_zw4002_state", scope="package")
def enbrighten_55258_zw4002_state_fixture() -> dict[str, Any]:
"""Load the Enbrighten/GE 55258/ZW4002 node state fixture data."""
return load_json_object_fixture("enbrighten_55258_zw4002_state.json", DOMAIN)
@pytest.fixture(name="enbrighten_58446_zwa4013_state", scope="package")
def enbrighten_58446_zwa4013_state_fixture() -> dict[str, Any]:
"""Load the Enbrighten/GE 58446/zwa401 node state fixture data."""
@@ -1157,6 +1163,14 @@ def jasco_14314_fixture(client, jasco_14314_state) -> Node:
return node
@pytest.fixture(name="enbrighten_55258_zw4002")
def enbrighten_55258_zw4002_fixture(client, enbrighten_55258_zw4002_state) -> Node:
"""Mock a Enbrighten_55258/ZW4002 fan controller node."""
node = Node(client, copy.deepcopy(enbrighten_55258_zw4002_state))
client.driver.controller.nodes[node.node_id] = node
return node
@pytest.fixture(name="enbrighten_58446_zwa4013")
def enbrighten_58446_zwa4013_fixture(client, enbrighten_58446_zwa4013_state) -> Node:
"""Mock a Enbrighten_58446/zwa4013 fan controller node."""

View File

@@ -0,0 +1,856 @@
{
"nodeId": 57,
"index": 0,
"installerIcon": 1024,
"userIcon": 1024,
"status": 4,
"ready": true,
"isListening": true,
"isRouting": true,
"isSecure": false,
"manufacturerId": 99,
"productId": 13111,
"productType": 18756,
"firmwareVersion": "5.51",
"zwavePlusVersion": 1,
"name": "zwa4002_fan",
"location": "**REDACTED**",
"deviceConfig": {
"filename": "/usr/src/app/store/.config-db/devices/0x0063/55258_zw4002.json",
"isEmbedded": true,
"manufacturer": "Enbrighten",
"manufacturerId": 99,
"label": "55258 / ZW4002",
"description": "In-Wall Fan Speed Control, 500S",
"devices": [
{
"productType": 18756,
"productId": 13111
}
],
"firmwareVersion": {
"min": "0.0",
"max": "255.255"
},
"preferred": false,
"associations": {},
"paramInformation": {
"_map": {}
},
"compat": {
"mapBasicSet": "event"
},
"metadata": {
"inclusion": "Press and release the top or bottom rocker.",
"exclusion": "Press and release the top or bottom rocker.",
"reset": "1. Quickly press the top button three times, then immediately press the bottom button three times. 2. The LED will flash on/off five times when completed successfully.",
"manual": "https://products.z-wavealliance.org/wp-content/uploads/products/52589/55258%20QSG%20v1%20(5).pdf"
}
},
"label": "55258 / ZW4002",
"interviewAttempts": 1,
"isFrequentListening": false,
"maxDataRate": 100000,
"supportedDataRates": [40000, 100000],
"protocolVersion": 3,
"supportsBeaming": true,
"supportsSecurity": false,
"nodeType": 1,
"zwavePlusNodeType": 0,
"zwavePlusRoleType": 5,
"deviceClass": {
"basic": {
"key": 4,
"label": "Routing End Node"
},
"generic": {
"key": 17,
"label": "Multilevel Switch"
},
"specific": {
"key": 8,
"label": "Fan Switch"
}
},
"interviewStage": "Complete",
"deviceDatabaseUrl": "https://devices.zwave-js.io/?jumpTo=0x0063:0x4944:0x3337:5.51",
"statistics": {
"commandsTX": 149,
"commandsRX": 307,
"commandsDroppedRX": 0,
"commandsDroppedTX": 0,
"timeoutResponse": 0,
"lastSeen": "2026-03-18T17:20:05.965Z",
"rtt": 29.6,
"rssi": -55,
"lwr": {
"protocolDataRate": 3,
"repeaters": [],
"rssi": -55,
"repeaterRSSI": []
}
},
"highestSecurityClass": -1,
"isControllerNode": false,
"keepAwake": false,
"lastSeen": "2026-03-18T02:56:48.974Z",
"protocol": 0,
"sdkVersion": "6.84.0",
"values": [
{
"endpoint": 0,
"commandClass": 32,
"commandClassName": "Basic",
"property": "event",
"propertyName": "event",
"ccVersion": 2,
"metadata": {
"type": "number",
"readable": true,
"writeable": false,
"label": "Event value",
"min": 0,
"max": 255,
"stateful": false,
"secret": false
}
},
{
"endpoint": 0,
"commandClass": 38,
"commandClassName": "Multilevel Switch",
"property": "Up",
"propertyName": "Up",
"ccVersion": 4,
"metadata": {
"type": "boolean",
"readable": false,
"writeable": true,
"label": "Perform a level change (Up)",
"ccSpecific": {
"switchType": 2
},
"valueChangeOptions": ["transitionDuration"],
"states": {
"true": "Start",
"false": "Stop"
},
"stateful": true,
"secret": false
},
"value": false
},
{
"endpoint": 0,
"commandClass": 38,
"commandClassName": "Multilevel Switch",
"property": "Down",
"propertyName": "Down",
"ccVersion": 4,
"metadata": {
"type": "boolean",
"readable": false,
"writeable": true,
"label": "Perform a level change (Down)",
"ccSpecific": {
"switchType": 2
},
"valueChangeOptions": ["transitionDuration"],
"states": {
"true": "Start",
"false": "Stop"
},
"stateful": true,
"secret": false
},
"value": false
},
{
"endpoint": 0,
"commandClass": 38,
"commandClassName": "Multilevel Switch",
"property": "currentValue",
"propertyName": "currentValue",
"ccVersion": 4,
"metadata": {
"type": "number",
"readable": true,
"writeable": false,
"label": "Current value",
"min": 0,
"max": 99,
"stateful": true,
"secret": false
},
"value": 0
},
{
"endpoint": 0,
"commandClass": 38,
"commandClassName": "Multilevel Switch",
"property": "duration",
"propertyName": "duration",
"ccVersion": 4,
"metadata": {
"type": "duration",
"readable": true,
"writeable": false,
"label": "Remaining duration",
"stateful": true,
"secret": false
},
"value": {
"value": 0,
"unit": "seconds"
}
},
{
"endpoint": 0,
"commandClass": 38,
"commandClassName": "Multilevel Switch",
"property": "targetValue",
"propertyName": "targetValue",
"ccVersion": 4,
"metadata": {
"type": "number",
"readable": true,
"writeable": true,
"label": "Target value",
"valueChangeOptions": ["transitionDuration"],
"min": 0,
"max": 99,
"stateful": true,
"secret": false
},
"value": 0
},
{
"endpoint": 0,
"commandClass": 38,
"commandClassName": "Multilevel Switch",
"property": "restorePrevious",
"propertyName": "restorePrevious",
"ccVersion": 4,
"metadata": {
"type": "boolean",
"readable": false,
"writeable": true,
"label": "Restore previous value",
"states": {
"true": "Restore"
},
"stateful": true,
"secret": false
}
},
{
"endpoint": 0,
"commandClass": 91,
"commandClassName": "Central Scene",
"property": "scene",
"propertyKey": "001",
"propertyName": "scene",
"propertyKeyName": "001",
"ccVersion": 3,
"metadata": {
"type": "number",
"readable": true,
"writeable": false,
"label": "Scene 001",
"min": 0,
"max": 255,
"states": {
"0": "KeyPressed",
"1": "KeyReleased",
"2": "KeyHeldDown",
"3": "KeyPressed2x",
"4": "KeyPressed3x"
},
"stateful": false,
"secret": false
}
},
{
"endpoint": 0,
"commandClass": 91,
"commandClassName": "Central Scene",
"property": "scene",
"propertyKey": "002",
"propertyName": "scene",
"propertyKeyName": "002",
"ccVersion": 3,
"metadata": {
"type": "number",
"readable": true,
"writeable": false,
"label": "Scene 002",
"min": 0,
"max": 255,
"states": {
"0": "KeyPressed",
"1": "KeyReleased",
"2": "KeyHeldDown",
"3": "KeyPressed2x",
"4": "KeyPressed3x"
},
"stateful": false,
"secret": false
}
},
{
"endpoint": 0,
"commandClass": 91,
"commandClassName": "Central Scene",
"property": "slowRefresh",
"propertyName": "slowRefresh",
"ccVersion": 3,
"metadata": {
"type": "boolean",
"readable": true,
"writeable": true,
"description": "When this is true, KeyHeldDown notifications are sent every 55s. When this is false, the notifications are sent every 200ms.",
"label": "Send held down notifications at a slow rate",
"stateful": true,
"secret": false
}
},
{
"endpoint": 0,
"commandClass": 112,
"commandClassName": "Configuration",
"property": 3,
"propertyName": "LED Indicator",
"ccVersion": 4,
"metadata": {
"type": "number",
"readable": true,
"writeable": true,
"label": "LED Indicator",
"default": 1,
"min": 0,
"max": 2,
"states": {
"0": "On when load is on",
"1": "On when load is off",
"2": "Always off"
},
"valueSize": 1,
"format": 0,
"allowManualEntry": false,
"isFromConfig": true
},
"value": 0
},
{
"endpoint": 0,
"commandClass": 112,
"commandClassName": "Configuration",
"property": 4,
"propertyName": "Inverted Orientation",
"ccVersion": 4,
"metadata": {
"type": "number",
"readable": true,
"writeable": true,
"label": "Inverted Orientation",
"default": 0,
"min": 0,
"max": 1,
"states": {
"0": "Disable",
"1": "Enable"
},
"valueSize": 1,
"format": 1,
"allowManualEntry": false,
"isFromConfig": true
},
"value": 0
},
{
"endpoint": 0,
"commandClass": 112,
"commandClassName": "Configuration",
"property": 19,
"propertyName": "Alternate Exclusion",
"ccVersion": 4,
"metadata": {
"type": "number",
"readable": true,
"writeable": true,
"description": "Press MENU button once",
"label": "Alternate Exclusion",
"default": 0,
"min": 0,
"max": 1,
"states": {
"0": "Disable",
"1": "Enable"
},
"valueSize": 1,
"format": 1,
"allowManualEntry": false,
"isFromConfig": true
},
"value": 0
},
{
"endpoint": 0,
"commandClass": 112,
"commandClassName": "Configuration",
"property": 40,
"propertyName": "Fan Speed Control",
"ccVersion": 4,
"metadata": {
"type": "number",
"readable": true,
"writeable": true,
"label": "Fan Speed Control",
"default": 0,
"min": 0,
"max": 1,
"states": {
"0": "Press and hold",
"1": "Single button presses"
},
"valueSize": 1,
"format": 0,
"allowManualEntry": false,
"isFromConfig": true
},
"value": 0
},
{
"endpoint": 0,
"commandClass": 112,
"commandClassName": "Configuration",
"property": 84,
"propertyName": "Reset to Factory Default",
"ccVersion": 4,
"metadata": {
"type": "number",
"readable": true,
"writeable": true,
"label": "Reset to Factory Default",
"default": 0,
"min": 0,
"max": 1,
"states": {
"0": "Disable",
"1": "Enable"
},
"valueSize": 1,
"format": 1,
"allowManualEntry": false,
"isFromConfig": true
},
"value": 0
},
{
"endpoint": 0,
"commandClass": 114,
"commandClassName": "Manufacturer Specific",
"property": "productId",
"propertyName": "productId",
"ccVersion": 2,
"metadata": {
"type": "number",
"readable": true,
"writeable": false,
"label": "Product ID",
"min": 0,
"max": 65535,
"stateful": true,
"secret": false
},
"value": 13111
},
{
"endpoint": 0,
"commandClass": 114,
"commandClassName": "Manufacturer Specific",
"property": "productType",
"propertyName": "productType",
"ccVersion": 2,
"metadata": {
"type": "number",
"readable": true,
"writeable": false,
"label": "Product type",
"min": 0,
"max": 65535,
"stateful": true,
"secret": false
},
"value": 18756
},
{
"endpoint": 0,
"commandClass": 114,
"commandClassName": "Manufacturer Specific",
"property": "manufacturerId",
"propertyName": "manufacturerId",
"ccVersion": 2,
"metadata": {
"type": "number",
"readable": true,
"writeable": false,
"label": "Manufacturer ID",
"min": 0,
"max": 65535,
"stateful": true,
"secret": false
},
"value": 99
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "hardwareVersion",
"propertyName": "hardwareVersion",
"ccVersion": 3,
"metadata": {
"type": "number",
"readable": true,
"writeable": false,
"label": "Z-Wave chip hardware version",
"stateful": true,
"secret": false
},
"value": 255
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "firmwareVersions",
"propertyName": "firmwareVersions",
"ccVersion": 3,
"metadata": {
"type": "string[]",
"readable": true,
"writeable": false,
"label": "Z-Wave chip firmware versions",
"stateful": true,
"secret": false
},
"value": ["5.51"]
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "protocolVersion",
"propertyName": "protocolVersion",
"ccVersion": 3,
"metadata": {
"type": "string",
"readable": true,
"writeable": false,
"label": "Z-Wave protocol version",
"stateful": true,
"secret": false
},
"value": "6.10"
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "libraryType",
"propertyName": "libraryType",
"ccVersion": 3,
"metadata": {
"type": "number",
"readable": true,
"writeable": false,
"label": "Library type",
"states": {
"0": "Unknown",
"1": "Static Controller",
"2": "Controller",
"3": "Enhanced Slave",
"4": "Slave",
"5": "Installer",
"6": "Routing Slave",
"7": "Bridge Controller",
"8": "Device under Test",
"9": "N/A",
"10": "AV Remote",
"11": "AV Device"
},
"stateful": true,
"secret": false
},
"value": 3
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "applicationBuildNumber",
"propertyName": "applicationBuildNumber",
"ccVersion": 3,
"metadata": {
"type": "string",
"readable": true,
"writeable": false,
"label": "Application build number",
"stateful": true,
"secret": false
},
"value": 52445
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "applicationVersion",
"propertyName": "applicationVersion",
"ccVersion": 3,
"metadata": {
"type": "string",
"readable": true,
"writeable": false,
"label": "Application version",
"stateful": true,
"secret": false
},
"value": "4.5.0"
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "zWaveProtocolBuildNumber",
"propertyName": "zWaveProtocolBuildNumber",
"ccVersion": 3,
"metadata": {
"type": "string",
"readable": true,
"writeable": false,
"label": "Z-Wave protocol build number",
"stateful": true,
"secret": false
},
"value": 109
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "zWaveProtocolVersion",
"propertyName": "zWaveProtocolVersion",
"ccVersion": 3,
"metadata": {
"type": "string",
"readable": true,
"writeable": false,
"label": "Z-Wave protocol version",
"stateful": true,
"secret": false
},
"value": "6.10.0"
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "hostInterfaceBuildNumber",
"propertyName": "hostInterfaceBuildNumber",
"ccVersion": 3,
"metadata": {
"type": "string",
"readable": true,
"writeable": false,
"label": "Serial API build number",
"stateful": true,
"secret": false
},
"value": 0
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "hostInterfaceVersion",
"propertyName": "hostInterfaceVersion",
"ccVersion": 3,
"metadata": {
"type": "string",
"readable": true,
"writeable": false,
"label": "Serial API version",
"stateful": true,
"secret": false
},
"value": "unused"
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "applicationFrameworkBuildNumber",
"propertyName": "applicationFrameworkBuildNumber",
"ccVersion": 3,
"metadata": {
"type": "string",
"readable": true,
"writeable": false,
"label": "Z-Wave application framework API build number",
"stateful": true,
"secret": false
},
"value": 52445
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "applicationFrameworkAPIVersion",
"propertyName": "applicationFrameworkAPIVersion",
"ccVersion": 3,
"metadata": {
"type": "string",
"readable": true,
"writeable": false,
"label": "Z-Wave application framework API version",
"stateful": true,
"secret": false
},
"value": "4.5.0"
},
{
"endpoint": 0,
"commandClass": 134,
"commandClassName": "Version",
"property": "sdkVersion",
"propertyName": "sdkVersion",
"ccVersion": 3,
"metadata": {
"type": "string",
"readable": true,
"writeable": false,
"label": "SDK version",
"stateful": true,
"secret": false
},
"value": "6.84.0"
}
],
"endpoints": [
{
"nodeId": 57,
"index": 0,
"installerIcon": 1024,
"userIcon": 1024,
"deviceClass": {
"basic": {
"key": 4,
"label": "Routing End Node"
},
"generic": {
"key": 17,
"label": "Multilevel Switch"
},
"specific": {
"key": 8,
"label": "Fan Switch"
}
},
"commandClasses": [
{
"id": 94,
"name": "Z-Wave Plus Info",
"version": 2,
"isSecure": false
},
{
"id": 38,
"name": "Multilevel Switch",
"version": 4,
"isSecure": false
},
{
"id": 133,
"name": "Association",
"version": 2,
"isSecure": false
},
{
"id": 89,
"name": "Association Group Information",
"version": 1,
"isSecure": false
},
{
"id": 134,
"name": "Version",
"version": 3,
"isSecure": false
},
{
"id": 114,
"name": "Manufacturer Specific",
"version": 2,
"isSecure": false
},
{
"id": 85,
"name": "Transport Service",
"version": 2,
"isSecure": false
},
{
"id": 90,
"name": "Device Reset Locally",
"version": 1,
"isSecure": false
},
{
"id": 115,
"name": "Powerlevel",
"version": 1,
"isSecure": false
},
{
"id": 91,
"name": "Central Scene",
"version": 3,
"isSecure": false
},
{
"id": 159,
"name": "Security 2",
"version": 1,
"isSecure": true
},
{
"id": 108,
"name": "Supervision",
"version": 1,
"isSecure": false
},
{
"id": 112,
"name": "Configuration",
"version": 4,
"isSecure": false
},
{
"id": 34,
"name": "Application Status",
"version": 1,
"isSecure": false
},
{
"id": 122,
"name": "Firmware Update Meta Data",
"version": 4,
"isSecure": false
}
]
}
]
}

View File

@@ -719,6 +719,76 @@ async def test_leviton_zw4sf_fan(
assert state.attributes[ATTR_PRESET_MODES] == []
async def test_enbrighten_55258_zw4002_fan(
hass: HomeAssistant, client, enbrighten_55258_zw4002, integration
) -> None:
"""Test a GE/Jasco Enbrighten 55258/ZW4002 fan with 3 fixed speeds."""
node = enbrighten_55258_zw4002
node_id = 57
entity_id = "fan.zwa4002_fan"
async def get_zwave_speed_from_percentage(percentage):
"""Set the fan to a particular percentage and get the resulting Zwave speed."""
client.async_send_command.reset_mock()
await hass.services.async_call(
"fan",
"turn_on",
{"entity_id": entity_id, "percentage": percentage},
blocking=True,
)
assert len(client.async_send_command.call_args_list) == 1
args = client.async_send_command.call_args[0][0]
assert args["command"] == "node.set_value"
assert args["nodeId"] == node_id
return args["value"]
async def get_percentage_from_zwave_speed(zwave_speed):
"""Set the underlying device speed and get the resulting percentage."""
event = Event(
type="value updated",
data={
"source": "node",
"event": "value updated",
"nodeId": node_id,
"args": {
"commandClassName": "Multilevel Switch",
"commandClass": 38,
"endpoint": 0,
"property": "currentValue",
"newValue": zwave_speed,
"prevValue": 0,
"propertyName": "currentValue",
},
},
)
node.receive_event(event)
state = hass.states.get(entity_id)
return state.attributes[ATTR_PERCENTAGE]
# This device has the following speeds in Z-Wave JS:
# 1 = 1-33, 2 = 34-66, 3 = 67-99
percentages_to_zwave_speeds = [
[[0], [0]],
[range(1, 34), range(1, 34)],
[range(34, 67), range(34, 67)],
[range(67, 101), range(67, 100)],
]
for percentages, zwave_speeds in percentages_to_zwave_speeds:
for percentage in percentages:
actual_zwave_speed = await get_zwave_speed_from_percentage(percentage)
assert actual_zwave_speed in zwave_speeds
for zwave_speed in zwave_speeds:
actual_percentage = await get_percentage_from_zwave_speed(zwave_speed)
assert actual_percentage in percentages
state = hass.states.get(entity_id)
assert state.attributes[ATTR_PERCENTAGE_STEP] == pytest.approx(33.3333, rel=1e-3)
assert state.attributes[ATTR_PRESET_MODES] == []
async def test_enbrighten_58446_zwa4013_fan(
hass: HomeAssistant, client, enbrighten_58446_zwa4013, integration
) -> None: