Skip to content

Commit

Permalink
change for release 1.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
donfrensis committed Nov 9, 2024
1 parent db0f400 commit 457310e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Simplified fork of the IntesisHome integration for Home Assistant

*This project is a simplified fork of the original IntesisHome integration by @jnimmo. The original version supported various Intesis devices, while this fork focuses exclusively on local HTTP control for selected devices.*

[![hacs_badge](https://img.shields.io/badge/HACS-Custom-41BDF5.svg?style=for-the-badge)](https://github.com/hacs/integration)
[![hacs_badge](https://img.shields.io/badge/HACS-Custom-41BDF5.svg)](https://github.com/hacs/integration)

This custom version exclusively supports local control via HTTP for selected devices.

Expand Down
8 changes: 7 additions & 1 deletion custom_components/intesishome_local/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,21 @@ def __init__(
self._attr_hvac_modes.extend(mode_list)
self._attr_hvac_modes.append(HVACMode.OFF)

# Nel metodo async_added_to_hass
async def async_added_to_hass(self):
"""Subscribe to event updates."""
_LOGGER.debug("Added climate device with state: %s", repr(self._ih_device))
self._controller.add_update_callback(self.async_update_callback)

try:
await self._controller.connect()
except IHConnectionError as ex:
except (IHConnectionError, TypeError) as ex:
_LOGGER.error("Exception connecting to IntesisHome: %s", ex)
self._connected = False
return # Non solleviamo PlatformNotReady, permettiamo all'entità di esistere come non disponibile

except Exception as ex: # Cattura altri errori inattesi
_LOGGER.error("Unexpected error connecting to IntesisHome: %s", ex)
raise PlatformNotReady from ex

@property
Expand Down
13 changes: 11 additions & 2 deletions custom_components/intesishome_local/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,17 @@ async def _test_device_connection(self, host: str) -> bool:
try:
async with async_timeout.timeout(2):
async with aiohttp.request('HEAD', f"http://{host}", raise_for_status=False) as response:
return response.status == 200
except:
if response.status != 200:
_LOGGER.error("Device at %s is not responding (HTTP %s)", host, response.status)
return False
# Verifica aggiuntiva che sia un dispositivo Intesis
async with aiohttp.request('GET', f"http://{host}/info", raise_for_status=False) as info_response:
if info_response.status != 200:
_LOGGER.error("Device at %s is not responding as an Intesis device", host)
return False
return True
except Exception as ex:
_LOGGER.error("Failed to connect to device at %s: %s", host, str(ex))
return False

async def async_step_user(self, user_input=None) -> FlowResult:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/intesishome_local/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"issue_tracker": "https://github.com/donfrensis/ha-intesishome-local/issues",
"loggers": ["pyintesishome"],
"requirements": ["pyintesishome==1.8.5"],
"version": "1.1.3"
"version": "1.1.4"
}

0 comments on commit 457310e

Please sign in to comment.