Add support for updating bot
This commit is contained in:
parent
b778eedf5f
commit
547e6d57a9
1 changed files with 7 additions and 7 deletions
10
bumper/db.py
10
bumper/db.py
|
|
@ -345,11 +345,11 @@ def bot_add(sn: str, did: str, dev_class: str, resource: str, company: str) -> N
|
|||
new_bot.resource = resource
|
||||
new_bot.company = company
|
||||
|
||||
bot = bot_get(did)
|
||||
if not bot: # Not existing bot in database
|
||||
if (
|
||||
not dev_class == "" or "@" not in sn or "tmp" not in sn
|
||||
): # try to prevent bad additions to the bot list
|
||||
if (not dev_class) or "@" in sn or "tmp" in sn:
|
||||
# try to prevent bad additions to the bot list
|
||||
_LOGGER.warning(f"Skipping new bot with DID: {new_bot.did}: {new_bot.asdict()}")
|
||||
return
|
||||
|
||||
_LOGGER.info(f"Adding new bot with SN: {new_bot.name} DID: {new_bot.did}")
|
||||
bot_full_upsert(new_bot.asdict())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue