Skip to content

Commit a38b9c9

Browse files
authored
Merge pull request #65 from Glirido/main
Upload WMP protocol specification
2 parents 43d9f4f + c0c6930 commit a38b9c9

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

custom_components/intesisbox/climate.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,12 @@ def set_hvac_mode(self, operation_mode):
238238
if self._target_temperature:
239239
self._controller.set_temperature(self._target_temperature)
240240

241-
self.hass.async_add_job(self.schedule_update_ha_state, False)
241+
self.schedule_update_ha_state(False)
242242

243243
def turn_on(self):
244244
"""Turn thermostat on."""
245245
self._controller.set_power_on()
246-
self.hass.async_add_job(self.schedule_update_ha_state, False)
246+
self.schedule_update_ha_state(False)
247247

248248
def turn_off(self):
249249
"""Turn thermostat off."""
@@ -276,8 +276,8 @@ async def async_update(self):
276276
"""Copy values from controller dictionary to climate device."""
277277
if not self._controller.is_connected:
278278
await asyncio.sleep(
279-
60
280-
) # per device specs, wait min 1 sec before re-connecting
279+
5
280+
) # per device specs, wait minimum 1 second before re-connecting
281281
await self.hass.async_add_executor_job(self._controller.connect)
282282
self._connection_retries += 1
283283
else:
@@ -326,7 +326,7 @@ def update_callback(self):
326326
"""Let HA know there has been an update from the controller."""
327327
_LOGGER.debug("Intesisbox sent a status update.")
328328
if self.hass:
329-
self.hass.async_add_job(self.schedule_update_ha_state, True)
329+
self.schedule_update_ha_state(True)
330330

331331
@property
332332
def min_temp(self):

custom_components/intesisbox/intesisbox.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,15 @@ def connect(self):
207207
except Exception as e:
208208
_LOGGER.error("%s Exception. %s / %s", type(e), repr(e.args), e)
209209
self._connectionStatus = API_DISCONNECTED
210-
else:
210+
elif self._connectionStatus == API_CONNECTING:
211211
_LOGGER.debug("connect() called but already connecting")
212+
if self._transport.is_closing():
213+
_LOGGER.debug(
214+
"Socket is closing while trying to connect. Force reconnection"
215+
)
216+
self._connectionStatus = API_DISCONNECTED
217+
self._transport.close()
218+
self._send_update_callback()
212219

213220
def stop(self):
214221
"""Public method for shutting down connectivity with the envisalink."""

wmp-protocol-specs-v1-9.pdf

472 KB
Binary file not shown.

0 commit comments

Comments
 (0)