Skip to content

Commit

Permalink
Catch additional cases where BeerTemp/RoomTemp are not set
Browse files Browse the repository at this point in the history
(Fixes #745)
  • Loading branch information
thorrak committed Aug 4, 2023
1 parent e322699 commit 93c3d54
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions external_push/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,17 +529,17 @@ def data_to_push(self):
# Cache the BrewPi's temp format as we want to convert to use the gravity sensor's format in case they
# happen to be different
brewpi_temp_format = latest_log_point.associated_device.assigned_brewpi_device.temp_format
if device_info['BeerTemp'] is not None:
if device_info['BeerTemp'] is not None and len(device_info['BeerTemp']) > 0:
if device_info['BeerTemp'] != 0:
# If we have an explicit beer temp from a BrewPi controller, we're going to use that instead
# of a temp from the gravity sensor.
to_send['temp'] = temp_convert(float(device_info['BeerTemp']), brewpi_temp_format,
latest_log_point.temp_format)
if device_info['FridgeTemp'] is not None:
if device_info['FridgeTemp'] is not None and len(device_info['FridgeTemp']) > 0:
if device_info['FridgeTemp'] != 0:
to_send['aux_temp'] = temp_convert(float(device_info['FridgeTemp']),
brewpi_temp_format, latest_log_point.temp_format)
if device_info['RoomTemp'] is not None:
if device_info['RoomTemp'] is not None and len(device_info['RoomTemp']) > 0:
if device_info['RoomTemp'] != 0:
to_send['ext_temp'] = temp_convert(float(device_info['RoomTemp']),
brewpi_temp_format, latest_log_point.temp_format)
Expand Down Expand Up @@ -573,15 +573,15 @@ def data_to_push(self):
to_send['temp_unit'] = brewpi.temp_format

if 'BeerTemp' in device_info:
if device_info['BeerTemp'] is not None:
if device_info['BeerTemp'] is not None and len(device_info['BeerTemp']) > 0:
to_send['temp'] = float(device_info['BeerTemp'])

if 'FridgeTemp' in device_info:
if device_info['FridgeTemp'] is not None:
if device_info['FridgeTemp'] is not None and len(device_info['FridgeTemp']) > 0:
to_send['aux_temp'] = float(device_info['FridgeTemp'])

if 'RoomTemp' in device_info:
if device_info['RoomTemp'] is not None:
if device_info['RoomTemp'] is not None and len(device_info['RoomTemp']) > 0:
to_send['ext_temp'] = float(device_info['RoomTemp'])

if brewpi.active_beer is not None:
Expand Down

0 comments on commit 93c3d54

Please sign in to comment.