diff --git a/custom_components/peaqnext/sensors/next_sensor.py b/custom_components/peaqnext/sensors/next_sensor.py index 9fe4104..9ddb2b8 100644 --- a/custom_components/peaqnext/sensors/next_sensor.py +++ b/custom_components/peaqnext/sensors/next_sensor.py @@ -166,14 +166,18 @@ def _make_hours_display(self, model: HourModel) -> str: return "" if self._relative_time: differ = model.dt_start - prefix = "start " + prefix = "Start " if self._calculate_by == CalculateBy.ENDTIME: differ = model.dt_end - prefix = "end " - hour_diff = int((datetime.now() - differ).total_seconds()/3600) + prefix = "End " + hour_diff = int((differ - datetime.now()).total_seconds()/3600) + minute_diff = int((differ - datetime.now()).total_seconds()/60) if hour_diff == 0: - return f"{prefix}now" - return f"{prefix}{hour_diff}h" + if minute_diff == 0: + return f"{prefix}now -" + else: + return f"{prefix}in {minute_diff}m -" + return f"{prefix}in {hour_diff}h -" else: tomorrow1: str = self._get_tomorrow_assignation(model.dt_start.day > datetime.now().day) tomorrow2: str = self._get_tomorrow_assignation(model.dt_end.day > datetime.now().day)