2
2
from configManager .argumentHandler import parse_arguments
3
3
from datetime import datetime
4
4
import os
5
+ import pathlib
5
6
import subprocess
6
7
import json
7
8
import logManager
@@ -33,6 +34,7 @@ def _write_yaml(path, contents):
33
34
class Config :
34
35
yaml_config = None
35
36
configDir = parse_arguments ()["CONFIG_PATH" ]
37
+ runningDir = str (pathlib .Path (__file__ )).replace ("/configManager/configHandler.py" ,"" )
36
38
37
39
def __init__ (self ):
38
40
if not os .path .exists (self .configDir ):
@@ -92,9 +94,9 @@ def load_config(self):
92
94
}
93
95
94
96
if int (config ["swversion" ]) < 1958077010 :
95
- config ["swversion" ] = "1962154010 "
97
+ config ["swversion" ] = "1965111030 "
96
98
if float (config ["apiversion" ][:3 ]) < 1.56 :
97
- config ["apiversion" ] = "1.62 .0"
99
+ config ["apiversion" ] = "1.65 .0"
98
100
99
101
self .yaml_config ["config" ] = config
100
102
else :
@@ -107,11 +109,11 @@ def load_config(self):
107
109
"alarm" :{"enabled" : False ,"lasttriggered" : 0 },
108
110
"port" :{"enabled" : False ,"ports" : [80 ]},
109
111
"apiUsers" :{},
110
- "apiversion" :"1.62 .0" ,
112
+ "apiversion" :"1.65 .0" ,
111
113
"name" :"DiyHue Bridge" ,
112
114
"netmask" :"255.255.255.0" ,
113
- "swversion" :"1962154010 " ,
114
- "timezone" :"Europe/London" ,
115
+ "swversion" :"1965111030 " ,
116
+ "timezone" :parse_arguments ()[ "TZ" ] ,
115
117
"linkbutton" :{"lastlinkbuttonpushed" : 1599398980 },
116
118
"users" :{
"[email protected] " :{
"password" :
"pbkdf2:sha256:150000$bqqXSOkI$199acdaf81c18f6ff2f29296872356f4eb78827784ce4b3f3b6262589c788742" }},
117
119
"hue" : {},
@@ -293,7 +295,7 @@ def download_config(self):
293
295
294
296
def download_log (self ):
295
297
subprocess .run ('tar -cvf ' + self .configDir + '/diyhue_log.tar ' +
296
- self .configDir . replace ( '/config' , '' ) + '/*.log* ' ,
298
+ self .runningDir + '/*.log* ' ,
297
299
shell = True , capture_output = True , text = True )
298
300
return self .configDir + "/diyhue_log.tar"
299
301
@@ -314,7 +316,7 @@ def download_debug(self):
314
316
_write_yaml (self .configDir + "/system_info.yaml" , info )
315
317
subprocess .run ('tar --exclude=' + "'config.yaml'" + ' -cvf ' + self .configDir + '/config_debug.tar ' +
316
318
self .configDir + '/*.yaml ' +
317
- self .configDir . replace ( '/config' , '' ) + '/*.log* ' ,
319
+ self .runningDir + '/*.log* ' ,
318
320
shell = True , capture_output = True , text = True )
319
321
os .popen ('rm -r ' + self .configDir + '/config_debug.yaml' )
320
322
return self .configDir + "/config_debug.tar"
0 commit comments