Skip to content

A live bird collage card for your Home Assistant dashboard.

Feat : error messages for detections rejections #138 (#190)

Alexandrea264eb9f8dc1
diff --git a/scripts/server.py b/scripts/server.py
index c7803e0d..d4558a70 100644
--- a/scripts/server.py
+++ b/scripts/server.py
@@ -330,10 +330,14 @@ def run_analysis(file):
for time_slot, entries in raw_detections.items():
log.info('%s-%s', time_slot, entries[0])
for entry in entries:
- if entry[1] >= conf.getfloat('CONFIDENCE') and ((entry[0] in INCLUDE_LIST or len(INCLUDE_LIST) == 0)
- and (entry[0] not in EXCLUDE_LIST or len(EXCLUDE_LIST) == 0)
- and (entry[0] in PREDICTED_SPECIES_LIST
- or len(PREDICTED_SPECIES_LIST) == 0)):
- d = Detection(time_slot.split(';')[0], time_slot.split(';')[1], entry[0], entry[1])
- confident_detections.append(d)
+ if entry[1] >= conf.getfloat('CONFIDENCE'):
+ if entry[0] not in INCLUDE_LIST and len(INCLUDE_LIST) != 0:
+ log.warning("Excluded as INCLUDE_LIST is active but this species is not in it: %s", entry[0])
+ elif entry[0] in EXCLUDE_LIST and len(EXCLUDE_LIST) != 0:
+ log.warning("Excluded as species in EXCLUDE_LIST: %s", entry[0])
+ elif entry[0] not in PREDICTED_SPECIES_LIST and len(PREDICTED_SPECIES_LIST) != 0:
+ log.warning("Excluded as below Species Occurrence Frequency Threshold: %s", entry[0])
+ else:
+ d = Detection(time_slot.split(';')[0], time_slot.split(';')[1], entry[0], entry[1])
+ confident_detections.append(d)
return confident_detections