Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch to survive the latest HA changes #61

Merged
merged 11 commits into from
Jan 23, 2025
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<a href="https://github.com/epoplavskis/homeassistant_salus"><img src="https://salus-smarthome.eu/wp-content/themes/salus-controls/img/logo.svg" height="140"></a>
<a href="https://github.com/epoplavskis/homeassistant_salus"><img src="https://shop.salusinc.com/cdn/shop/files/saluslogo_-_600x160_eea8b0d2-55bf-43fa-a46a-2455b56d73c5_384x128.png?v=1623083270" height="140"></a>
</p>

# HomeAssistant - Salus Controls iT600 Smart Home Custom Component
Expand Down
17 changes: 13 additions & 4 deletions custom_components/salus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,18 @@ async def async_setup_gateway_entry(hass: core.HomeAssistant, entry: config_entr
sw_version=gateway_info.sw_version,
)

for component in GATEWAY_PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
)
await hass.config_entries.async_forward_entry_setups(entry, GATEWAY_PLATFORMS)

return True

async def async_unload_entry(hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry) -> bool:
"""Unload a config entry."""

unload_ok = await hass.config_entries.async_unload_platforms(
config_entry, GATEWAY_PLATFORMS
)

if unload_ok:
hass.data[DOMAIN].pop(config_entry.entry_id)

return unload_ok
18 changes: 11 additions & 7 deletions custom_components/salus/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import voluptuous as vol
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_OFF,
HVACMode,
ClimateEntityFeature,
FAN_OFF,
FAN_AUTO,
FAN_LOW,
Expand Down Expand Up @@ -92,11 +91,15 @@ async def async_added_to_hass(self):
self.async_on_remove(
self._coordinator.async_add_listener(self.async_write_ha_state)
)

@property
def supported_features(self):
"""Return the list of supported features."""
return self._coordinator.data.get(self._idx).supported_features
# definetly needs a better approach
# return self._coordinator.data.get(self._idx).supported_features

supported_features = ClimateEntityFeature.TURN_ON | ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.FAN_MODE
return supported_features

@property
def available(self):
Expand Down Expand Up @@ -213,6 +216,7 @@ async def async_set_temperature(self, **kwargs):

async def async_set_fan_mode(self, fan_mode):
"""Set fan speed (auto, low, medium, high, off)."""
_LOGGER.info('set_fan_mode: ' + str(fan_mode))
if fan_mode == FAN_OFF:
mode = "Off"
elif fan_mode == FAN_LOW:
Expand All @@ -228,9 +232,9 @@ async def async_set_fan_mode(self, fan_mode):

async def async_set_hvac_mode(self, hvac_mode):
"""Set operation mode (auto, heat, cool)."""
if hvac_mode == HVAC_MODE_HEAT:
if hvac_mode == HVACMode.HEAT:
mode = "heat"
elif hvac_mode == HVAC_MODE_COOL:
elif hvac_mode == HVACMode.COOL:
mode = "cool"
else:
mode = "auto"
Expand Down
8 changes: 4 additions & 4 deletions custom_components/salus/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"domain": "salus",
"name": "Salus iT600",
"config_flow": true,
"documentation": "https://github.com/jvitkauskas/homeassistant_salus",
"issue_tracker": "https://github.com/jvitkauskas/homeassistant_salus/issues",
"documentation": "https://github.com/leonardpitzu/homeassistant_salus",
"issue_tracker": "https://github.com/leonardpitzu/homeassistant_salus/issues",
"requirements": ["pyit600==0.5.1"],
"dependencies": [],
"codeowners": [
"@jvitkauskas"
"@leonardpitzu"
],
"version": "0.5.1"
"version": "0.5.3"
}