File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 11
11
12
12
from homeassistant .core import HomeAssistant
13
13
14
- from .const import DEFAULT_POST_TIMEOUT , LOGGER , WINIX_DOMAIN
14
+ from .const import (
15
+ DEFAULT_FILTER_ALARM_DURATION ,
16
+ DEFAULT_POST_TIMEOUT ,
17
+ LOGGER ,
18
+ WINIX_DOMAIN ,
19
+ )
15
20
from .device_wrapper import MyWinixDeviceStub
16
21
17
22
@@ -128,8 +133,18 @@ async def get_filter_alarm_duration(
128
133
)
129
134
130
135
response_json = await resp .json ()
136
+
137
+ # Sample json
131
138
# {'resultCode': '200', 'resultMessage': 'SUCCESS', 'filterUsageAlarm': 9}
132
- return int (response_json ["filterUsageAlarm" ]) * 30 * 24
139
+ LOGGER .debug (f"getFilterAlarmInfo: { response_json } " )
140
+
141
+ # Fall back to 9 months if filter alram has been turned off in mobile app in which case we receive this:
142
+ # {'resultCode': '200', 'resultMessage': 'SUCCESS', 'filterUsageAlarm': 0}
143
+ value = int (response_json ["filterUsageAlarm" ])
144
+
145
+ if value == 0 :
146
+ value = DEFAULT_FILTER_ALARM_DURATION
147
+ return value * 30 * 24
133
148
134
149
@staticmethod
135
150
async def get_device_stubs (
You can’t perform that action at this time.
0 commit comments