Skip to content

Commit a29dd5f

Browse files
committed
Fixed bug when external temperature sensor is not given
1 parent 2ebe183 commit a29dd5f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

custom_components/optispark/config_flow.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ async def async_step_init(self, user_input: dict | None = None) -> config_entrie
7272
postcode=user_input['postcode'],
7373
heat_pump_power_entity_id=user_input['heat_pump_power_entity_id'])
7474
user_input['postcode'] = postcode # Fix postcode formating
75+
if 'external_temp_entity_id' not in user_input:
76+
user_input['external_temp_entity_id'] = None
7577

7678
self.user_input_init = user_input
7779
return await self.async_step_accept(user_input)

custom_components/optispark/coordinator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ def heat_pump_power_usage(self):
117117
@property
118118
def external_temp(self):
119119
"""External house temperature."""
120-
return get_entity(self.hass, self._external_temp_entity_id).native_value
120+
if self._external_temp_entity_id is None:
121+
return None
122+
else:
123+
return get_entity(self.hass, self._external_temp_entity_id).native_value
121124

122125
@property
123126
def lambda_args(self):

0 commit comments

Comments
 (0)