Compare commits

...

4 Commits

Author SHA1 Message Date
Jean-Marc Collin f970c18eaf Issue #100: compatibility with HA 2023.9.0 2023-09-08 08:48:09 +02:00
Jean-Marc Collin af51ef62e0 Issue #99 : over climate VTherm a regulated by the device itself and should not goes into security 2023-08-30 09:06:26 +02:00
Jean-Marc Collin b38fbd9d78 Issue #99 - security mode toggling 100 times within 2 minutes 2023-08-27 18:06:43 +02:00
Jean-Marc Collin 6e8e72e343 FIX Service name Github error 2023-08-16 22:30:46 +02:00
5 changed files with 133 additions and 123 deletions
@@ -18,7 +18,7 @@ from homeassistant.core import (
from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate import ClimateEntity
from homeassistant.helpers.restore_state import RestoreEntity from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.entity import DeviceInfo, DeviceEntryType from homeassistant.helpers.device_registry import DeviceInfo, DeviceEntryType
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.reload import async_setup_reload_service from homeassistant.helpers.reload import async_setup_reload_service
@@ -505,7 +505,7 @@ class VersatileThermostat(ClimateEntity, RestoreEntity):
if len(presets): if len(presets):
self._support_flags = SUPPORT_FLAGS | ClimateEntityFeature.PRESET_MODE self._support_flags = SUPPORT_FLAGS | ClimateEntityFeature.PRESET_MODE
for key, val in CONF_PRESETS.items(): # TODO before presets.items(): for key, val in CONF_PRESETS.items():
if val != 0.0: if val != 0.0:
self._attr_preset_modes.append(key) self._attr_preset_modes.append(key)
@@ -1582,6 +1582,8 @@ class VersatileThermostat(ClimateEntity, RestoreEntity):
if not new_state: if not new_state:
return return
new_hvac_mode = new_state.state
old_state = event.data.get("old_state") old_state = event.data.get("old_state")
old_hvac_action = ( old_hvac_action = (
old_state.attributes.get("hvac_action") old_state.attributes.get("hvac_action")
@@ -1594,16 +1596,21 @@ class VersatileThermostat(ClimateEntity, RestoreEntity):
else None else None
) )
# Issue 99 - some AC turn hvac_mode=cool and hvac_action=idle when sending a HVACMode_OFF command
if self._hvac_mode == HVACMode.OFF and new_hvac_action == HVACAction.IDLE:
_LOGGER.debug("The underlying switch to idle instead of OFF. We will consider it as OFF")
new_hvac_mode = HVACMode.OFF
_LOGGER.info( _LOGGER.info(
"%s - Underlying climate changed. Event.new_state is %s, current_hvac_mode=%s, new_hvac_action=%s, old_hvac_action=%s", "%s - Underlying climate changed. Event.new_hvac_mode is %s, current_hvac_mode=%s, new_hvac_action=%s, old_hvac_action=%s",
self, self,
new_state, new_hvac_mode,
self._hvac_mode, self._hvac_mode,
new_hvac_action, new_hvac_action,
old_hvac_action, old_hvac_action,
) )
if new_state.state in [ if new_hvac_mode in [
HVACMode.OFF, HVACMode.OFF,
HVACMode.HEAT, HVACMode.HEAT,
HVACMode.COOL, HVACMode.COOL,
@@ -1613,7 +1620,7 @@ class VersatileThermostat(ClimateEntity, RestoreEntity):
HVACMode.FAN_ONLY, HVACMode.FAN_ONLY,
None None
]: ]:
self._hvac_mode = new_state.state self._hvac_mode = new_hvac_mode
# Interpretation of hvac # Interpretation of hvac
HVAC_ACTION_ON = [ # pylint: disable=invalid-name HVAC_ACTION_ON = [ # pylint: disable=invalid-name
@@ -2099,7 +2106,8 @@ class VersatileThermostat(ClimateEntity, RestoreEntity):
switch_cond, switch_cond,
) )
shouldClimateBeInSecurity = temp_cond and climate_cond # Issue 99 - a climate is regulated by the device itself and not by VTherm. So a VTherm should never be in security !
shouldClimateBeInSecurity = False # temp_cond and climate_cond
shouldSwitchBeInSecurity = temp_cond and switch_cond shouldSwitchBeInSecurity = temp_cond and switch_cond
shouldBeInSecurity = shouldClimateBeInSecurity or shouldSwitchBeInSecurity shouldBeInSecurity = shouldClimateBeInSecurity or shouldSwitchBeInSecurity
@@ -4,7 +4,8 @@ from datetime import timedelta
from homeassistant.core import HomeAssistant, callback, Event from homeassistant.core import HomeAssistant, callback, Event
from homeassistant.components.climate import ClimateEntity, DOMAIN as CLIMATE_DOMAIN from homeassistant.components.climate import ClimateEntity, DOMAIN as CLIMATE_DOMAIN
from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.entity import Entity, DeviceInfo, DeviceEntryType from homeassistant.helpers.entity import Entity
from homeassistant.helpers.device_registry import DeviceInfo, DeviceEntryType
from homeassistant.helpers.event import async_track_state_change_event, async_call_later from homeassistant.helpers.event import async_track_state_change_event, async_call_later
from .climate import VersatileThermostat from .climate import VersatileThermostat
@@ -1,2 +1,2 @@
homeassistant homeassistant==2023.9.0
ffmpeg ffmpeg
@@ -1,4 +1,4 @@
# -r requirements_dev.txt -r requirements_dev.txt
# aiodiscover # aiodiscover
ulid_transform ulid_transform
pytest-homeassistant-custom-component pytest-homeassistant-custom-component
@@ -1,4 +1,5 @@
reload: reload:
name: Reload
description: Reload all Versatile Thermostat entities. description: Reload all Versatile Thermostat entities.
set_presence: set_presence: