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