Allow multiple vcc api keys (#85)

* Multiple vccapikeys function

* Reduce api calls for key checks

* Change sleeptime

* Optimize logging

* Format log datetime

* Change default conf

* Set device offline, if no working vcc api key can be found

* Fix climate scheduler

* Only redact sensitive data if debug is enabled
This commit is contained in:
Linus Dietz
2023-08-17 10:43:03 +02:00
committed by GitHub
parent a05bf487bd
commit 075102c574
10 changed files with 154 additions and 25 deletions
+7 -4
View File
@@ -13,7 +13,8 @@ from pathlib import Path
TZ = None
SENSITIVE_PATTERNS = [
r"[A-Z0-9]{17}", # VIN
r"\d{1,2}\.\d{5,16}" # Location
r"\d{1,2}\.\d{5,16}", # Location
r"[a-z0-9]{32}" # VCCAPIKEY
]
@@ -48,13 +49,15 @@ def setup_logging():
'%(asctime)s volvo2mqtt [%(process)d] - %(levelname)s: %(message)s',
'%b %d %H:%M:%S')
file_log_handler.setFormatter(formatter)
sensitive_data_filter = SensitiveDataFilter(SENSITIVE_PATTERNS)
file_log_handler.addFilter(sensitive_data_filter)
logger = logging.getLogger()
if settings["debug"]:
sensitive_data_filter = SensitiveDataFilter(SENSITIVE_PATTERNS)
file_log_handler.addFilter(sensitive_data_filter)
console_log_handler = logging.StreamHandler(sys.stdout)
console_log_handler.setFormatter(formatter)
logger = logging.getLogger()
logger.addHandler(console_log_handler)
logger.addHandler(file_log_handler)
logging.getLogger("urllib3").setLevel(logging.WARNING)