Open Ultra-bob opened 3 hours ago
I re-typed everything and then stupidly forgot to copy it before clicking enter
guess what
there was an error and the whole thing is gone again :skull:
Due to recent events I created a quick Python script to convert from the old to the new format
from json import loads, dumps
real_data = loads(input("Enter your json config below:\n")).get("homeAssistant", {}).get("matcher", {})
include = []
for label in real_data.get("includeLabels", []):
include.append({"type": "label", "value": label})
for label in real_data.get("includePatterns", []):
include.append({"type": "pattern", "value": label})
for label in real_data.get("includeDomains", []):
include.append({"type": "domain", "value": label})
exclude = []
for label in real_data.get("excludeLabels", []):
exclude.append({"type": "label", "value": label})
for label in real_data.get("excludePatterns", []):
exclude.append({"type": "pattern", "value": label})
for label in real_data.get("excludeDomains", []):
exclude.append({"type": "domain", "value": label})
print("\n\n\n--- Here is the new config file --- \n\n\n")
print(dumps(
{"name": "", "port": 5540, "filter": {"include": include, "exclude": exclude}}
, indent=2))
I just clicked away from the editor screen and the config i was working on for 10 minutes disappeared and didn't come back when I clicked new again.
Hopefully a confirmation can be added or it can persist the editor state