Skip to content

Commit 1274644

Browse files
authored
Clean diagnostics cluster id use (#1704)
* Clean diagnostics cluster id use * Run flake8 and isort * Add black and flake8 to requirements file
1 parent 4fcf1c1 commit 1274644

File tree

24 files changed

+78
-89
lines changed

24 files changed

+78
-89
lines changed

requirements_test_all.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
asynctest
22
isort
3+
black
4+
flake8
35
codecov
46
colorlog
57
codespell

zhaquirks/bitron/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
"""Bitron/SMaBiT module."""
22

33
BITRON = "Bitron Home"
4-
DIAGNOSTICS_CLUSTER_ID = 0x0B05 # decimal = 2821

zhaquirks/bitron/thermostat.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
PowerConfiguration,
1313
Time,
1414
)
15+
from zigpy.zcl.clusters.homeautomation import Diagnostic
1516
from zigpy.zcl.clusters.hvac import Thermostat, UserInterface
1617

1718
from zhaquirks import PowerConfigurationCluster
18-
from zhaquirks.bitron import BITRON, DIAGNOSTICS_CLUSTER_ID
19+
from zhaquirks.bitron import BITRON
1920
from zhaquirks.const import (
2021
DEVICE_TYPE,
2122
ENDPOINTS,
@@ -64,7 +65,7 @@ class Av201032(CustomDevice):
6465
PollControl.cluster_id,
6566
Thermostat.cluster_id,
6667
UserInterface.cluster_id,
67-
DIAGNOSTICS_CLUSTER_ID,
68+
Diagnostic.cluster_id,
6869
],
6970
OUTPUT_CLUSTERS: [Identify.cluster_id, Ota.cluster_id],
7071
}
@@ -84,7 +85,7 @@ class Av201032(CustomDevice):
8485
PollControl.cluster_id,
8586
Thermostat.cluster_id,
8687
UserInterface.cluster_id,
87-
DIAGNOSTICS_CLUSTER_ID,
88+
Diagnostic.cluster_id,
8889
],
8990
OUTPUT_CLUSTERS: [Identify.cluster_id, Ota.cluster_id],
9091
}

zhaquirks/centralite/cl_3130.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
Ota,
1010
PollControl,
1111
)
12+
from zigpy.zcl.clusters.homeautomation import Diagnostic
1213
from zigpy.zcl.clusters.measurement import TemperatureMeasurement
1314

1415
from zhaquirks import PowerConfigurationCluster
@@ -33,8 +34,6 @@
3334
)
3435
from zhaquirks.osram import OSRAM
3536

36-
DIAGNOSTICS_CLUSTER_ID = 0x0B05 # decimal = 2821
37-
3837

3938
class CustomPowerConfigurationCluster(PowerConfigurationCluster):
4039
"""Custom PowerConfigurationCluster."""
@@ -63,7 +62,7 @@ class CentraLite3130(CustomDevice):
6362
Identify.cluster_id,
6463
PollControl.cluster_id,
6564
TemperatureMeasurement.cluster_id,
66-
DIAGNOSTICS_CLUSTER_ID,
65+
Diagnostic.cluster_id,
6766
],
6867
OUTPUT_CLUSTERS: [
6968
Identify.cluster_id,
@@ -82,7 +81,7 @@ class CentraLite3130(CustomDevice):
8281
CustomPowerConfigurationCluster,
8382
Identify.cluster_id,
8483
PollControl.cluster_id,
85-
DIAGNOSTICS_CLUSTER_ID,
84+
Diagnostic.cluster_id,
8685
],
8786
OUTPUT_CLUSTERS: [
8887
Identify.cluster_id,

zhaquirks/centralite/cl_3157100.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from zigpy.profiles import zha
33
from zigpy.quirks import CustomDevice
44
from zigpy.zcl.clusters.general import Basic, Identify, Ota, PollControl, Time
5+
from zigpy.zcl.clusters.homeautomation import Diagnostic
56
from zigpy.zcl.clusters.hvac import Fan, Thermostat, UserInterface
67

78
from zhaquirks import PowerConfigurationCluster
@@ -15,8 +16,6 @@
1516
PROFILE_ID,
1617
)
1718

