Add notifications if sensors,, actors,... can't be started

This commit is contained in:
avollkopf 2024-12-18 20:01:01 +01:00
parent f679aabf0c
commit e2bf72bbce
4 changed files with 7 additions and 5 deletions

View file

@ -1,3 +1,3 @@
__version__ = "4.4.7.a3" __version__ = "4.4.7.a4"
__codename__ = "Yeast Starter" __codename__ = "Yeast Starter"

View file

@ -68,7 +68,7 @@ class Actor:
actortype = self.type actortype = self.type
else: else:
state = False state = False
actortype = "!!! MISSING TYPE !!!" actortype = self.type # !!! MISSING TYPE !!!
return dict(id=self.id, name=self.name, type=actortype, props=self.props.to_dict(), state=state, power=self.power, timer=self.timer) return dict(id=self.id, name=self.name, type=actortype, props=self.props.to_dict(), state=state, power=self.power, timer=self.timer)
class DataType(Enum): class DataType(Enum):

View file

@ -2,7 +2,7 @@
import logging import logging
import os.path import os.path
import json import json
from cbpi.api.dataclasses import Fermenter, Actor, Props from cbpi.api.dataclasses import Fermenter, Actor, Props, NotificationType
import sys, os import sys, os
import shortuuid import shortuuid
import asyncio import asyncio
@ -130,7 +130,9 @@ class BasicController:
# await self.push_udpate() # await self.push_udpate()
except Exception as e: except Exception as e:
logging.error("{} Cant start {} - {}".format(self.name, id, e)) line="{} Cant start {} - {}".format(self.name, id, e)
logging.error(line)
self.cbpi.notify("Error", line, NotificationType.ERROR)
def get_types(self): def get_types(self):
# logging.info("{} Get Types".format(self.name)) # logging.info("{} Get Types".format(self.name))

View file

@ -170,7 +170,7 @@ class UploadController:
f.close() f.close()
self.cbpi.notify("Success", "XML Recipe {} has been uploaded".format(filename), NotificationType.SUCCESS) self.cbpi.notify("Success", "XML Recipe {} has been uploaded".format(filename), NotificationType.SUCCESS)
except Exception as e: except Exception as e:
self.cbpi.notify("Error" "XML Recipe upload failed: {}".format(e), NotificationType.ERROR) self.cbpi.notify("Error", "XML Recipe upload failed: {}".format(e), NotificationType.ERROR)
pass pass
elif content_type == 'application/json': elif content_type == 'application/json':