-
Notifications
You must be signed in to change notification settings - Fork 427
/
Copy pathtest_climate.py
85 lines (79 loc) · 2.78 KB
/
test_climate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
from custom_components.sonoff.climate import XClimateTH
from . import init
def test_th():
_, entities = init(
{
"extra": {"uiid": 15},
"params": {
"bindInfos": {"alice": []},
"version": 8,
"sledOnline": "on",
"init": 1,
"switch": "off",
"fwVersion": "3.5.0",
"rssi": -50,
"startup": "off",
"pulse": "off",
"pulseWidth": 500,
"deviceType": "temperature",
"sensorType": "AM2301",
"currentHumidity": "45",
"currentTemperature": "18.8",
"mainSwitch": "on",
"targets": [
{"targetHigh": "20", "reaction": {"switch": "on"}},
{"targetLow": "10", "reaction": {"switch": "off"}},
],
"state": "off",
"timeZone": 3,
"only_device": {"ota": "success"},
},
}
)
climate = next(e for e in entities if isinstance(e, XClimateTH))
assert climate
def test_thr316d():
# https://github.com/AlexxIT/SonoffLAN/issues/1074
_, entities = init(
{
"extra": {"uiid": 181},
"params": {
"version": 8,
"fwVersion": "1.1.0",
"sensorType": "DS18B20",
"currentTemperature": "19.2",
"currentHumidity": "unavailable",
"switch": "off",
"startup": "off",
"pulseConfig": {"pulse": "off", "switch": "off", "pulseWidth": 500},
"sledOnline": "on",
"tempUnit": 0,
"rssi": -38,
"autoControl": [
{
"deviceType": "temperature",
"targets": [
{"high": "33.0", "reaction": {"switch": "on"}},
{"low": "25.0", "reaction": {"switch": "off"}},
],
"effTime": {
"spanType": "any",
"days": [0, 1, 2, 3, 4, 5, 6],
"from": "00:00",
"to": "01:00",
},
}
],
"autoControlEnabled": 1,
"uiActive": 60,
"timeZone": 2,
"only_device": {"ota": "success", "ota_fail_reason": 0},
"tempCorrection": 0,
"humCorrection": 0,
"tempHumiType": 1,
},
"model": "THR316D",
}
)
# climate = next(e for e in entities if isinstance(e, XClimateTH))
# assert climate