Resolve devcontainers warnings

This commit is contained in:
Jean-Marc Collin
2023-11-06 15:58:09 +00:00
parent e08f51b4f2
commit a6a47fde53
4 changed files with 75 additions and 64 deletions

View File

@@ -21,7 +21,9 @@
"ms-python.python",
"github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance"
"ms-python.black-formatter",
"ms-python.pylint",
"ferrierbenjamin.fold-unfold-all-icone"
],
// "mounts": [
// "source=${localWorkspaceFolder}/.devcontainer/configuration.yaml,target=${localWorkspaceFolder}/config/www/community/,type=bind,consistency=cached",
@@ -40,8 +42,7 @@
// "terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/bin/python3",
"python.analysis.autoSearchPaths": true,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"pylint.lintOnChange": true,
"python.formatting.provider": "black",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"editor.formatOnPaste": false,

View File

@@ -1,9 +1,9 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.python"
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"pylint.lintOnChange": true,
"files.associations": {
"*.yaml": "home-assistant"
},

View File

@@ -51,7 +51,7 @@
- [Attributs personnalisés](#attributs-personnalisés)
- [Quelques résultats](#quelques-résultats)
- [Encore mieux](#encore-mieux)
- [Bien mieux avec le Veersatile Thermostat UI Card](#bien-mieux-avec-le-veersatile-thermostat-ui-card)
- [Bien mieux avec le Versatile Thermostat UI Card](#bien-mieux-avec-le-versatile-thermostat-ui-card)
- [Encore mieux avec le composant Scheduler !](#encore-mieux-avec-le-composant-scheduler-)
- [Encore bien mieux avec la custom:simple-thermostat front integration](#encore-bien-mieux-avec-la-customsimple-thermostat-front-integration)
- [Toujours mieux avec Apex-chart pour régler votre thermostat](#toujours-mieux-avec-apex-chart-pour-régler-votre-thermostat)
@@ -735,7 +735,7 @@ Enjoy !
# Encore mieux
## Bien mieux avec le Veersatile Thermostat UI Card
## Bien mieux avec le Versatile Thermostat UI Card
Une carte spéciale pour le Versatile Thermostat a été développée (sur la base du Better Thermostat). Elle est dispo ici [Versatile Thermostat UI Card](https://github.com/jmcollin78/versatile-thermostat-ui-card) et propose une vision moderne de tous les status du VTherm :
![image](https://github.com/jmcollin78/versatile-thermostat-ui-card/blob/master/assets/1.png?raw=true)

View File

@@ -130,47 +130,50 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
_motion_state: bool
_presence_state: bool
_window_auto_state: bool
#PR - Adding Window ByPass
_window_bypass_state: bool
_underlyings: list[UnderlyingEntity]
_last_change_time: datetime
_entity_component_unrecorded_attributes = ClimateEntity._entity_component_unrecorded_attributes.union(frozenset(
{
"type",
"eco_temp",
"boost_temp",
"comfort_temp",
"eco_away_temp",
"boost_away_temp",
"comfort_away_temp",
"power_temp",
"ac_mode",
"current_power_max",
"saved_preset_mode",
"saved_target_temp",
"saved_hvac_mode",
"security_delay_min",
"security_min_on_percent",
"security_default_on_percent",
"last_temperature_datetime",
"last_ext_temperature_datetime",
"minimal_activation_delay_sec",
"device_power",
"mean_cycle_power",
"last_update_datetime",
"timezone",
"window_sensor_entity_id",
"window_delay_sec",
"window_auto_open_threshold",
"window_auto_close_threshold",
"window_auto_max_duration",
"motion_sensor_entity_id",
"presence_sensor_entity_id",
"power_sensor_entity_id",
"max_power_sensor_entity_id",
}
))
_entity_component_unrecorded_attributes = (
ClimateEntity._entity_component_unrecorded_attributes.union(
frozenset(
{
"type",
"eco_temp",
"boost_temp",
"comfort_temp",
"eco_away_temp",
"boost_away_temp",
"comfort_away_temp",
"power_temp",
"ac_mode",
"current_power_max",
"saved_preset_mode",
"saved_target_temp",
"saved_hvac_mode",
"security_delay_min",
"security_min_on_percent",
"security_default_on_percent",
"last_temperature_datetime",
"last_ext_temperature_datetime",
"minimal_activation_delay_sec",
"device_power",
"mean_cycle_power",
"last_update_datetime",
"timezone",
"window_sensor_entity_id",
"window_delay_sec",
"window_auto_open_threshold",
"window_auto_close_threshold",
"window_auto_max_duration",
"motion_sensor_entity_id",
"presence_sensor_entity_id",
"power_sensor_entity_id",
"max_power_sensor_entity_id",
}
)
)
)
def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None:
"""Initialize the thermostat."""
@@ -621,7 +624,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
STATE_UNAVAILABLE,
STATE_UNKNOWN,
):
self._window_state = (window_state.state == STATE_ON)
self._window_state = window_state.state == STATE_ON
_LOGGER.debug(
"%s - Window state have been retrieved: %s",
self,
@@ -762,17 +765,17 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
@property
def is_over_climate(self) -> bool:
""" True if the Thermostat is over_climate"""
"""True if the Thermostat is over_climate"""
return False
@property
def is_over_switch(self) -> bool:
""" True if the Thermostat is over_switch"""
"""True if the Thermostat is over_switch"""
return False
@property
def is_over_valve(self) -> bool:
""" True if the Thermostat is over_valve"""
"""True if the Thermostat is over_valve"""
return False
@property
@@ -933,10 +936,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
if not self._device_power:
return None
return float(
self._device_power
* self._prop_algorithm.on_percent
)
return float(self._device_power * self._prop_algorithm.on_percent)
@property
def total_energy(self) -> float | None:
@@ -963,7 +963,6 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
"""Get the window_auto_state"""
return STATE_ON if self._window_auto_state else STATE_OFF
#PR - Adding Window ByPass
@property
def window_bypass_state(self) -> bool | None:
"""Get the Window Bypass"""
@@ -1219,7 +1218,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
async def _async_internal_set_temperature(self, temperature):
"""Set the target temperature and the target temperature of underlying climate if any
For testing purpose you can pass an event_timestamp.
For testing purpose you can pass an event_timestamp.
"""
self._target_temp = temperature
return
@@ -1307,7 +1306,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
_LOGGER.debug(
"Window delay condition is not satisfied. Ignore window event"
)
self._window_state = (old_state.state == STATE_ON)
self._window_state = old_state.state == STATE_ON
return
_LOGGER.debug("%s - Window delay condition is satisfied", self)
@@ -1318,13 +1317,14 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
_LOGGER.debug("%s - no change in window state. Forget the event")
return
self._window_state = new_state.state == STATE_ON
self._window_state = (new_state.state == STATE_ON)
#PR - Adding Window ByPass
# PR - Adding Window ByPass
_LOGGER.debug("%s - Window ByPass is : %s", self, self._window_bypass_state)
if self._window_bypass_state:
_LOGGER.info("%s - Window ByPass is activated. Ignore window event", self)
_LOGGER.info(
"%s - Window ByPass is activated. Ignore window event", self
)
else:
if not self._window_state:
_LOGGER.info(
@@ -2129,7 +2129,6 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
"overpowering_state": self.overpowering_state,
"presence_state": self._presence_state,
"window_auto_state": self.window_auto_state,
#PR - Adding Window ByPass
"window_bypass_state": self._window_bypass_state,
"security_delay_min": self._security_delay_min,
"security_min_on_percent": self._security_min_on_percent,
@@ -2256,14 +2255,25 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
target:
entity_id: climate.thermostat_1
"""
_LOGGER.info("%s - Calling service_set_window_bypass, window_bypass: %s", self, window_bypass)
_LOGGER.info(
"%s - Calling service_set_window_bypass, window_bypass: %s",
self,
window_bypass,
)
self._window_bypass_state = window_bypass
if not self._window_bypass_state and self._window_state:
_LOGGER.info("%s - Last window state was open & ByPass is now off. Set hvac_mode to '%s'", self, HVACMode.OFF)
_LOGGER.info(
"%s - Last window state was open & ByPass is now off. Set hvac_mode to '%s'",
self,
HVACMode.OFF,
)
self.save_hvac_mode()
await self.async_set_hvac_mode(HVACMode.OFF)
if self._window_bypass_state and self._window_state:
_LOGGER.info("%s - Last window state was open & ByPass is now on. Set hvac_mode to last available mode", self)
_LOGGER.info(
"%s - Last window state was open & ByPass is now on. Set hvac_mode to last available mode",
self,
)
await self.restore_hvac_mode(True)
self.update_custom_attributes()