Skip to content

Commit

Permalink
Call shifter not expert in case no temperature or timestamp could be …
Browse files Browse the repository at this point in the history
…found
  • Loading branch information
maxnoe committed Oct 18, 2022
1 parent 1052753 commit f5aeb2b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions shifthelper/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ def is_weather_outdatet():

@log_call_and_result
def is_smartfact_outdatet():
''' SMARTFACT not updated in the last 10 minutes '''
''' SMARTFACT not updated in the last 10 minutes or timestamp missing.'''
timestamp = sfc.main_page().timestamp_1
if timestamp is None:
raise ValueError('Could not get smartfact timestamp')
return True
return is_older(timestamp, timedelta(minutes=10))


Expand Down Expand Up @@ -252,11 +252,9 @@ def is_maximum_current_high():

@log_call_and_result
def is_rel_camera_temperature_high():
'''relative camera temperature > 15°C'''
'''relative camera temperature > 15°C or not available. Camera off?'''
relative_temperature = sfc.main_page().relative_camera_temperature.value
if math.isnan(relative_temperature):
raise ValueError('Could not get relative camera temperature')
return relative_temperature >= 15.0
return math.isnan(relative_temperature) or relative_temperature >= 15.0


@log_call_and_result
Expand Down

0 comments on commit f5aeb2b

Please sign in to comment.