mqtt and newdev name regex

This commit is contained in:
jokob-sk
2025-02-20 07:57:28 +11:00
parent 9d4eafea42
commit 458577e071
3 changed files with 7 additions and 3 deletions

View File

@@ -473,7 +473,10 @@ def mqtt_start(db):
"model": devDisplayName,
"last_connection": prepTimeStamp(str(device["devLastConnection"])),
"first_connection": prepTimeStamp(str(device["devFirstConnection"])),
"sync_node": device["devSyncHubNode"]
"sync_node": device["devSyncHubNode"],
"group": device["devGroup"],
"location": device["devLocation"],
"parent_mac": device["devParentMAC"]
}
# bulk update device sensors in home assistant

View File

@@ -398,7 +398,8 @@
"XC5sYW4=",
"XC5ob21l",
"LVthLWZBLUYwLTldezMyfQ==",
"Iy4q"
"Iy4q",
"XC5cYg=="
],
"options": [],
"localized": [

View File

@@ -624,7 +624,7 @@ def cleanDeviceName(str, match_IP):
str = re.sub(rgx, "", str)
mylog('trace', ["[cleanDeviceName] name after regex : " + str])
str = re.sub(r'\.\b', '', str) # trailing dot after words
# str = re.sub(r'\.\b', '', str) # trailing dot after words
str = re.sub(r'\.$', '', str) # trailing dot at the end of the string
str = str.replace(". (IP match)", " (IP match)") # Remove dot if (IP match) is added