18-
DIAGNOSTICS_CLUSTER_ID = 0x0B05 # decimal = 2821
19-
2019

2120
class CentraLite3157100(CustomDevice):
2221
"""Custom device representing centralite 3157100."""
@@ -39,7 +38,7 @@ class CentraLite3157100(CustomDevice):
3938
Fan.cluster_id,
4039
UserInterface.cluster_id,
4140
PollControl.cluster_id,
42-
DIAGNOSTICS_CLUSTER_ID,
41+
Diagnostic.cluster_id,
4342
],
4443
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
4544
}
@@ -59,7 +58,7 @@ class CentraLite3157100(CustomDevice):
5958
Fan.cluster_id,
6059
UserInterface.cluster_id,
6160
PollControl.cluster_id,
62-
DIAGNOSTICS_CLUSTER_ID,
61+
Diagnostic.cluster_id,
6362
],
6463
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
6564
}

zhaquirks/centralite/cl_3300S.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from zigpy.profiles import zha
33
from zigpy.quirks import CustomDevice
44
from zigpy.zcl.clusters.general import Basic, BinaryInput, Identify, Ota, PollControl
5+
from zigpy.zcl.clusters.homeautomation import Diagnostic
56
from zigpy.zcl.clusters.measurement import TemperatureMeasurement
67
from zigpy.zcl.clusters.security import IasZone
78

@@ -16,7 +17,6 @@
1617
PROFILE_ID,
1718
)
1819

19-
DIAGNOSTICS_CLUSTER_ID = 0x0B05 # decimal = 2821
2020
MANUFACTURER_SPECIFIC_PROFILE_ID = 0xC2DF # decimal = 49887
2121

2222

@@ -44,7 +44,7 @@ class CentraLite3300S(CustomDevice):
4444
PollControl.cluster_id,
4545
TemperatureMeasurement.cluster_id,
4646
IasZone.cluster_id,
47-
DIAGNOSTICS_CLUSTER_ID,
47+
Diagnostic.cluster_id,
4848
],
4949
OUTPUT_CLUSTERS: [Ota.cluster_id],
5050
},
@@ -60,7 +60,7 @@ class CentraLite3300S(CustomDevice):
6060
PowerConfigurationCluster.cluster_id,
6161
Identify.cluster_id,
6262
BinaryInput.cluster_id,
63-
DIAGNOSTICS_CLUSTER_ID,
63+
Diagnostic.cluster_id,
6464
],
6565
OUTPUT_CLUSTERS: [Identify.cluster_id],
6666
},
@@ -77,15 +77,15 @@ class CentraLite3300S(CustomDevice):
7777
PollControl.cluster_id,
7878
TemperatureMeasurement.cluster_id,
7979
IasZone.cluster_id,
80-
DIAGNOSTICS_CLUSTER_ID,
80+
Diagnostic.cluster_id,
8181
],
8282
OUTPUT_CLUSTERS: [Ota.cluster_id],
8383
},
8484
2: {
8585
INPUT_CLUSTERS: [
8686
Basic.cluster_id,
8787
Identify.cluster_id,
88-
DIAGNOSTICS_CLUSTER_ID,
88+
Diagnostic.cluster_id,
8989
],
9090
OUTPUT_CLUSTERS: [Identify.cluster_id],
9191
},

zhaquirks/centralite/cl_3305S.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from zigpy.profiles import zha
33
from zigpy.quirks import CustomDevice
44
from zigpy.zcl.clusters.general import Basic, Identify, Ota, PollControl
5+
from zigpy.zcl.clusters.homeautomation import Diagnostic
56
from zigpy.zcl.clusters.measurement import OccupancySensing, TemperatureMeasurement
67
from zigpy.zcl.clusters.security import IasZone
78

@@ -16,8 +17,6 @@
1617
PROFILE_ID,
1718
)
1819

