Skip to content

Commit

Permalink
Merge pull request #419 from asantaga/dev
Browse files Browse the repository at this point in the history
v3.4.2
  • Loading branch information
msp1974 authored Dec 27, 2023
2 parents c800f8d + 2382a0c commit 1437d12
Show file tree
Hide file tree
Showing 17 changed files with 393 additions and 101 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wiser Home Assistant Integration v3.4.1
# Wiser Home Assistant Integration v3.4.2

[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg?style=for-the-badge)](https://github.com/hacs/integration)
[![downloads](https://shields.io/github/downloads/asantaga/wiserHomeAssistantPlatform/latest/total?style=for-the-badge)](https://github.com/asantaga/wiserHomeAssistantPlatform)
Expand All @@ -10,6 +10,8 @@ It also supports some European versions of the Wiser Hub under the Schneider Ele

For the latest version of the Wiser Home Assistant Platform please install via HACS. If you want bleeding edge then checkout the dev branch, or look out for beta releases via HACS. Depending on what you choose you may need to use the Manual Code Installation as described in the Wiki.

**This integration requires a minimum HA version of 2023.12.**

Detailed information about this integration has now been moved to our [Wiki pages](https://github.com/asantaga/wiserHomeAssistantPlatform/wiki)

For more information checkout the AMAZING community thread available on
Expand All @@ -22,6 +24,15 @@ For more information checkout the AMAZING community thread available on

## Change log

- v3.4.2
- Reverted to using aiohttp for communication and resolved issues caused by HA2023.12
- Bumped api to v1.5.5
- Fixed issue where hub communication would error due to command characters in payload (issue [#418](https://github.com/asantaga/wiserHomeAssistantPlatform/issues/418))
- Updated schedule card to allow hiding of hot water schedule (issue [#415](https://github.com/asantaga/wiserHomeAssistantPlatform/issues/415))
- Included version in card resources to improve updating of new versions
- Added more v2 hub features and attributes
- Improved error handling/logging when hub offline and command is issued

- v3.4.1
- Corrected error deleting schedule
- Handle space at end of secret key and prevent error (issue [#409](https://github.com/asantaga/wiserHomeAssistantPlatform/issues/409))
Expand Down
1 change: 0 additions & 1 deletion custom_components/wiser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry):
# Register custom cards
cards = WiserCardRegistration(hass)
await cards.async_register()
await cards.async_remove_gzip_files()

_LOGGER.info(
f"Wiser Component Setup Completed ({coordinator.wiserhub.system.name})"
Expand Down
8 changes: 7 additions & 1 deletion custom_components/wiser/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from homeassistant.util import dt as dt_util
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from .helpers import get_device_name, get_unique_id, get_identifier
from .helpers import get_device_name, get_unique_id, get_identifier, hub_error_handler

from .const import (
DATA,
Expand Down Expand Up @@ -90,6 +90,7 @@ class WiserBoostAllHeatingButton(WiserButton):
def __init__(self, data) -> None:
super().__init__(data, "Boost All Heating")

@hub_error_handler
async def async_press(self):
boost_time = self._data.boost_time
boost_temp = self._data.boost_temp
Expand All @@ -105,6 +106,7 @@ class WiserCancelHeatingOverridesButton(WiserButton):
def __init__(self, data) -> None:
super().__init__(data, "Cancel All Heating Overrides")

@hub_error_handler
async def async_press(self):
await self._data.wiserhub.system.cancel_all_overrides()
await self.async_force_update()
Expand All @@ -118,6 +120,7 @@ class WiserBoostHotWaterButton(WiserButton):
def __init__(self, data) -> None:
super().__init__(data, "Boost Hot Water")

@hub_error_handler
async def async_press(self):
boost_time = self._data.hw_boost_time
await self._data.wiserhub.hotwater.boost(boost_time)
Expand All @@ -132,6 +135,7 @@ class WiserCancelHotWaterOverridesButton(WiserButton):
def __init__(self, data) -> None:
super().__init__(data, "Cancel Hot Water Overrides")

@hub_error_handler
async def async_press(self):
await self._data.wiserhub.hotwater.cancel_overrides()
await self.async_force_update()
Expand All @@ -145,6 +149,7 @@ class WiserOverrideHotWaterButton(WiserButton):
def __init__(self, data) -> None:
super().__init__(data, "Toggle Hot Water")

@hub_error_handler
async def async_press(self):
await self._data.wiserhub.hotwater.override_state(
"Off" if self._data.wiserhub.hotwater.current_state == "On" else "On"
Expand All @@ -163,6 +168,7 @@ def __init__(self, data, moment_id) -> None:
data, f"Moments {data.wiserhub.moments.get_by_id(moment_id).name}"
)

@hub_error_handler
async def async_press(self):
await self._data.wiserhub.moments.get_by_id(self._moment_id).activate()
await self.async_force_update()
Expand Down
51 changes: 51 additions & 0 deletions custom_components/wiser/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from .helpers import (
get_device_name,
get_identifier,
hub_error_handler,
)
from .schedules import WiserScheduleEntity

Expand Down Expand Up @@ -207,6 +208,7 @@ def name(self):
"""Return Name of device."""
return f"{get_device_name(self._data, self._actuator_id)} Floor Temp"

@hub_error_handler
async def async_set_temperature(self, **kwargs) -> None:
"""Set new target temperature."""
if (
Expand Down Expand Up @@ -353,6 +355,7 @@ def hvac_modes(self):
"""Return the list of available operation modes."""
return self._hvac_modes_list

@hub_error_handler
async def async_set_hvac_mode(self, hvac_mode):
"""Set new operation mode."""
_LOGGER.debug(f"Setting HVAC mode to {hvac_mode} for {self._room.name}")
Expand Down Expand Up @@ -399,6 +402,7 @@ def preset_modes(self):
"""Return the list of available preset modes."""
return self._room.available_presets

@hub_error_handler
async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Async call to set preset mode ."""
_LOGGER.debug(f"Setting Preset Mode {preset_mode} for {self._room.name}")
Expand Down Expand Up @@ -452,6 +456,51 @@ def extra_state_attributes(self):
attrs["control_direction"] = self._room.control_direction
attrs["displayed_setpoint"] = self._room.displayed_setpoint

# Added by LGO
# Climate capabilities only with Hub Vé
if self._room.capabilities:
attrs["heating_supported"] = self._room.capabilities.heating_supported
attrs["cooling_supported"] = self._room.capabilities.cooling_supported
attrs[
"minimum_heat_set_point"
] = self._room.capabilities.minimum_heat_set_point
attrs[
"maximum_heat_set_point"
] = self._room.capabilities.maximum_heat_set_point
attrs[
"minimum_cool_set_point"
] = self._room.capabilities.minimum_cool_set_point
attrs[
"maximum_cool_set_point"
] = self._room.capabilities.maximum_cool_set_point
attrs["setpoint_step"] = self._room.capabilities.setpoint_step
attrs["ambient_temperature"] = self._room.capabilities.ambient_temperature
attrs["temperature_control"] = self._room.capabilities.temperature_control
attrs[
"open_window_detection"
] = self._room.capabilities.open_window_detection
attrs[
"hydronic_channel_selection"
] = self._room.capabilities.hydronic_channel_selection
attrs["on_off_supported"] = self._room.capabilities.on_off_supported

# Summer comfort

attrs["include_in_summer_comfort"] = self._room.include_in_summer_comfort
attrs["floor_sensor_state"] = self._room.floor_sensor_state

# occupancy

attrs["occupancy_capable"] = self._room.occupancy_capable
if self._room.occupancy_capable:
attrs["occupancy"] = self._room.occupancy
attrs["occupied_heating_set_point"] = self._room.occupied_heating_set_point
attrs[
"unoccupied_heating_set_point"
] = self._room.unoccupied_heating_set_point

# End Added by LGO

# Room can have no schedule
if self._room.schedule:
attrs["schedule_id"] = self._room.schedule.id
Expand Down Expand Up @@ -507,6 +556,7 @@ def target_temperature_low(self) -> float | None:
"""
return self._room.passive_mode_lower_temp

@hub_error_handler
async def async_set_temperature(self, **kwargs):
"""Set new target temperatures."""
if self._room.is_passive_mode and not self._room.is_boosted:
Expand Down Expand Up @@ -553,6 +603,7 @@ def unique_id(self):
f"{self._data.wiserhub.system.name}-WiserRoom-{self._room_id}-{self.name}"
)

@hub_error_handler
@callback
async def async_boost_heating(
self, time_period: int, temperature_delta=0, temperature=0
Expand Down
16 changes: 14 additions & 2 deletions custom_components/wiser/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,24 @@
Angelosantagata@gmail.com
"""
VERSION = "3.4.1"
DOMAIN = "wiser"
DATA_WISER_CONFIG = "wiser_config"
URL_BASE = "/wiser"
WISER_CARD_FILENAMES = ["wiser-schedule-card.js", "wiser-zigbee-card.js"]

VERSION = "3.4.1"
WISER_CARDS = [
{
"name": "Wiser Schedule Card",
"filename": "wiser-schedule-card.js",
"version": "1.3.3",
},
{
"name": "Wiser Zigbee Card",
"filename": "wiser-zigbee-card.js",
"version": "2.1.1",
},
]

WISER_PLATFORMS = [
"climate",
"sensor",
Expand Down
36 changes: 14 additions & 22 deletions custom_components/wiser/coordinator.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,36 @@
from dataclasses import dataclass
from datetime import datetime, timedelta
import logging
from dataclasses import dataclass

from homeassistant.config_entries import ConfigEntry

from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator

from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_SCAN_INTERVAL,
)

from aioWiserHeatAPI.wiserhub import (
TEMP_MINIMUM,
TEMP_MAXIMUM,
TEMP_MINIMUM,
WiserAPI,
WiserHubConnectionError,
WiserHubAuthenticationError,
WiserHubConnectionError,
WiserHubRESTError,
)

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_SCAN_INTERVAL
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator

from .const import (
CONF_AUTOMATIONS_PASSIVE,
CONF_AUTOMATIONS_PASSIVE_TEMP_INCREMENT,
CONF_RESTORE_MANUAL_TEMP_OPTION,
CONF_SETPOINT_MODE,
CUSTOM_DATA_STORE,
DEFAULT_PASSIVE_TEMP_INCREMENT,
DEFAULT_SETPOINT_MODE,
CONF_HEATING_BOOST_TEMP,
CONF_HEATING_BOOST_TIME,
CONF_HW_BOOST_TIME,
CONF_RESTORE_MANUAL_TEMP_OPTION,
CONF_SETPOINT_MODE,
CUSTOM_DATA_STORE,
DEFAULT_BOOST_TEMP,
DEFAULT_BOOST_TEMP_TIME,
DEFAULT_PASSIVE_TEMP_INCREMENT,
DEFAULT_SCAN_INTERVAL,
DEFAULT_SETPOINT_MODE,
DOMAIN,
MIN_SCAN_INTERVAL,
)
Expand Down Expand Up @@ -119,7 +112,6 @@ def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
self.wiserhub = WiserAPI(
host=config_entry.data[CONF_HOST],
secret=str(config_entry.data[CONF_PASSWORD]).strip(),
session=async_get_clientsession(hass),
extra_config_file=hass.config.config_dir + CUSTOM_DATA_STORE,
enable_automations=self.enable_automations_passive_mode,
)
Expand Down
Loading

0 comments on commit 1437d12

Please sign in to comment.