Issue #174 - regression following PR#150
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
// "terminal.integrated.shell.linux": "/bin/bash",
|
// "terminal.integrated.shell.linux": "/bin/bash",
|
||||||
"python.pythonPath": "/usr/bin/python3",
|
"python.pythonPath": "/usr/bin/python3",
|
||||||
"python.analysis.autoSearchPaths": true,
|
"python.analysis.autoSearchPaths": true,
|
||||||
"pylint.lintOnChange": true,
|
"pylint.lintOnChange": false,
|
||||||
"python.formatting.provider": "black",
|
"python.formatting.provider": "black",
|
||||||
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
|
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
|
||||||
"editor.formatOnPaste": false,
|
"editor.formatOnPaste": false,
|
||||||
|
|||||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -3,7 +3,7 @@
|
|||||||
"editor.defaultFormatter": "ms-python.black-formatter",
|
"editor.defaultFormatter": "ms-python.black-formatter",
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
},
|
},
|
||||||
"pylint.lintOnChange": true,
|
"pylint.lintOnChange": false,
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.yaml": "home-assistant"
|
"*.yaml": "home-assistant"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1827,7 +1827,15 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
|||||||
self._device_power,
|
self._device_power,
|
||||||
)
|
)
|
||||||
|
|
||||||
ret = (self._current_power + self._device_power) >= self._current_power_max
|
if self.is_over_climate:
|
||||||
|
power_consumption_max = self._device_power
|
||||||
|
else:
|
||||||
|
power_consumption_max = max(
|
||||||
|
self._device_power / self.nb_underlying_entities,
|
||||||
|
self._device_power * self._prop_algorithm.on_percent,
|
||||||
|
)
|
||||||
|
|
||||||
|
ret = (self._current_power + power_consumption_max) >= self._current_power_max
|
||||||
if not self._overpowering_state and ret and self._hvac_mode != HVACMode.OFF:
|
if not self._overpowering_state and ret and self._hvac_mode != HVACMode.OFF:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"%s - overpowering is detected. Heater preset will be set to 'power'",
|
"%s - overpowering is detected. Heater preset will be set to 'power'",
|
||||||
@@ -1845,6 +1853,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
|||||||
"current_power": self._current_power,
|
"current_power": self._current_power,
|
||||||
"device_power": self._device_power,
|
"device_power": self._device_power,
|
||||||
"current_power_max": self._current_power_max,
|
"current_power_max": self._current_power_max,
|
||||||
|
"current_power_consumption": power_consumption_max,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,11 @@ from unittest.mock import patch, call
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from custom_components.versatile_thermostat.thermostat_switch import ThermostatOverSwitch
|
from custom_components.versatile_thermostat.thermostat_switch import (
|
||||||
|
ThermostatOverSwitch,
|
||||||
|
)
|
||||||
from .commons import * # pylint: disable=wildcard-import, unused-wildcard-import
|
from .commons import * # pylint: disable=wildcard-import, unused-wildcard-import
|
||||||
|
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
@@ -185,6 +188,7 @@ async def test_power_management_hvac_on(hass: HomeAssistant, skip_hass_states_is
|
|||||||
"current_power": 50,
|
"current_power": 50,
|
||||||
"device_power": 100,
|
"device_power": 100,
|
||||||
"current_power_max": 149,
|
"current_power_max": 149,
|
||||||
|
"current_power_consumption": 100.0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user