19-
DIAGNOSTICS_CLUSTER_ID = 0x0B05 # decimal = 2821
20-
2120

2221
class CentraLite3305S(CustomDevice):
2322
"""Custom device representing centralite 3305."""
@@ -48,7 +47,7 @@ class CentraLite3305S(CustomDevice):
4847
PollControl.cluster_id,
4948
TemperatureMeasurement.cluster_id,
5049
IasZone.cluster_id,
51-
DIAGNOSTICS_CLUSTER_ID,
50+
Diagnostic.cluster_id,
5251
],
5352
OUTPUT_CLUSTERS: [Ota.cluster_id],
5453
},
@@ -64,7 +63,7 @@ class CentraLite3305S(CustomDevice):
6463
PowerConfigurationCluster.cluster_id,
6564
Identify.cluster_id,
6665
OccupancySensing.cluster_id,
67-
DIAGNOSTICS_CLUSTER_ID,
66+
Diagnostic.cluster_id,
6867
],
6968
OUTPUT_CLUSTERS: [Identify.cluster_id],
7069
},
@@ -81,7 +80,7 @@ class CentraLite3305S(CustomDevice):
8180
PollControl.cluster_id,
8281
TemperatureMeasurement.cluster_id,
8382
IasZone.cluster_id,
84-
DIAGNOSTICS_CLUSTER_ID,
83+
Diagnostic.cluster_id,
8584
],
8685
OUTPUT_CLUSTERS: [Ota.cluster_id],
8786
},
@@ -90,7 +89,7 @@ class CentraLite3305S(CustomDevice):
9089
Basic.cluster_id,
9190
Identify.cluster_id,
9291
OccupancySensing.cluster_id,
93-
DIAGNOSTICS_CLUSTER_ID,
92+
Diagnostic.cluster_id,
9493
],
9594
OUTPUT_CLUSTERS: [Identify.cluster_id],
9695
},

zhaquirks/centralite/cl_3310S.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from zigpy.quirks import CustomCluster, CustomDevice
44
import zigpy.types as t
55
from zigpy.zcl.clusters.general import Basic, Identify, Ota, PollControl
6+
from zigpy.zcl.clusters.homeautomation import Diagnostic
67
from zigpy.zcl.clusters.measurement import TemperatureMeasurement
78

89
from zhaquirks import PowerConfigurationCluster
@@ -16,7 +17,6 @@
1617
PROFILE_ID,
1718
)
1819

19-
DIAGNOSTICS_CLUSTER_ID = 0x0B05 # decimal = 2821
2020
SMRT_THINGS_REL_HUM_CLSTR = 0xFC45
2121

2222

@@ -55,7 +55,7 @@ class CentraLite3310S(CustomDevice):
5555
Identify.cluster_id,
5656
PollControl.cluster_id,
5757
TemperatureMeasurement.cluster_id,
58-
DIAGNOSTICS_CLUSTER_ID,
58+
Diagnostic.cluster_id,
5959
SmartthingsRelativeHumidityCluster.cluster_id,
6060
],
6161
OUTPUT_CLUSTERS: [Identify.cluster_id, Ota.cluster_id],
@@ -72,7 +72,7 @@ class CentraLite3310S(CustomDevice):
7272
Identify.cluster_id,
7373
PollControl.cluster_id,
7474
TemperatureMeasurement.cluster_id,
75-
DIAGNOSTICS_CLUSTER_ID,
75+
Diagnostic.cluster_id,
7676
SmartthingsRelativeHumidityCluster,
7777
],
7878
OUTPUT_CLUSTERS: [Identify.cluster_id, Ota.cluster_id],

zhaquirks/centralite/cl_3321S.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from zigpy.profiles import zha
44
from zigpy.quirks import CustomDevice
55
from zigpy.zcl.clusters.general import Basic, Identify, Ota, PollControl
6+
from zigpy.zcl.clusters.homeautomation import Diagnostic
67
from zigpy.zcl.clusters.measurement import TemperatureMeasurement
78
from zigpy.zcl.clusters.security import IasZone
89

