File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ def is_connected(self) -> bool:
54
54
return self .libdyson .is_connected
55
55
56
56
def connect (self , host : str ):
57
- """Connect to the device and start the environmental monitoring timer."""
57
+ """Connect to the device and start the environmental monitoring
58
+ timer."""
58
59
self .libdyson .connect (host )
59
60
self ._refresh_timer ()
60
61
@@ -208,18 +209,23 @@ def main(argv):
208
209
logging .exception ('Could not load configuration: %s' , args .config )
209
210
sys .exit (- 1 )
210
211
211
- devices = cfg .devices
212
- if len (devices ) == 0 :
213
- logging .fatal (
214
- 'No devices configured; please re-run this program with --create_device_cache.' )
215
- sys .exit (- 2 )
216
-
217
212
if args .create_device_cache :
213
+ if not cfg .dyson_credentials :
214
+ logging .error ('DysonLink credentials not found in %s, cannot generate device cache' ,
215
+ args .config )
216
+ sys .exit (- 1 )
217
+
218
218
logging .info (
219
219
'--create_device_cache supplied; breaking out to perform this.' )
220
220
account .generate_device_cache (cfg .dyson_credentials , args .config )
221
221
sys .exit (0 )
222
222
223
+ devices = cfg .devices
224
+ if len (devices ) == 0 :
225
+ logging .fatal (
226
+ 'No devices configured; please re-run this program with --create_device_cache.' )
227
+ sys .exit (- 2 )
228
+
223
229
prometheus_client .start_http_server (args .port )
224
230
225
231
ConnectionManager (metrics .Metrics ().update , devices , cfg .hosts )
You can’t perform that action at this time.
0 commit comments