Files
EHS-Sentinel-Addon_for_Home…/EHSExceptions.py
echoDaveD 48ef003f22 Feature/v0.2.0 (#7)
* heateroutput limit 0 - 15000 w

* heatoutput always positive

* ENUM_IN_FSV_2041 value 0c00 unknwon added

* recalculate crc6 checksum and check it

* skip exception to reduce logging

* NASAPacket and NASAMessage prepared for write mode
MQTT Auto Discovery changed single entitity to all entities
NASA Packet crc16 Checksum verificated

* - Changed MQTT Auto Discovery Config Message from single Entitiy to all Entities at ones, known devices are fully configured, not known empty (markt to delete)
- NASAPacket and NASAMessage are now bidirectional, can decode and encode Packets
- Added crc16 Checksum check for any Packet to reduce incorrect value changes
- Folling warnings moved to SkipInvalidPacketException and from warning to debug log level to reduce Logentries
  - Source Adress Class out of enum
  - Destination Adress Class out of enum
  - Checksum for package could not be validatet calculated
  - Message with structure type must have capacity of 1.

* NASA_OUTDOOR_HP as kw unit

* NASA Repository, measurements enums completed

* filter wifikit heartbeat

* process only packets from indoor or outdoor

* correct readme

* remove expire

* device discovery status

* new mqtt hass configuration approach

* added new measurements

* added new logging features from config


* NASA_EHSSENTINEL_TOTAL_COP added

* removed silentMode, added logging proccessedMessage

* loaded devices

* loaded devices counter fix

* only if retain true

* final 0.2.0 commit
2025-02-22 22:45:18 +01:00

63 lines
1.7 KiB
Python

class EHSException(Exception):
"""Base class for exceptions in this module."""
pass
class MessageWarningException(EHSException):
"""Exception raised by message errors.
Attributes:
message -- explanation of the error
"""
def __init__(self, argument, message):
self.argument = argument
self.message = message
super().__init__(self.message)
def __str__(self):
return f'{self.message}: {self.argument}'
class ConfigException(EHSException):
"""Exception raised by multiple Config errors.
Attributes:
message -- explanation of the error
"""
def __init__(self, argument, message="Config Parameter Exception: "):
self.argument = argument
self.message = message
super().__init__(self.message)
def __str__(self):
return f'{self.message}: {self.argument}'
class ArgumentException(EHSException):
"""Exception raised by multiple Arguments errors.
Attributes:
message -- explanation of the error
"""
def __init__(self, argument, message="Argument is missing"):
self.argument = argument
self.message = message
super().__init__(self.message)
def __str__(self):
return f'{self.argument} -> {self.message}'
class SkipInvalidPacketException(EHSException):
"""Exception raised for invalid message types.
Attributes:
message_type -- input message type which caused the error
message -- explanation of the error
"""
def __init__(self, message="Invalid message type provided"):
self.message = message
super().__init__(self.message)
def __str__(self):
return f'{self.message}'