@@ -18,7 +19,6 @@
1819
)
1920
from zhaquirks.samjin import SAMJIN
2021

21-
DIAGNOSTICS_CLUSTER_ID = 0x0B05 # decimal = 2821
2222
MANUFACTURER_SPECIFIC_CLUSTER_ID = 0xFC0F # decimal = 64527
2323
MANUFACTURER_SPECIFIC_PROFILE_ID = 0xC2DF # decimal = 49887
2424

@@ -48,7 +48,7 @@ class CentraLite3321S(CustomDevice):
4848
PollControl.cluster_id,
4949
TemperatureMeasurement.cluster_id,
5050
IasZone.cluster_id,
51-
DIAGNOSTICS_CLUSTER_ID,
51+
Diagnostic.cluster_id,
5252
CentraLiteAccelCluster.cluster_id,
5353
],
5454
OUTPUT_CLUSTERS: [Ota.cluster_id],
@@ -64,7 +64,7 @@ class CentraLite3321S(CustomDevice):
6464
Basic.cluster_id,
6565
PowerConfigurationCluster.cluster_id,
6666
Identify.cluster_id,
67-
DIAGNOSTICS_CLUSTER_ID,
67+
Diagnostic.cluster_id,
6868
MANUFACTURER_SPECIFIC_CLUSTER_ID,
6969
],
7070
OUTPUT_CLUSTERS: [Identify.cluster_id],
@@ -82,7 +82,7 @@ class CentraLite3321S(CustomDevice):
8282
PollControl.cluster_id,
8383
TemperatureMeasurement.cluster_id,
8484
IasZone.cluster_id,
85-
DIAGNOSTICS_CLUSTER_ID,
85+
Diagnostic.cluster_id,
8686
CentraLiteAccelCluster,
8787
],
8888
OUTPUT_CLUSTERS: [Ota.cluster_id],
@@ -91,7 +91,7 @@ class CentraLite3321S(CustomDevice):
9191
INPUT_CLUSTERS: [
9292
Basic.cluster_id,
9393
Identify.cluster_id,
94-
DIAGNOSTICS_CLUSTER_ID,
94+
Diagnostic.cluster_id,
9595
MANUFACTURER_SPECIFIC_CLUSTER_ID,
9696
],
9797
OUTPUT_CLUSTERS: [Identify.cluster_id],

zhaquirks/centralite/cl_3460L.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Ota,
1111
PollControl,
1212
)
13+
from zigpy.zcl.clusters.homeautomation import Diagnostic
1314
from zigpy.zcl.clusters.measurement import TemperatureMeasurement
1415

1516
from zhaquirks import PowerConfigurationCluster
@@ -29,8 +30,6 @@
2930
SHORT_RELEASE,
3031
)
3132

32-
DIAGNOSTICS_CLUSTER_ID = 0x0B05 # decimal = 2821
33-
3433

3534
class CustomPowerConfigurationCluster(PowerConfigurationCluster):
3635
"""Custom PowerConfigurationCluster."""
@@ -60,7 +59,7 @@ class CentraLite3460L(CustomDevice):
6059
OnOffConfiguration.cluster_id,
6160
PollControl.cluster_id,
6261
TemperatureMeasurement.cluster_id,
63-
DIAGNOSTICS_CLUSTER_ID,
62+
Diagnostic.cluster_id,
6463
],
6564
OUTPUT_CLUSTERS: [
6665
Identify.cluster_id,
@@ -81,7 +80,7 @@ class CentraLite3460L(CustomDevice):
8180
OnOffConfiguration.cluster_id,
8281
PollControl.cluster_id,
8382
TemperatureMeasurement.cluster_id,
84-
DIAGNOSTICS_CLUSTER_ID,
83+
Diagnostic.cluster_id,
8584
],
8685
OUTPUT_CLUSTERS: [
8786
Identify.cluster_id,

0 commit comments

Comments
 (0)