Compare commits
1 Commits
5.2.0
...
5.2.0-alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a17aba45fa |
@@ -1,8 +1,5 @@
|
||||
default_config:
|
||||
|
||||
# ffmeg
|
||||
ffmpeg:
|
||||
|
||||
logger:
|
||||
default: info
|
||||
logs:
|
||||
|
||||
39
README-fr.md
39
README-fr.md
@@ -34,7 +34,6 @@
|
||||
- [Configurer la gestion de la puissance](#configurer-la-gestion-de-la-puissance)
|
||||
- [Configurer la présence ou l'occupation](#configurer-la-présence-ou-loccupation)
|
||||
- [Configuration avancée](#configuration-avancée)
|
||||
- [Le contrôle centralisé](#le-contrôle-centralisé)
|
||||
- [Synthèse des paramètres](#synthèse-des-paramètres)
|
||||
- [Exemples de réglage](#exemples-de-réglage)
|
||||
- [Chauffage électrique](#chauffage-électrique)
|
||||
@@ -75,16 +74,14 @@ Ce composant personnalisé pour Home Assistant est une mise à niveau et est une
|
||||
|
||||
|
||||
>  _*Nouveautés*_
|
||||
> * **Release 5.2** : Ajout d'un `central_mode` permettant de piloter tous les VTherms de façon centralisée [#158](https://github.com/jmcollin78/versatile_thermostat/issues/158).
|
||||
> * **Release 5.1** : Limitation des valeurs envoyées aux valves et au température envoyées au climate sous-jacent.
|
||||
> * **Release 5.0** : Ajout d'une configuration centrale permettant de mettre en commun les attributs qui peuvent l'être [#239](https://github.com/jmcollin78/versatile_thermostat/issues/239).
|
||||
> * **Release 4.3** : Ajout d'un mode auto-fan pour le type `over_climate` permettant d'activer la ventilation si l'écart de température est important [#223](https://github.com/jmcollin78/versatile_thermostat/issues/223).
|
||||
> * **Release 4.2** : Le calcul de la pente de la courbe de température se fait maintenant en °/heure et non plus en °/min [#242](https://github.com/jmcollin78/versatile_thermostat/issues/242). Correction de la détection automatique des ouvertures par l'ajout d'un lissage de la courbe de température .
|
||||
> * **Release 4.1** : Ajout d'un mode de régulation **Expert** dans lequel l'utilisateur peut spécifier ses propres paramètres d'auto-régulation au lieu d'utiliser les pre-programmés [#194](https://github.com/jmcollin78/versatile_thermostat/issues/194).
|
||||
> * **Release 4.0** : Ajout de la prise en charge de la **Versatile Thermostat UI Card**. Voir [Versatile Thermostat UI Card](https://github.com/jmcollin78/versatile-thermostat-ui-card). Ajout d'un mode de régulation **Slow** pour les appareils de chauffage à latence lente [#168](https://github.com/jmcollin78/versatile_thermostat/issues/168). Changement de la façon dont **la puissance est calculée** dans le cas de VTherm avec des équipements multi-sous-jacents [#146](https://github.com/jmcollin78/versatile_thermostat/issues/146). Ajout de la prise en charge de AC et Heat pour VTherm via un interrupteur également [#144](https://github.com/jmcollin78/versatile_thermostat/pull/144)
|
||||
<details>
|
||||
<summary>Autres versions</summary>
|
||||
|
||||
> * **Release 4.1** : Ajout d'un mode de régulation **Expert** dans lequel l'utilisateur peut spécifier ses propres paramètres d'auto-régulation au lieu d'utiliser les pre-programmés [#194](https://github.com/jmcollin78/versatile_thermostat/issues/194).
|
||||
> * **Release 4.0** : Ajout de la prise en charge de la **Versatile Thermostat UI Card**. Voir [Versatile Thermostat UI Card](https://github.com/jmcollin78/versatile-thermostat-ui-card). Ajout d'un mode de régulation **Slow** pour les appareils de chauffage à latence lente [#168](https://github.com/jmcollin78/versatile_thermostat/issues/168). Changement de la façon dont **la puissance est calculée** dans le cas de VTherm avec des équipements multi-sous-jacents [#146](https://github.com/jmcollin78/versatile_thermostat/issues/146). Ajout de la prise en charge de AC et Heat pour VTherm via un interrupteur également [#144](https://github.com/jmcollin78/versatile_thermostat/pull/144)
|
||||
> * **Release 3.8**: Ajout d'une **fonction d'auto-régulation** pour les thermostats `over climate` dont la régulation est faite par le climate sous-jacent. Cf. [L'auto-régulation](#lauto-régulation) et [#129](https://github.com/jmcollin78/versatile_thermostat/issues/129). Ajout de la **possibilité d'inverser la commande** pour un thermostat `over switch` pour adresser les installations avec fil pilote et diode [#124](https://github.com/jmcollin78/versatile_thermostat/issues/124).
|
||||
> * **Release 3.7**: Ajout du type de **Versatile Thermostat `over valve`** pour piloter une vanne TRV directement ou tout autre équipement type gradateur pour le chauffage. La régulation se fait alors directement en agissant sur le pourcentage d'ouverture de l'entité sous-jacente : 0 la vanne est coupée, 100 : la vanne est ouverte à fond. Cf. [#131](https://github.com/jmcollin78/versatile_thermostat/issues/131). Ajout d'une fonction permettant le bypass de la détection d'ouverture [#138](https://github.com/jmcollin78/versatile_thermostat/issues/138). Ajout de la langue Slovaque
|
||||
> * **Release 3.6**: Ajout du paramètre `motion_off_delay` pour améliorer la gestion de des mouvements [#116](https://github.com/jmcollin78/versatile_thermostat/issues/116), [#128](https://github.com/jmcollin78/versatile_thermostat/issues/128). Ajout du mode AC (air conditionné) pour un VTherm over switch. Préparation du projet Github pour faciliter les contributions [#127](https://github.com/jmcollin78/versatile_thermostat/issues/127)
|
||||
@@ -153,8 +150,7 @@ Ce composant nommé __Versatile thermostat__ gère les cas d'utilisation suivant
|
||||
- Ajouter une **gestion de délestage** ou une régulation pour ne pas dépasser une puissance totale définie. Lorsque la puissance maximale est dépassée, un préréglage caché de « puissance » est défini sur l'entité climatique. Lorsque la puissance passe en dessous du maximum, le préréglage précédent est restauré.
|
||||
- La **gestion de la présence à domicile**. Cette fonctionnalité vous permet de modifier dynamiquement la température du préréglage en tenant compte d'un capteur de présence de votre maison.
|
||||
- Des **services pour interagir avec le thermostat** à partir d'autres intégrations : vous pouvez forcer la présence / la non-présence à l'aide d'un service, et vous pouvez modifier dynamiquement la température des préréglages et changer les paramètres de sécurité.
|
||||
- Ajouter des capteurs pour voir les états internes du thermostat,
|
||||
- Contrôle centralisé de tous les Versatile Thermostat pour les stopper tous, les passer tous en hors-gel, les forcer en mode Chauffage (l'hiver), les forcer en mode Climatisation (l'été).
|
||||
- Ajouter des capteurs pour voir les états internes du thermostat.
|
||||
|
||||
# Comment installer cet incroyable Thermostat Versatile ?
|
||||
|
||||
@@ -191,9 +187,7 @@ Suivez ensuite les étapes de configuration comme suit :
|
||||
|
||||
## Choix des attributs de base
|
||||
|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
Donnez les principaux attributs obligatoires :
|
||||
1. un nom (sera le nom de l'intégration et aussi le nom de l'entité climate)
|
||||
@@ -203,8 +197,7 @@ Donnez les principaux attributs obligatoires :
|
||||
6. une durée de cycle en minutes. A chaque cycle, le radiateur s'allumera puis s'éteindra pendant une durée calculée afin d'atteindre la température ciblée (voir [preset](#configure-the-preset-temperature) ci-dessous). En mode ```over_climate```, le cycle ne sert qu'à faire des controles de base mais ne régule pas directement la température. C'est le ```climate``` sous-jacent qui le fait,
|
||||
7. les températures minimales et maximales du thermostat,
|
||||
8. une puissance de l'équipement ce qui va activer les capteurs de puissance et énergie consommée par l'appareil,
|
||||
9. la possibilité de controler le thermostat de façon centralisée. Cf [controle centralisé](#le-contrôle-centralisé),
|
||||
10. la liste des fonctionnalités qui seront utilisées pour ce thermostat. En fonction de vos choix, les écrans de configuration suivants s'afficheront ou pas.
|
||||
9. la liste des fonctionnalités qui seront utilisées pour ce thermostat. En fonction de vos choix, les écrans de configuration suivants s'afficheront ou pas.
|
||||
|
||||
>  _*Notes*_
|
||||
> 1. avec les types ```over_switch``` et ```over_valve```, les calculs sont effectués à chaque cycle. Donc en cas de changement de conditions, il faudra attendre le prochain cycle pour voir un changement. Pour cette raison, le cycle ne doit pas être trop long. **5 min est une bonne valeur**,
|
||||
@@ -522,21 +515,6 @@ Voir [exemple de réglages](#examples-tuning) pour avoir des exemples de réglag
|
||||
> 4. Pour un usage naturel, le ``security_default_on_percent`` doit être inférieur à ``security_min_on_percent``,
|
||||
> 5. Les thermostats de type ``thermostat_over_climate`` ne sont pas concernés par le mode security.
|
||||
|
||||
## Le contrôle centralisé
|
||||
Depuis la release 5.2, si vous avez défini une configuration centralisée, vous avez une nouvelle entité nommée `select.central_mode` qui permet de piloter tous les VTherms avec une seule action. Pour qu'un VTherm soit contrôlable de façon centralisée, il faut que son attribut de configuration nommé `use_central_mode` soit vrai.
|
||||
|
||||
Cette entité se présente sous la forme d'une liste de choix qui contient les choix suivants :
|
||||
1. `Auto` : le mode 'normal' dans lequel chaque VTherm se comporte comme dans les versions précédentes,
|
||||
2. `Stooped` : tous les VTherms sont mis à l'arrêt (`hvac_off`),
|
||||
3. `Heat only` : tous les VTherms sont mis en mode chauffage lorsque ce mode est supporté par le VTherm, sinon il est stoppé,
|
||||
3. `Cool only` : tous les VTherms sont mis en mode climatisation lorsque ce mode est supporté par le VTherm, sinon il est stoppé,
|
||||
4. `Frost protection` : tous les VTherms sont mis en preset hors-gel lorsque ce preset est supporté par le VTherm, sinon il est stoppé.
|
||||
|
||||
Il est donc possible de contrôler tous les VTherms (que ceux que l'on désigne explicitement) avec un seul contrôle.
|
||||
Exemple de rendu :
|
||||
|
||||

|
||||
|
||||
## Synthèse des paramètres
|
||||
|
||||
| Paramètre | Libellé | "over switch" | "over climate" | "over valve" | "configuration centrale" |
|
||||
@@ -549,7 +527,6 @@ Exemple de rendu :
|
||||
| ``temp_min`` | Température minimale permise | X | X | X | X |
|
||||
| ``temp_max`` | Température maximale permise | X | X | X | X |
|
||||
| ``device_power`` | Puissance de l'équipement | X | X | X | - |
|
||||
| ``use_central_mode`` | Autorisation du contrôle centralisé | X | X | X | - |
|
||||
| ``use_window_feature`` | Avec détection des ouvertures | X | X | X | - |
|
||||
| ``use_motion_feature`` | Avec détection de mouvement | X | X | X | - |
|
||||
| ``use_power_feature`` | Avec gestion de la puissance | X | X | X | - |
|
||||
@@ -858,8 +835,6 @@ Les attributs personnalisés sont les suivants :
|
||||
| ``valve_open_percent`` | Le pourcentage d'ouverture de la vanne |
|
||||
| ``regulated_target_temperature`` | La température de consigne calculée par l'auto-régulation |
|
||||
| ``is_inversed`` | True si la commande est inversée (fil pilote avec diode) |
|
||||
| ``is_controlled_by_central_mode`` | True si le VTherm peut être controlé de façon centrale |
|
||||
| ``last_central_mode`` | Le dernier mode central utilisé (None si le VTherm n'est pas controlé en central) |
|
||||
|
||||
# Quelques résultats
|
||||
|
||||
@@ -1033,10 +1008,6 @@ Remplacez les valeurs entre [[ ]] par les votres.
|
||||
step: day
|
||||
```
|
||||
|
||||
Exemple de courbes obtenues avec Plotly :
|
||||
|
||||

|
||||
|
||||
## Et toujours de mieux en mieux avec l'AappDaemon NOTIFIER pour notifier les évènements
|
||||
Cette automatisation utilise l'excellente App Daemon nommée NOTIFIER développée par Horizon Domotique que vous trouverez en démonstration [ici](https://www.youtube.com/watch?v=chJylIK0ASo&ab_channel=HorizonDomotique) et le code est [ici](https://github.com/jlpouffier/home-assistant-config/blob/master/appdaemon/apps/notifier.py). Elle permet de notifier les utilisateurs du logement lorsqu'un des évènements touchant à la sécurité survient sur un des Versatile Thermostats.
|
||||
|
||||
|
||||
43
README.md
43
README.md
@@ -34,7 +34,6 @@
|
||||
- [Configure the power management](#configure-the-power-management)
|
||||
- [Configure presence or occupancy](#configure-presence-or-occupancy)
|
||||
- [Advanced configuration](#advanced-configuration)
|
||||
- [Centralized control](#centralized-control)
|
||||
- [Parameters synthesis](#parameters-synthesis)
|
||||
- [Examples tuning](#examples-tuning)
|
||||
- [Electrical heater](#electrical-heater)
|
||||
@@ -75,18 +74,16 @@
|
||||
This custom component for Home Assistant is an upgrade and is a complete rewrite of the component "Awesome thermostat" (see [Github](https://github.com/dadge/awesome_thermostat)) with addition of features.
|
||||
|
||||
> _*News*_
|
||||
> * **Release 5.2**: Added a `central_mode` allowing all VTherms to be controlled centrally [#158](https://github.com/jmcollin78/versatile_thermostat/issues/158).
|
||||
> * **Release 5.1**: Limitation of the values sent to the valves and the temperature sent to the underlying climate.
|
||||
> * **Release 5.0**: Added a central configuration allowing the sharing of attributes that can be shared [#239](https://github.com/jmcollin78/versatile_thermostat/issues/239).
|
||||
> * **Release 4.3**: Added an auto-fan mode for the `over_climate` type allowing ventilation to be activated if the temperature difference is significant [#223](https://github.com/jmcollin78/versatile_thermostat/issues/223).
|
||||
> * **Release 4.2**: The calculation of the slope of the temperature curve is now done in °/hour and no longer in °/min [#242](https://github.com/jmcollin78/versatile_thermostat/issues/242). Correction of automatic detection of openings by adding smoothing of the temperature curve.
|
||||
<details>
|
||||
<summary>Others releases</summary>
|
||||
|
||||
> * **Release 4.1**: Added an **Expert** regulation mode in which the user can specify their own auto-regulation parameters instead of using the pre-programmed ones [#194]( https://github.com/jmcollin78/versatile_thermostat/issues/194).
|
||||
> * **Release 4.0**: Added the support of **Versatile Thermostat UI Card**. See [Versatile Thermostat UI Card](https://github.com/jmcollin78/versatile-thermostat-ui-card). Added a **Slow** regulation mode for slow latency heating devices [#168](https://github.com/jmcollin78/versatile_thermostat/issues/168). Change the way **the power is calculated** in case of VTherm with multi-underlying equipements [#146](https://github.com/jmcollin78/versatile_thermostat/issues/146). Added the support of AC and Heat for VTherm over switch alse [#144](https://github.com/jmcollin78/versatile_thermostat/pull/144)
|
||||
> * **Release 3.8**: Added a **self-regulation function** for `over climate` thermostats whose regulation is done by the underlying climate. See [Self-regulation](#self-regulation) and [#129](https://github.com/jmcollin78/versatile_thermostat/issues/129). Added the possibility of **inverting the command** for an `over switch` thermostat to address installations with pilot wire and diode [#124](https://github.com/jmcollin78/versatile_thermostat/issues/124).
|
||||
> * **Release 3.7**: Addition of the **Versatile Thermostat type `over valve`** to control a TRV valve directly or any other dimmer type equipment for heating. Regulation is then done directly by acting on the opening percentage of the underlying entity: 0 the valve is cut off, 100: the valve is fully opened. See [#131](https://github.com/jmcollin78/versatile_thermostat/issues/131). Added a function allowing the bypass of opening detection [#138](https://github.com/jmcollin78/versatile_thermostat/issues/138). Added Slovak language
|
||||
<details>
|
||||
<summary>Others releases</summary>
|
||||
|
||||
> * **Release 3.6**: Added the `motion_off_delay` parameter to improve motion management [#116](https://github.com/jmcollin78/versatile_thermostat/issues/116), [#128](https://github.com/jmcollin78/versatile_thermostat/issues/128). Added AC (air conditioning) mode for a VTherm over switch. Preparing the Github project to facilitate contributions [#127](https://github.com/jmcollin78/versatile_thermostat/issues/127)
|
||||
> * **Release 3.5**: Multiple thermostats when using "thermostat over another thermostat" mode [#113](https://github.com/jmcollin78/versatile_thermostat/issues/113)
|
||||
> * **Release 3.4**: bug fixes and expose preset temperatures for AC mode [#103](https://github.com/jmcollin78/versatile_thermostat/issues/103)
|
||||
@@ -153,8 +150,7 @@ This component named __Versatile thermostat__ manage the following use cases :
|
||||
- Add **power shedding management** or regulation to avoid exceeding a defined total power. When max power is exceeded, a hidden 'power' preset is set on the climate entity. When power goes below the max, the previous preset is restored.
|
||||
- Add **home presence management**. This feature allows you to dynamically change the temperature of preset considering a occupancy sensor of your home.
|
||||
- Add **services to interact with the thermostat** from others integration: you can force the presence / un-presence using a service, and you can dynamically change the temperature of the presets and change dynamically the safety parameters.
|
||||
- Add sensors to see the internal states of the thermostat,
|
||||
- Centralized control of all Versatile Thermostats to stop them all, switch them all to frost protection, force them into Heating mode (winter), force them into Cooling mode (summer).
|
||||
- Add sensors to see the internal states of the thermostat
|
||||
|
||||
# How to install this incredible Versatile Thermostat ?
|
||||
|
||||
@@ -189,10 +185,7 @@ The configuration can be change through the same interface. Simply select the th
|
||||
Then follow the configurations steps as follow:
|
||||
|
||||
## Minimal configuration update
|
||||
|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
Give the main mandatory attributes:
|
||||
1. a name (will be the name of the integration and also the name of the climate entity)
|
||||
@@ -202,8 +195,7 @@ Give the main mandatory attributes:
|
||||
6. a cycle duration in minutes. On each cycle, the heater will cycle on and then off for a calculated time to reach the target temperature (see [preset](#configure-the-preset-temperature) below). In ```over_climate``` mode, the cycle is only used to carry out basic controls but does not directly regulate the temperature. It's the underlying climate that does it,
|
||||
7. minimum and maximum thermostat temperatures,
|
||||
8. the power of the l'équipement which will activate the power and energy sensors of the device,
|
||||
9. the possibility of controlling the thermostat centrally. Cf [centralized control](#centralized-control),
|
||||
10. the list of features that will be used for this thermostat. Depending on your choices, the following configuration screens will appear or not.
|
||||
9. the list of features that will be used for this thermostat. Depending on your choices, the following configuration screens will appear or not.
|
||||
|
||||
>  _*Notes*_
|
||||
> 1. With the ```thermostat_over_switch``` type, calculation are done at each cycle. So in case of conditions change, you will have to wait for the next cycle to see a change. For this reason, the cycle should not be too long. **5 min is a good value**,
|
||||
@@ -508,21 +500,6 @@ See [example tuning](#examples-tuning) for common tuning examples
|
||||
> 4. For natural usage, the ``security_default_on_percent`` should be less than ``security_min_on_percent``,
|
||||
> 5. Thermostat of type ``thermostat_over_climate`` are not concerned by the safety feature.
|
||||
|
||||
## Centralized control
|
||||
Since release 5.2, if you have defined a centralized configuration, you have a new entity named `select.central_mode` which allows you to control all VTherms with a single action. For a VTherm to be centrally controllable, its configuration attribute named `use_central_mode` must be true.
|
||||
|
||||
This entity is presented in the form of a list of choices which contains the following choices:
|
||||
1. `Auto`: the 'normal' mode in which each VTherm behaves as in previous versions,
|
||||
2. `Stooped`: all VTherms are turned off (`hvac_off`),
|
||||
3. `Heat only`: all VTherms are put in heating mode when this mode is supported by the VTherm, otherwise it is stopped,
|
||||
3. `Cool only`: all VTherms are put in cooling mode when this mode is supported by the VTherm, otherwise it is stopped,
|
||||
4. `Frost protection`: all VTherms are put in frost protection preset when this preset is supported by the VTherm, otherwise it is stopped.
|
||||
|
||||
It is therefore possible to control all VTherms (only those explicitly designated) with a single control.
|
||||
Example rendering:
|
||||
|
||||

|
||||
|
||||
## Parameters synthesis
|
||||
|
||||
| Paramètre | Libellé | "over switch" | "over climate" | "over valve" | "central configuration" |
|
||||
@@ -535,7 +512,6 @@ Example rendering:
|
||||
| ``temp_min`` | Minimal temperature allowed | X | X | X | X |
|
||||
| ``temp_max`` | Maximal temperature allowed | X | X | X | X |
|
||||
| ``device_power`` | Total device power | X | X | X | - |
|
||||
| ``use_central_mode`` | Allow the centralized control | X | X | X | - |
|
||||
| ``use_window_feature`` | Use window detection | X | X | X | - |
|
||||
| ``use_motion_feature`` | Use motion detection | X | X | X | - |
|
||||
| ``use_power_feature`` | Use power management | X | X | X | - |
|
||||
@@ -843,8 +819,6 @@ Custom attributes are the following:
|
||||
| ``valve_open_percent`` | The opening percentage of the valve |
|
||||
| ``regulated_target_temperature`` | The self-regulated target temperature calculated |
|
||||
| ``is_inversed`` | True if the command is inversed (pilot wire with diode) |
|
||||
| ``is_controlled_by_central_mode`` | True if the VTherm can be centrally controlled |
|
||||
| ``last_central_mode`` | The last central mode used (None if the VTherm is not centrally controlled) |
|
||||
|
||||
# Some results
|
||||
|
||||
@@ -1017,11 +991,6 @@ Replace values in [[ ]] by yours.
|
||||
step: day
|
||||
```
|
||||
|
||||
Example of graph obtained with Plotly :
|
||||
|
||||

|
||||
|
||||
|
||||
## And always better and better with the NOTIFIER daemon app to notify events
|
||||
This automation uses the excellent App Daemon named NOTIFIER developed by Horizon Domotique that you will find in demonstration [here](https://www.youtube.com/watch?v=chJylIK0ASo&ab_channel=HorizonDomotique) and the code is [here](https ://github.com/jlpouffier/home-assistant-config/blob/master/appdaemon/apps/notifier.py). It allows you to notify the users of the accommodation when one of the events affecting safety occurs on one of the Versatile Thermostats.
|
||||
|
||||
|
||||
@@ -1247,10 +1247,10 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
# I don't think we need to call async_write_ha_state if we didn't change the state
|
||||
return
|
||||
|
||||
# In safety mode don't change preset but memorise the new expected preset when security will be off
|
||||
# In security mode don't change preset but memorise the new expected preset when security will be off
|
||||
if preset_mode != PRESET_SECURITY and self._security_state:
|
||||
_LOGGER.debug(
|
||||
"%s - is in safety mode. Just memorise the new expected ", self
|
||||
"%s - is in security mode. Just memorise the new expected ", self
|
||||
)
|
||||
if preset_mode not in HIDDEN_PRESETS:
|
||||
self._saved_preset_mode = preset_mode
|
||||
@@ -1475,19 +1475,16 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
else:
|
||||
if not self._window_state:
|
||||
_LOGGER.info(
|
||||
"%s - Window is closed. Restoring hvac_mode '%s' if central_mode is not STOPPED",
|
||||
"%s - Window is closed. Restoring hvac_mode '%s'",
|
||||
self,
|
||||
self._saved_hvac_mode,
|
||||
)
|
||||
if self.last_central_mode != CENTRAL_MODE_STOPPED:
|
||||
await self.restore_hvac_mode(True)
|
||||
await self.restore_hvac_mode(True)
|
||||
elif self._window_state:
|
||||
_LOGGER.info(
|
||||
"%s - Window is open. Set hvac_mode to '%s'", self, HVACMode.OFF
|
||||
)
|
||||
if self.last_central_mode in [CENTRAL_MODE_AUTO, None]:
|
||||
self.save_hvac_mode()
|
||||
|
||||
self.save_hvac_mode()
|
||||
await self.async_set_hvac_mode(HVACMode.OFF)
|
||||
self.update_custom_attributes()
|
||||
|
||||
@@ -1640,7 +1637,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
state.last_changed.astimezone(self._current_tz),
|
||||
)
|
||||
|
||||
# try to restart if we were in safety mode
|
||||
# try to restart if we were in security mode
|
||||
if self._security_state:
|
||||
await self.check_security()
|
||||
|
||||
@@ -1667,7 +1664,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
state.last_changed.astimezone(self._current_tz),
|
||||
)
|
||||
|
||||
# try to restart if we were in safety mode
|
||||
# try to restart if we were in security mode
|
||||
if self._security_state:
|
||||
await self.check_security()
|
||||
except ValueError as ex:
|
||||
@@ -2055,13 +2052,12 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
self.save_hvac_mode()
|
||||
|
||||
if new_central_mode == CENTRAL_MODE_AUTO:
|
||||
if self.window_state is not STATE_ON:
|
||||
await self.restore_hvac_mode()
|
||||
await self.restore_preset_mode()
|
||||
await self.restore_hvac_mode()
|
||||
await self.restore_preset_mode()
|
||||
|
||||
return
|
||||
|
||||
if old_central_mode == CENTRAL_MODE_AUTO and self.window_state is not STATE_ON:
|
||||
if old_central_mode == CENTRAL_MODE_AUTO:
|
||||
save_all()
|
||||
|
||||
if new_central_mode == CENTRAL_MODE_STOPPED:
|
||||
@@ -2161,7 +2157,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
if shouldStartSecurity:
|
||||
if shouldClimateBeInSecurity:
|
||||
_LOGGER.warning(
|
||||
"%s - No temperature received for more than %.1f minutes (dt=%.1f, dext=%.1f) and underlying climate is %s. Setting it into safety mode",
|
||||
"%s - No temperature received for more than %.1f minutes (dt=%.1f, dext=%.1f) and underlying climate is %s. Set it into security mode",
|
||||
self,
|
||||
self._security_delay_min,
|
||||
delta_temp,
|
||||
@@ -2170,13 +2166,13 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
)
|
||||
elif shouldSwitchBeInSecurity:
|
||||
_LOGGER.warning(
|
||||
"%s - No temperature received for more than %.1f minutes (dt=%.1f, dext=%.1f) and on_percent (%.2f %%) is over defined value (%.2f %%). Set it into safety mode",
|
||||
"%s - No temperature received for more than %.1f minutes (dt=%.1f, dext=%.1f) and on_percent (%.2f) is over defined value (%.2f). Set it into security mode",
|
||||
self,
|
||||
self._security_delay_min,
|
||||
delta_temp,
|
||||
delta_ext_temp,
|
||||
self._prop_algorithm.on_percent * 100,
|
||||
self._security_min_on_percent * 100,
|
||||
self._prop_algorithm.on_percent,
|
||||
self._security_min_on_percent,
|
||||
)
|
||||
|
||||
self.send_event(
|
||||
@@ -2194,7 +2190,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
},
|
||||
)
|
||||
|
||||
# Start safety mode
|
||||
# Start security mode
|
||||
if shouldStartSecurity:
|
||||
self._security_state = True
|
||||
self.save_hvac_mode()
|
||||
@@ -2222,10 +2218,10 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
},
|
||||
)
|
||||
|
||||
# Stop safety mode
|
||||
# Stop security mode
|
||||
if shouldStopSecurity:
|
||||
_LOGGER.warning(
|
||||
"%s - End of safety mode. restoring hvac_mode to %s and preset_mode to %s",
|
||||
"%s - End of security mode. restoring hvac_mode to %s and preset_mode to %s",
|
||||
self,
|
||||
self._saved_hvac_mode,
|
||||
self._saved_preset_mode,
|
||||
@@ -2473,11 +2469,11 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
entity_id: climate.thermostat_2
|
||||
"""
|
||||
_LOGGER.info(
|
||||
"%s - Calling service_set_security, delay_min: %s, min_on_percent: %s %%, default_on_percent: %s %%",
|
||||
"%s - Calling service_set_security, delay_min: %s, min_on_percent: %s, default_on_percent: %s",
|
||||
self,
|
||||
delay_min,
|
||||
min_on_percent*100,
|
||||
default_on_percent*100,
|
||||
min_on_percent,
|
||||
default_on_percent,
|
||||
)
|
||||
if delay_min:
|
||||
self._security_delay_min = delay_min
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
"quality_scale": "silver",
|
||||
"requirements": [],
|
||||
"ssdp": [],
|
||||
"version": "5.2.0",
|
||||
"version": "4.3.0",
|
||||
"zeroconf": []
|
||||
}
|
||||
@@ -140,27 +140,27 @@ class PropAlgorithm:
|
||||
self._off_time_sec = self._cycle_min * 60 - self._on_time_sec
|
||||
|
||||
def set_security(self, default_on_percent: float):
|
||||
"""Set a default value for on_percent (used for safety mode)"""
|
||||
"""Set a default value for on_percent (used for security mode)"""
|
||||
self._security = True
|
||||
self._default_on_percent = default_on_percent
|
||||
self._calculate_internal()
|
||||
|
||||
def unset_security(self):
|
||||
"""Unset the safety mode"""
|
||||
"""Unset the security mode"""
|
||||
self._security = False
|
||||
self._calculate_internal()
|
||||
|
||||
@property
|
||||
def on_percent(self) -> float:
|
||||
"""Returns the percentage the heater must be ON
|
||||
In safety mode this value is overriden with the _default_on_percent
|
||||
In security mode this value is overriden with the _default_on_percent
|
||||
(1 means the heater will be always on, 0 never on)""" # pylint: disable=line-too-long
|
||||
return round(self._on_percent, 2)
|
||||
|
||||
@property
|
||||
def calculated_on_percent(self) -> float:
|
||||
"""Returns the calculated percentage the heater must be ON
|
||||
Calculated means NOT overriden even in safety mode
|
||||
Calculated means NOT overriden even in security mode
|
||||
(1 means the heater will be always on, 0 never on)""" # pylint: disable=line-too-long
|
||||
return round(self._calculated_on_percent, 2)
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ class CentralModeSelect(SelectEntity, RestoreEntity):
|
||||
"%s - Calling async_added_to_hass old_state is %s", self, old_state
|
||||
)
|
||||
if old_state is not None:
|
||||
self._attr_current_option = old_state.state
|
||||
self.async_select_option = old_state.state
|
||||
|
||||
@callback
|
||||
async def _async_startup_internal(*_):
|
||||
|
||||
@@ -141,9 +141,8 @@ class UnderlyingEntity:
|
||||
await self.set_hvac_mode(hvac_mode)
|
||||
elif hvac_mode != HVACMode.OFF and not self.is_device_active:
|
||||
_LOGGER.warning(
|
||||
"%s - The hvac mode is %s, but the underlying device is not ON. Turning on device %s if needed",
|
||||
"%s - The hvac mode is ON, but the underlying device is not ON. Turning on device %s",
|
||||
self,
|
||||
hvac_mode,
|
||||
self._entity_id,
|
||||
)
|
||||
await self.set_hvac_mode(hvac_mode)
|
||||
@@ -355,7 +354,7 @@ class UnderlyingSwitch(UnderlyingEntity):
|
||||
if await self._thermostat.check_overpowering():
|
||||
_LOGGER.debug("%s - End of cycle (3)", self)
|
||||
return
|
||||
# safety mode could have change the on_time percent
|
||||
# Security mode could have change the on_time percent
|
||||
await self._thermostat.check_security()
|
||||
time = self._on_time_sec
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 40 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 50 KiB |
@@ -358,7 +358,7 @@ async def test_bug_82(
|
||||
skip_turn_on_off_heater,
|
||||
skip_send_event,
|
||||
):
|
||||
"""Test that when a underlying climate is not available the VTherm doesn't go into safety mode"""
|
||||
"""Test that when a underlying climate is not available the VTherm doesn't go into security mode"""
|
||||
|
||||
tz = get_tz(hass) # pylint: disable=invalid-name
|
||||
now: datetime = datetime.now(tz=tz)
|
||||
@@ -427,7 +427,7 @@ async def test_bug_82(
|
||||
assert mock_find_climate.mock_calls[0] == call()
|
||||
mock_find_climate.assert_has_calls([call.find_underlying_entity()])
|
||||
|
||||
# Force safety mode
|
||||
# Force security mode
|
||||
assert entity._last_ext_temperature_measure is not None
|
||||
assert entity._last_temperature_measure is not None
|
||||
assert (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# pylint: disable=wildcard-import, unused-wildcard-import, protected-access, unused-argument, line-too-long, too-many-lines
|
||||
# pylint: disable=wildcard-import, unused-wildcard-import, protected-access, unused-argument, line-too-long
|
||||
|
||||
""" Test the central_configuration """
|
||||
from unittest.mock import patch, call
|
||||
from unittest.mock import patch # , call
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
# from datetime import datetime # , timedelta
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
@@ -732,309 +732,3 @@ async def test_climate_ac_only_change_central_mode_true(
|
||||
# No change
|
||||
assert entity.hvac_mode == HVACMode.COOL
|
||||
assert entity.preset_mode == PRESET_ECO
|
||||
|
||||
|
||||
async def test_switch_change_central_mode_true_with_window(
|
||||
hass: HomeAssistant, skip_hass_states_is_state, init_central_config
|
||||
):
|
||||
"""test that changes with over_switch config with central_mode True are
|
||||
taken into account"""
|
||||
|
||||
# Add a Switch VTherm
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
title="TheOverSwitchMockName",
|
||||
unique_id="uniqueId",
|
||||
data={
|
||||
CONF_NAME: "TheOverSwitchMockName",
|
||||
CONF_THERMOSTAT_TYPE: CONF_THERMOSTAT_SWITCH,
|
||||
CONF_TEMP_SENSOR: "sensor.mock_temp_sensor",
|
||||
CONF_EXTERNAL_TEMP_SENSOR: "sensor.mock_ext_temp_sensor",
|
||||
CONF_USE_CENTRAL_MODE: True,
|
||||
CONF_CYCLE_MIN: 5,
|
||||
CONF_TEMP_MIN: 8,
|
||||
CONF_TEMP_MAX: 18,
|
||||
"frost_temp": 10,
|
||||
"eco_temp": 17,
|
||||
"comfort_temp": 18,
|
||||
"boost_temp": 21,
|
||||
CONF_USE_WINDOW_FEATURE: True,
|
||||
CONF_USE_MOTION_FEATURE: True,
|
||||
CONF_USE_POWER_FEATURE: False,
|
||||
CONF_USE_PRESENCE_FEATURE: False,
|
||||
CONF_HEATER: "switch.mock_switch",
|
||||
CONF_PROP_FUNCTION: PROPORTIONAL_FUNCTION_TPI,
|
||||
CONF_TPI_COEF_INT: 0.3,
|
||||
CONF_TPI_COEF_EXT: 0.01,
|
||||
CONF_MINIMAL_ACTIVATION_DELAY: 30,
|
||||
CONF_SECURITY_DELAY_MIN: 5,
|
||||
CONF_SECURITY_MIN_ON_PERCENT: 0.3,
|
||||
CONF_SECURITY_DEFAULT_ON_PERCENT: 0.1,
|
||||
CONF_WINDOW_SENSOR: "binary_sensor.window_sensor",
|
||||
CONF_WINDOW_DELAY: 0, # To be not obliged to wait
|
||||
CONF_MOTION_SENSOR: "input_boolean.motion_sensor",
|
||||
CONF_MOTION_DELAY: 10,
|
||||
CONF_MOTION_OFF_DELAY: 30,
|
||||
CONF_MOTION_PRESET: PRESET_BOOST,
|
||||
CONF_NO_MOTION_PRESET: PRESET_ECO,
|
||||
},
|
||||
)
|
||||
|
||||
tz = get_tz(hass) # pylint: disable=invalid-name
|
||||
event_timestamp = datetime.now(tz)
|
||||
|
||||
# 1 initialize entity and find select entity
|
||||
with patch("homeassistant.core.ServiceRegistry.async_call"):
|
||||
entity: ThermostatOverSwitch = await create_thermostat(
|
||||
hass, entry, "climate.theoverswitchmockname"
|
||||
)
|
||||
assert entity
|
||||
assert entity.is_controlled_by_central_mode
|
||||
assert entity.last_central_mode is None
|
||||
|
||||
# Find the select entity
|
||||
select_entity = search_entity(hass, "select.central_mode", SELECT_DOMAIN)
|
||||
|
||||
assert select_entity
|
||||
assert select_entity.current_option == CENTRAL_MODE_AUTO
|
||||
assert select_entity.options == CENTRAL_MODES
|
||||
|
||||
# start entity
|
||||
await entity.async_set_hvac_mode(HVACMode.HEAT)
|
||||
await entity.async_set_preset_mode(PRESET_ACTIVITY)
|
||||
|
||||
assert entity.hvac_mode == HVACMode.HEAT
|
||||
assert entity.preset_mode == PRESET_ACTIVITY
|
||||
assert entity.window_state is STATE_OFF
|
||||
|
||||
# 2 Open the window
|
||||
with patch(
|
||||
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.send_event"
|
||||
) as mock_send_event, patch(
|
||||
"homeassistant.helpers.condition.state", return_value=True
|
||||
):
|
||||
event_timestamp = event_timestamp + timedelta(minutes=1)
|
||||
try_function = await send_window_change_event(
|
||||
entity, True, False, event_timestamp
|
||||
)
|
||||
|
||||
await try_function(None)
|
||||
|
||||
assert mock_send_event.call_count == 1
|
||||
mock_send_event.assert_has_calls(
|
||||
[call.send_event(EventType.HVAC_MODE_EVENT, {"hvac_mode": HVACMode.OFF})]
|
||||
)
|
||||
|
||||
assert entity.hvac_mode == HVACMode.OFF
|
||||
assert entity.preset_mode == PRESET_ACTIVITY
|
||||
assert entity._saved_hvac_mode == HVACMode.HEAT
|
||||
assert entity._saved_preset_mode == PRESET_ACTIVITY
|
||||
assert entity.window_state is STATE_ON
|
||||
|
||||
# 3 Change central_mode to STOPPED
|
||||
with patch("homeassistant.core.ServiceRegistry.async_call"):
|
||||
event_timestamp = event_timestamp + timedelta(minutes=1)
|
||||
entity._set_now(event_timestamp)
|
||||
|
||||
await select_entity.async_select_option(CENTRAL_MODE_STOPPED)
|
||||
|
||||
assert entity.last_central_mode is CENTRAL_MODE_STOPPED
|
||||
# No change
|
||||
assert entity.hvac_mode == HVACMode.OFF
|
||||
assert entity.preset_mode == PRESET_ACTIVITY
|
||||
assert entity._saved_hvac_mode == HVACMode.HEAT
|
||||
assert entity._saved_preset_mode == PRESET_ACTIVITY
|
||||
|
||||
# 4 Close the window
|
||||
with patch(
|
||||
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.send_event"
|
||||
) as mock_send_event, patch(
|
||||
"homeassistant.helpers.condition.state", return_value=True
|
||||
):
|
||||
event_timestamp = event_timestamp + timedelta(minutes=1)
|
||||
try_function = await send_window_change_event(
|
||||
entity, False, True, event_timestamp
|
||||
)
|
||||
|
||||
await try_function(None)
|
||||
|
||||
# No hvac_mode change cause the central mode is STOPPED
|
||||
assert mock_send_event.call_count == 0
|
||||
|
||||
# We should stay off because central is STOPPED
|
||||
assert entity.hvac_mode == HVACMode.OFF
|
||||
assert entity.preset_mode == PRESET_ACTIVITY
|
||||
assert entity._saved_hvac_mode == HVACMode.HEAT
|
||||
assert entity._saved_preset_mode == PRESET_ACTIVITY
|
||||
assert entity.window_state is STATE_OFF
|
||||
|
||||
# 5 Back to Auto
|
||||
with patch(
|
||||
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.send_event"
|
||||
) as mock_send_event:
|
||||
event_timestamp = event_timestamp + timedelta(minutes=1)
|
||||
|
||||
await select_entity.async_select_option(CENTRAL_MODE_AUTO)
|
||||
|
||||
assert mock_send_event.call_count == 1
|
||||
mock_send_event.assert_has_calls(
|
||||
[call.send_event(EventType.HVAC_MODE_EVENT, {"hvac_mode": HVACMode.HEAT})]
|
||||
)
|
||||
|
||||
# We should switch back to HEAT
|
||||
assert entity.hvac_mode == HVACMode.HEAT
|
||||
assert entity.preset_mode == PRESET_ACTIVITY
|
||||
assert entity._saved_hvac_mode == HVACMode.HEAT
|
||||
assert entity._saved_preset_mode == PRESET_ACTIVITY
|
||||
assert entity.window_state is STATE_OFF
|
||||
|
||||
|
||||
async def test_switch_change_central_mode_true_with_cool_only_and_window(
|
||||
hass: HomeAssistant, skip_hass_states_is_state, init_central_config
|
||||
):
|
||||
"""test that changes with over_switch config with central_mode True are
|
||||
taken into account"""
|
||||
|
||||
# Add a Switch VTherm
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
title="TheOverSwitchMockName",
|
||||
unique_id="uniqueId",
|
||||
data={
|
||||
CONF_NAME: "TheOverSwitchMockName",
|
||||
CONF_THERMOSTAT_TYPE: CONF_THERMOSTAT_SWITCH,
|
||||
CONF_TEMP_SENSOR: "sensor.mock_temp_sensor",
|
||||
CONF_EXTERNAL_TEMP_SENSOR: "sensor.mock_ext_temp_sensor",
|
||||
CONF_USE_CENTRAL_MODE: True,
|
||||
CONF_CYCLE_MIN: 5,
|
||||
CONF_TEMP_MIN: 8,
|
||||
CONF_TEMP_MAX: 18,
|
||||
"frost_temp": 10,
|
||||
"eco_temp": 17,
|
||||
"comfort_temp": 18,
|
||||
"boost_temp": 21,
|
||||
CONF_USE_WINDOW_FEATURE: True,
|
||||
CONF_USE_MOTION_FEATURE: True,
|
||||
CONF_USE_POWER_FEATURE: False,
|
||||
CONF_USE_PRESENCE_FEATURE: False,
|
||||
CONF_HEATER: "switch.mock_switch",
|
||||
CONF_PROP_FUNCTION: PROPORTIONAL_FUNCTION_TPI,
|
||||
CONF_TPI_COEF_INT: 0.3,
|
||||
CONF_TPI_COEF_EXT: 0.01,
|
||||
CONF_MINIMAL_ACTIVATION_DELAY: 30,
|
||||
CONF_SECURITY_DELAY_MIN: 5,
|
||||
CONF_SECURITY_MIN_ON_PERCENT: 0.3,
|
||||
CONF_SECURITY_DEFAULT_ON_PERCENT: 0.1,
|
||||
CONF_WINDOW_SENSOR: "binary_sensor.window_sensor",
|
||||
CONF_WINDOW_DELAY: 0, # To be not obliged to wait
|
||||
CONF_MOTION_SENSOR: "input_boolean.motion_sensor",
|
||||
CONF_MOTION_DELAY: 10,
|
||||
CONF_MOTION_OFF_DELAY: 30,
|
||||
CONF_MOTION_PRESET: PRESET_BOOST,
|
||||
CONF_NO_MOTION_PRESET: PRESET_ECO,
|
||||
},
|
||||
)
|
||||
|
||||
tz = get_tz(hass) # pylint: disable=invalid-name
|
||||
event_timestamp = datetime.now(tz)
|
||||
|
||||
# 1 initialize entity and find select entity
|
||||
with patch("homeassistant.core.ServiceRegistry.async_call"):
|
||||
entity: ThermostatOverSwitch = await create_thermostat(
|
||||
hass, entry, "climate.theoverswitchmockname"
|
||||
)
|
||||
assert entity
|
||||
assert entity.is_controlled_by_central_mode
|
||||
assert entity.last_central_mode is None
|
||||
|
||||
# Find the select entity
|
||||
select_entity = search_entity(hass, "select.central_mode", SELECT_DOMAIN)
|
||||
|
||||
assert select_entity
|
||||
assert select_entity.current_option == CENTRAL_MODE_AUTO
|
||||
assert select_entity.options == CENTRAL_MODES
|
||||
|
||||
# start entity
|
||||
await entity.async_set_hvac_mode(HVACMode.HEAT)
|
||||
await entity.async_set_preset_mode(PRESET_ACTIVITY)
|
||||
|
||||
assert entity.hvac_mode == HVACMode.HEAT
|
||||
assert entity.preset_mode == PRESET_ACTIVITY
|
||||
assert entity.window_state is STATE_OFF
|
||||
|
||||
# 2 Change central_mode to COOL_ONLY
|
||||
with patch("homeassistant.core.ServiceRegistry.async_call"):
|
||||
event_timestamp = event_timestamp + timedelta(minutes=1)
|
||||
entity._set_now(event_timestamp)
|
||||
|
||||
await select_entity.async_select_option(CENTRAL_MODE_COOL_ONLY)
|
||||
|
||||
assert entity.last_central_mode is CENTRAL_MODE_COOL_ONLY
|
||||
await entity.async_set_hvac_mode(HVACMode.OFF)
|
||||
await entity.async_set_preset_mode(PRESET_ACTIVITY)
|
||||
assert entity._saved_hvac_mode == HVACMode.HEAT
|
||||
assert entity._saved_preset_mode == PRESET_ACTIVITY
|
||||
|
||||
# 3 Open the window
|
||||
with patch(
|
||||
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.send_event"
|
||||
) as mock_send_event, patch(
|
||||
"homeassistant.helpers.condition.state", return_value=True
|
||||
):
|
||||
event_timestamp = event_timestamp + timedelta(minutes=1)
|
||||
try_function = await send_window_change_event(
|
||||
entity, True, False, event_timestamp
|
||||
)
|
||||
|
||||
await try_function(None)
|
||||
|
||||
assert mock_send_event.call_count == 1
|
||||
mock_send_event.assert_has_calls(
|
||||
[call.send_event(EventType.HVAC_MODE_EVENT, {"hvac_mode": HVACMode.OFF})]
|
||||
)
|
||||
|
||||
assert entity.hvac_mode == HVACMode.OFF
|
||||
assert entity.preset_mode == PRESET_ACTIVITY
|
||||
assert entity._saved_hvac_mode == HVACMode.HEAT
|
||||
assert entity._saved_preset_mode == PRESET_ACTIVITY
|
||||
assert entity.window_state is STATE_ON
|
||||
|
||||
# 4 Change central_mode to AUTO
|
||||
with patch("homeassistant.core.ServiceRegistry.async_call"):
|
||||
event_timestamp = event_timestamp + timedelta(minutes=1)
|
||||
entity._set_now(event_timestamp)
|
||||
|
||||
await select_entity.async_select_option(CENTRAL_MODE_AUTO)
|
||||
|
||||
assert entity.last_central_mode is CENTRAL_MODE_AUTO
|
||||
# No change
|
||||
assert entity.hvac_mode == HVACMode.OFF
|
||||
assert entity.preset_mode == PRESET_ACTIVITY
|
||||
assert entity._saved_hvac_mode == HVACMode.HEAT
|
||||
assert entity._saved_preset_mode == PRESET_ACTIVITY
|
||||
|
||||
# 5 Close the window
|
||||
with patch(
|
||||
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.send_event"
|
||||
) as mock_send_event, patch(
|
||||
"homeassistant.helpers.condition.state", return_value=True
|
||||
):
|
||||
event_timestamp = event_timestamp + timedelta(minutes=1)
|
||||
try_function = await send_window_change_event(
|
||||
entity, False, True, event_timestamp
|
||||
)
|
||||
|
||||
await try_function(None)
|
||||
|
||||
# hvac_mode change to HEAT
|
||||
assert mock_send_event.call_count == 1
|
||||
mock_send_event.assert_has_calls(
|
||||
[call.send_event(EventType.HVAC_MODE_EVENT, {"hvac_mode": HVACMode.HEAT})]
|
||||
)
|
||||
|
||||
# We should stay off because central is STOPPED
|
||||
assert entity.hvac_mode == HVACMode.HEAT
|
||||
assert entity.preset_mode == PRESET_ACTIVITY
|
||||
assert entity._saved_hvac_mode == HVACMode.HEAT
|
||||
assert entity._saved_preset_mode == PRESET_ACTIVITY
|
||||
assert entity.window_state is STATE_OFF
|
||||
|
||||
@@ -288,7 +288,7 @@ async def test_security_feature_back_on_percent(
|
||||
assert entity.security_state is False
|
||||
assert mock_send_event.call_count == 0
|
||||
|
||||
# 3. Set safety mode with a preset change
|
||||
# 3. Set security mode with a preset change
|
||||
with patch(
|
||||
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.send_event"
|
||||
) as mock_send_event, patch(
|
||||
@@ -400,7 +400,7 @@ async def test_security_over_climate(
|
||||
skip_turn_on_off_heater,
|
||||
skip_send_event,
|
||||
):
|
||||
"""Test that when a underlying climate is not available the VTherm doesn't go into safety mode"""
|
||||
"""Test that when a underlying climate is not available the VTherm doesn't go into security mode"""
|
||||
|
||||
tz = get_tz(hass) # pylint: disable=invalid-name
|
||||
now: datetime = datetime.now(tz=tz)
|
||||
@@ -471,7 +471,7 @@ async def test_security_over_climate(
|
||||
assert mock_find_climate.mock_calls[0] == call()
|
||||
mock_find_climate.assert_has_calls([call.find_underlying_entity()])
|
||||
|
||||
# Force safety mode
|
||||
# Force security mode
|
||||
assert entity._last_ext_temperature_measure is not None
|
||||
assert entity._last_temperature_measure is not None
|
||||
assert (
|
||||
@@ -505,7 +505,7 @@ async def test_security_over_climate(
|
||||
event_timestamp = now - timedelta(minutes=6)
|
||||
|
||||
await send_temperature_change_event(entity, 15, event_timestamp)
|
||||
# Should stay False because a climate is never in safety mode
|
||||
# Should stay False because a climate is never in security mode
|
||||
assert entity.security_state is False
|
||||
assert entity.preset_mode == "none"
|
||||
assert entity._saved_preset_mode == "none"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# pylint: disable=unused-argument, line-too-long, protected-access, too-many-lines
|
||||
# pylint: disable=unused-argument, line-too-long, protected-access
|
||||
""" Test the Window management """
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
Reference in New Issue
Block a user