Skip to content

Commit 2fb27bf

Browse files
authored
Merge pull request #181 from natekspencer/dev
Adjust loading of zwave device db
2 parents b88512e + 50deca6 commit 2fb27bf

File tree

2 files changed

+55
-17
lines changed

2 files changed

+55
-17
lines changed

vivintpy/zjs_device_config_db.json

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
},
4747
"0x0000:0x0004:0x0004": {
4848
"description": "USB Controller",
49-
"label": "700 Series",
49+
"label": "700/800 Series",
5050
"manufacturer": "Silicon Labs"
5151
},
5252
"0x0001:0x4243:0x0000": {
@@ -390,7 +390,7 @@
390390
"manufacturer": "HomeSeer Technologies"
391391
},
392392
"0x000c:0x0004:0x0001": {
393-
"description": "Z-Wave Multi Sensorr",
393+
"description": "Z-Wave Multi Sensor",
394394
"label": "HS-HSM200",
395395
"manufacturer": "HomeSeer Technologies"
396396
},
@@ -429,6 +429,11 @@
429429
"label": "HS-FC200+",
430430
"manufacturer": "HomeSeer Technologies"
431431
},
432+
"0x000c:0x0204:0x0002": {
433+
"description": "Z-Wave Presence Sensor",
434+
"label": "HS-PS100",
435+
"manufacturer": "HomeSeer Technologies"
436+
},
432437
"0x000c:0x4447:0x3031": {
433438
"description": "Appliance Module",
434439
"label": "HS-PA100+",
@@ -814,6 +819,16 @@
814819
"label": "ZW4SF",
815820
"manufacturer": "Leviton"
816821
},
822+
"0x001d:0x0041:0x0002": {
823+
"description": "Decora Smart 800 Series Dimmer",
824+
"label": "ZW6HD",
825+
"manufacturer": "Leviton"
826+
},
827+
"0x001d:0x0042:0x0002": {
828+
"description": "Decora Smart 800 Series Switch",
829+
"label": "ZW15S",
830+
"manufacturer": "Leviton"
831+
},
817832
"0x001d:0x0101:0x0328": {
818833
"description": "Scene Capable Plug-In Appliance Module, 300W",
819834
"label": "VRP15",
@@ -2429,6 +2444,16 @@
24292444
"label": "59338 / ZWA4012DV",
24302445
"manufacturer": "Enbrighten"
24312446
},
2447+
"0x0063:0x4952:0x3333": {
2448+
"description": "In-Wall Paddle Switch, QFSW, 700S",
2449+
"label": "58433 / 59344 / ZWA4011",
2450+
"manufacturer": "Enbrighten"
2451+
},
2452+
"0x0063:0x4952:0x3334": {
2453+
"description": "In-Wall Toggle Switch, QFSW, 700S",
2454+
"label": "59368 / ZWA4012",
2455+
"manufacturer": "UltraPro"
2456+
},
24322457
"0x0063:0x4952:0x3339": {
24332458
"description": "In-Wall Outlet, TR, 700S",
24342459
"label": "58449 / ZWA1003",
@@ -5109,6 +5134,11 @@
51095134
"label": "YRD210",
51105135
"manufacturer": "Yale"
51115136
},
5137+
"0x0109:0x0004:0xffff": {
5138+
"description": "Push Button Deadbolt",
5139+
"label": "YRD210",
5140+
"manufacturer": "Yale"
5141+
},
51125142
"0x0109:0x1001:0x0101": {
51135143
"description": "USB Dongle",
51145144
"label": "ZU1401",
@@ -5899,6 +5929,11 @@
58995929
"label": "FGR223",
59005930
"manufacturer": "Fibargroup"
59015931
},
5932+
"0x010f:0x0304:0x1000": {
5933+
"description": "Roller Shutter 4",
5934+
"label": "FGR-224",
5935+
"manufacturer": "Fibargroup"
5936+
},
59025937
"0x010f:0x0400:0x0102": {
59035938
"description": "Relay Switch 1x3kW",
59045939
"label": "FGS211",
@@ -12525,6 +12560,11 @@
1252512560
"label": "ZEN34",
1252612561
"manufacturer": "Zooz"
1252712562
},
12563+
"0x027a:0x7000:0xf003": {
12564+
"description": "Wall Remote",
12565+
"label": "ZEN37 800LR",
12566+
"manufacturer": "Zooz"
12567+
},
1252812568
"0x027a:0xa000:0xa001": {
1252912569
"description": "Z-Wave Plus S2 ON/OFF Switch",
1253012570
"label": "ZEN26",
@@ -14396,6 +14436,11 @@
1439614436
"label": "ZWA012",
1439714437
"manufacturer": "Aeotec Ltd."
1439814438
},
14439+
"0x0371:0x0202:0x0018": {
14440+
"description": "MultiSensor 7",
14441+
"label": "ZWA024",
14442+
"manufacturer": "Aeotec Ltd."
14443+
},
1439914444
"0x0371:0x0202:0x0029": {
1440014445
"description": "Door/Window Sensor 7",
1440114446
"label": "ZWA011",
@@ -15351,5 +15396,5 @@
1535115396
"label": "BW8120",
1535215397
"manufacturer": "Remotec"
1535315398
},
15354-
"updated_at": "2024-04-06T22:22:20.961929"
15399+
"updated_at": "2024-07-08T02:36:24.368049"
1535515400
}

vivintpy/zjs_device_config_db.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,20 @@
44

55
import json
66
import os
7+
from typing import Final
78

8-
ZJS_DEVICE_CONFIG_DB_FILE = os.path.join(
9-
os.path.dirname(__file__), "zjs_device_config_db.json"
10-
)
11-
ZJS_DEVICE_DB: dict[str, str | dict[str, str]] = {}
9+
with open(
10+
os.path.join(os.path.dirname(__file__), "zjs_device_config_db.json"),
11+
encoding="utf8",
12+
) as file:
13+
ZJS_DEVICE_DB: Final[dict[str, str | dict[str, str]]] = json.load(file)
1214

1315

1416
def get_zwave_device_info(
1517
manufacturer_id: int | None, product_type: int | None, product_id: int | None
1618
) -> dict[str, str]:
1719
"""Lookup the Z-Wave device based on the manufacturer id, product type and product id."""
1820
key = f"0x{manufacturer_id:04x}:0x{product_type:04x}:0x{product_id:04x}"
19-
if isinstance((device_info := _get_zjs_db().get(key)), dict):
21+
if isinstance((device_info := ZJS_DEVICE_DB.get(key)), dict):
2022
return device_info
2123
return {}
22-
23-
24-
def _get_zjs_db() -> dict[str, str | dict[str, str]]:
25-
"""Load the Z-Wave JS device config from the saved JSON file."""
26-
global ZJS_DEVICE_DB # pylint: disable=global-statement
27-
if not ZJS_DEVICE_DB:
28-
with open(ZJS_DEVICE_CONFIG_DB_FILE, encoding="utf-8") as device_file:
29-
ZJS_DEVICE_DB = json.load(device_file)
30-
return ZJS_DEVICE_DB

0 commit comments

Comments
 (0)