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", "ms-python.python",
"github.vscode-pull-request-github", "github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters", "ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance" "ms-python.black-formatter",
"ms-python.pylint",
"ferrierbenjamin.fold-unfold-all-icone"
], ],
// "mounts": [ // "mounts": [
// "source=${localWorkspaceFolder}/.devcontainer/configuration.yaml,target=${localWorkspaceFolder}/config/www/community/,type=bind,consistency=cached", // "source=${localWorkspaceFolder}/.devcontainer/configuration.yaml,target=${localWorkspaceFolder}/config/www/community/,type=bind,consistency=cached",
@@ -40,8 +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,
"python.linting.pylintEnabled": true, "pylint.lintOnChange": true,
"python.linting.enabled": true,
"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,

View File

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

View File

@@ -51,7 +51,7 @@
- [Attributs personnalisés](#attributs-personnalisés) - [Attributs personnalisés](#attributs-personnalisés)
- [Quelques résultats](#quelques-résultats) - [Quelques résultats](#quelques-résultats)
- [Encore mieux](#encore-mieux) - [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 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) - [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) - [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 # 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 : 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) ![image](https://github.com/jmcollin78/versatile-thermostat-ui-card/blob/master/assets/1.png?raw=true)

View File

@@ -130,12 +130,13 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
_motion_state: bool _motion_state: bool
_presence_state: bool _presence_state: bool
_window_auto_state: bool _window_auto_state: bool
#PR - Adding Window ByPass
_window_bypass_state: bool _window_bypass_state: bool
_underlyings: list[UnderlyingEntity] _underlyings: list[UnderlyingEntity]
_last_change_time: datetime _last_change_time: datetime
_entity_component_unrecorded_attributes = ClimateEntity._entity_component_unrecorded_attributes.union(frozenset( _entity_component_unrecorded_attributes = (
ClimateEntity._entity_component_unrecorded_attributes.union(
frozenset(
{ {
"type", "type",
"eco_temp", "eco_temp",
@@ -170,7 +171,9 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
"power_sensor_entity_id", "power_sensor_entity_id",
"max_power_sensor_entity_id", "max_power_sensor_entity_id",
} }
)) )
)
)
def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None: def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None:
"""Initialize the thermostat.""" """Initialize the thermostat."""
@@ -621,7 +624,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
STATE_UNAVAILABLE, STATE_UNAVAILABLE,
STATE_UNKNOWN, STATE_UNKNOWN,
): ):
self._window_state = (window_state.state == STATE_ON) self._window_state = window_state.state == STATE_ON
_LOGGER.debug( _LOGGER.debug(
"%s - Window state have been retrieved: %s", "%s - Window state have been retrieved: %s",
self, self,
@@ -762,17 +765,17 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
@property @property
def is_over_climate(self) -> bool: def is_over_climate(self) -> bool:
""" True if the Thermostat is over_climate""" """True if the Thermostat is over_climate"""
return False return False
@property @property
def is_over_switch(self) -> bool: def is_over_switch(self) -> bool:
""" True if the Thermostat is over_switch""" """True if the Thermostat is over_switch"""
return False return False
@property @property
def is_over_valve(self) -> bool: def is_over_valve(self) -> bool:
""" True if the Thermostat is over_valve""" """True if the Thermostat is over_valve"""
return False return False
@property @property
@@ -933,10 +936,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
if not self._device_power: if not self._device_power:
return None return None
return float( return float(self._device_power * self._prop_algorithm.on_percent)
self._device_power
* self._prop_algorithm.on_percent
)
@property @property
def total_energy(self) -> float | None: def total_energy(self) -> float | None:
@@ -963,7 +963,6 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
"""Get the window_auto_state""" """Get the window_auto_state"""
return STATE_ON if self._window_auto_state else STATE_OFF return STATE_ON if self._window_auto_state else STATE_OFF
#PR - Adding Window ByPass
@property @property
def window_bypass_state(self) -> bool | None: def window_bypass_state(self) -> bool | None:
"""Get the Window Bypass""" """Get the Window Bypass"""
@@ -1307,7 +1306,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
_LOGGER.debug( _LOGGER.debug(
"Window delay condition is not satisfied. Ignore window event" "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 return
_LOGGER.debug("%s - Window delay condition is satisfied", self) _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") _LOGGER.debug("%s - no change in window state. Forget the event")
return 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) _LOGGER.debug("%s - Window ByPass is : %s", self, self._window_bypass_state)
if 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: else:
if not self._window_state: if not self._window_state:
_LOGGER.info( _LOGGER.info(
@@ -2129,7 +2129,6 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
"overpowering_state": self.overpowering_state, "overpowering_state": self.overpowering_state,
"presence_state": self._presence_state, "presence_state": self._presence_state,
"window_auto_state": self.window_auto_state, "window_auto_state": self.window_auto_state,
#PR - Adding Window ByPass
"window_bypass_state": self._window_bypass_state, "window_bypass_state": self._window_bypass_state,
"security_delay_min": self._security_delay_min, "security_delay_min": self._security_delay_min,
"security_min_on_percent": self._security_min_on_percent, "security_min_on_percent": self._security_min_on_percent,
@@ -2256,14 +2255,25 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
target: target:
entity_id: climate.thermostat_1 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 self._window_bypass_state = window_bypass
if not self._window_bypass_state and self._window_state: 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() self.save_hvac_mode()
await self.async_set_hvac_mode(HVACMode.OFF) await self.async_set_hvac_mode(HVACMode.OFF)
if self._window_bypass_state and self._window_state: 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) await self.restore_hvac_mode(True)
self.update_custom_attributes() self.update_custom_attributes()