Skip to content

Commit 9875799

Browse files
committed
Fix 255 bug
1 parent 3741378 commit 9875799

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

scripts/generate_multilevel_sensor_constants.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from collections import defaultdict
77
from collections.abc import Callable, Mapping
8+
import json
89
import pathlib
910

1011
from const import AUTO_GEN_POST, AUTO_GEN_PRE
@@ -28,15 +29,15 @@ def normalize_scale_definition(scale_definitions: dict[str, dict]) -> dict[str,
2829
scale_def_ = {}
2930
for scale_id, scale_props in scale_definitions.items():
3031
scale_name_ = enum_name_format(scale_props["label"], True)
31-
scale_def_[scale_name_] = int(scale_id)
32+
scale_def_[scale_name_] = scale_id
3233

3334
return dict(sorted(scale_def_.items(), key=lambda kv: kv[0]))
3435

3536

3637
scales = {}
3738
sensors = {}
3839

39-
for sensor_props in pathlib.Path("sensors.json").read_text():
40+
for sensor_props in json.loads(pathlib.Path("sensors.json").read_text()):
4041
sensor_id = sensor_props["key"]
4142
scale_def = sensor_props["scales"]
4243
remove_parenthesis_ = True

scripts/generate_notification_constants.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from __future__ import annotations
55

66
from collections.abc import Callable, Mapping
7+
import json
78
import pathlib
89

910
from const import AUTO_GEN_POST, AUTO_GEN_PRE
@@ -22,7 +23,7 @@
2223

2324
notifications = {}
2425
params = {}
25-
for notification_payload in pathlib.Path("notifications.json").read_text():
26+
for notification_payload in json.loads(pathlib.Path("notifications.json").read_text()):
2627
notification_type = notification_payload["type"]
2728
notification_name = notification_payload["name"].title()
2829
notifications[notification_name] = {
@@ -46,7 +47,7 @@
4647
and state_props["parameter"]["type"] == "enum"
4748
):
4849
for enum_id, enum_name in state_props["parameter"]["values"].items():
49-
enum_id = int(enum_id, 16)
50+
enum_id = int(enum_id)
5051
params.setdefault(notification_name, {}).setdefault(state_name, {})[
5152
enum_name.title()
5253
] = enum_id

zwave_js_server/const/command_class/notification.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class BarrierPerformingInitializationProcessNotificationEventValue(
136136

137137
# https://github.com/zwave-js/node-zwave-js/blob/master/packages/core/src/registries/Notifications.ts
138138
UNKNOWN = -1
139-
PERFORMING_PROCESS = 597
139+
PERFORMING_PROCESS = 255
140140
PROCESS_COMPLETED = 0
141141

142142
@classmethod
@@ -153,7 +153,7 @@ class BarrierSafetyBeamObstacleNotificationEventValue(NotificationEventValue):
153153
# https://github.com/zwave-js/node-zwave-js/blob/master/packages/core/src/registries/Notifications.ts
154154
UNKNOWN = -1
155155
NO_OBSTRUCTION = 0
156-
OBSTRUCTION = 597
156+
OBSTRUCTION = 255
157157

158158
@classmethod
159159
def _missing_(
@@ -169,7 +169,7 @@ class BarrierVacationModeNotificationEventValue(NotificationEventValue):
169169
# https://github.com/zwave-js/node-zwave-js/blob/master/packages/core/src/registries/Notifications.ts
170170
UNKNOWN = -1
171171
MODE_DISABLED = 0
172-
MODE_ENABLED = 597
172+
MODE_ENABLED = 255
173173

174174
@classmethod
175175
def _missing_(

0 commit comments

Comments
 (0)