Skip to content

Commit c0c8c8e

Browse files
committed
refactor(tion): move updating sate from breezer to own function
1 parent 42e44c6 commit c0c8c8e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

tion_btle/tion.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,11 @@ def __detect_heating_state(self,
222222
else:
223223
self.heating = "off"
224224

225-
def get(self, keep_connection: bool = False) -> dict:
225+
def get_state_from_breezer(self, keep_connection: bool = False) -> None:
226226
"""
227-
Get current device state
227+
Get current state from breezer
228228
:param keep_connection: should we keep connection to device or disconnect after getting data
229-
:return:
230-
dictionary with device state
229+
:return: None
231230
"""
232231
try:
233232
self.connect()
@@ -242,6 +241,16 @@ def get(self, keep_connection: bool = False) -> dict:
242241

243242
self._decode_response(response)
244243
self.__detect_heating_state()
244+
245+
def get(self, keep_connection: bool = False) -> dict:
246+
"""
247+
Report current breezer state
248+
:param keep_connection: should we keep connection to device or disconnect after getting data
249+
:return:
250+
dictionary with device state
251+
"""
252+
253+
self.get_state_from_breezer(keep_connection)
245254
common = self.__generate_common_json()
246255
model_specific_data = self._generate_model_specific_json()
247256

0 commit comments

Comments
 (0)