|
@@ -114,14 +114,17 @@ class SpaceInfoService(Service):
|
|
|
|
|
|
return custom_target_df
|
|
|
|
|
|
- async def get_current_temperature_target(self) -> float:
|
|
|
+ async def get_current_temperature_target(self) -> object:
|
|
|
current_targets = await self.get_custom_target()
|
|
|
- temp = arrow.get(self._now_time, TIME_FMT).shift(minutes=15).timestamp // (15 * 60) * (15 * 60)
|
|
|
- next_quarter_minutes = arrow.get(temp).time().strftime('%H%M%S')
|
|
|
- try:
|
|
|
- current_lower_target = current_targets['temperatureMin'].loc[next_quarter_minutes]
|
|
|
- current_upper_target = current_targets['temperatureMax'].loc[next_quarter_minutes]
|
|
|
- except KeyError:
|
|
|
+ if len(current_targets) > 0:
|
|
|
+ temp = arrow.get(self._now_time, TIME_FMT).shift(minutes=15).timestamp // (15 * 60) * (15 * 60)
|
|
|
+ next_quarter_minutes = arrow.get(temp).time().strftime('%H%M%S')
|
|
|
+ try:
|
|
|
+ current_lower_target = current_targets['temperatureMin'].loc[next_quarter_minutes]
|
|
|
+ current_upper_target = current_targets['temperatureMax'].loc[next_quarter_minutes]
|
|
|
+ except KeyError:
|
|
|
+ current_lower_target, current_upper_target = 0.0, 0.0
|
|
|
+ else:
|
|
|
current_lower_target, current_upper_target = np.NAN, np.NAN
|
|
|
|
|
|
return (current_lower_target + current_upper_target) / 2
|