Skip to content

Commit

Permalink
Update sensor.py
Browse files Browse the repository at this point in the history
  • Loading branch information
reiniertc authored Jun 12, 2024
1 parent 3ceeec4 commit 39b8e99
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions custom_components/magister_rooster/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def filter_summary(self, summary):
if self._regex_pattern:
match = self._regex_pattern.search(summary)
if match:
return match.group(1)
return match.group(0)
return summary

class VolgendeSchooldagSensor(MagisterRoosterBaseSensor):
Expand All @@ -135,13 +135,14 @@ def name(self):
def update(self):
super().update()
if self._events_tomorrow:
summaries = [self.filter_summary(event[2]) for event in self._events_tomorrow]
unique_summaries = set(summaries)
self._state = ", ".join(unique_summaries)
filtered_summaries = set()
for event in self._events_tomorrow:
summary = self.filter_summary(event[2])
filtered_summaries.add(summary)
self._state = ", ".join(filtered_summaries)
else:
self._state = None


class BegintijdMorgenSensor(MagisterRoosterBaseSensor):
@property
def name(self):
Expand Down

0 comments on commit 39b8e99

Please sign in to comment.