Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4b03f8c1e | ||
|
|
ac206a949f | ||
|
|
4bccb746b8 | ||
|
|
e999705286 | ||
|
|
b4873bfd27 |
@@ -13,6 +13,7 @@ from homeassistant.const import SERVICE_RELOAD, EVENT_HOMEASSISTANT_STARTED
|
|||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry, ConfigType
|
from homeassistant.config_entries import ConfigEntry, ConfigType
|
||||||
from homeassistant.core import HomeAssistant, CoreState, callback
|
from homeassistant.core import HomeAssistant, CoreState, callback
|
||||||
|
from homeassistant.helpers.service import async_register_admin_service
|
||||||
|
|
||||||
from .base_thermostat import BaseThermostat
|
from .base_thermostat import BaseThermostat
|
||||||
|
|
||||||
@@ -115,7 +116,8 @@ async def async_setup(
|
|||||||
else:
|
else:
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, _async_startup_internal)
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, _async_startup_internal)
|
||||||
|
|
||||||
hass.helpers.service.async_register_admin_service(
|
async_register_admin_service(
|
||||||
|
hass,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_RELOAD,
|
SERVICE_RELOAD,
|
||||||
_handle_reload,
|
_handle_reload,
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ 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.device_registry import DeviceInfo, DeviceEntryType
|
from homeassistant.helpers.device_registry import DeviceInfo, DeviceEntryType
|
||||||
from homeassistant.helpers.typing import EventType as HASSEventType
|
|
||||||
|
|
||||||
from homeassistant.helpers.event import (
|
from homeassistant.helpers.event import (
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
@@ -1790,7 +1789,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
|||||||
_LOGGER.error("Unable to update external temperature from sensor: %s", ex)
|
_LOGGER.error("Unable to update external temperature from sensor: %s", ex)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
async def _async_power_changed(self, event: HASSEventType[EventStateChangedData]):
|
async def _async_power_changed(self, event: Event[EventStateChangedData]):
|
||||||
"""Handle power changes."""
|
"""Handle power changes."""
|
||||||
_LOGGER.debug("Thermostat %s - Receive new Power event", self.name)
|
_LOGGER.debug("Thermostat %s - Receive new Power event", self.name)
|
||||||
_LOGGER.debug(event)
|
_LOGGER.debug(event)
|
||||||
@@ -1816,9 +1815,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
|||||||
_LOGGER.error("Unable to update current_power from sensor: %s", ex)
|
_LOGGER.error("Unable to update current_power from sensor: %s", ex)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
async def _async_max_power_changed(
|
async def _async_max_power_changed(self, event: Event[EventStateChangedData]):
|
||||||
self, event: HASSEventType[EventStateChangedData]
|
|
||||||
):
|
|
||||||
"""Handle power max changes."""
|
"""Handle power max changes."""
|
||||||
_LOGGER.debug("Thermostat %s - Receive new Power Max event", self.name)
|
_LOGGER.debug("Thermostat %s - Receive new Power Max event", self.name)
|
||||||
_LOGGER.debug(event)
|
_LOGGER.debug(event)
|
||||||
@@ -1843,9 +1840,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
|||||||
_LOGGER.error("Unable to update current_power from sensor: %s", ex)
|
_LOGGER.error("Unable to update current_power from sensor: %s", ex)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
async def _async_presence_changed(
|
async def _async_presence_changed(self, event: Event[EventStateChangedData]):
|
||||||
self, event: HASSEventType[EventStateChangedData]
|
|
||||||
):
|
|
||||||
"""Handle presence changes."""
|
"""Handle presence changes."""
|
||||||
new_state = event.data.get("new_state")
|
new_state = event.data.get("new_state")
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
|
|||||||
@@ -14,6 +14,6 @@
|
|||||||
"quality_scale": "silver",
|
"quality_scale": "silver",
|
||||||
"requirements": [],
|
"requirements": [],
|
||||||
"ssdp": [],
|
"ssdp": [],
|
||||||
"version": "6.2.6",
|
"version": "6.2.9",
|
||||||
"zeroconf": []
|
"zeroconf": []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,9 +70,9 @@ class PropAlgorithm:
|
|||||||
if hvac_mode == HVACMode.COOL:
|
if hvac_mode == HVACMode.COOL:
|
||||||
delta_temp = current_temp - target_temp
|
delta_temp = current_temp - target_temp
|
||||||
delta_ext_temp = (
|
delta_ext_temp = (
|
||||||
ext_current_temp
|
ext_current_temp - target_temp
|
||||||
if ext_current_temp is not None
|
if ext_current_temp is not None
|
||||||
else 0 - target_temp
|
else 0
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
delta_temp = target_temp - current_temp
|
delta_temp = target_temp - current_temp
|
||||||
|
|||||||
@@ -3,13 +3,12 @@
|
|||||||
import logging
|
import logging
|
||||||
from datetime import timedelta, datetime
|
from datetime import timedelta, datetime
|
||||||
|
|
||||||
from homeassistant.core import HomeAssistant, State, callback
|
from homeassistant.core import Event, HomeAssistant, State, callback
|
||||||
from homeassistant.helpers.event import (
|
from homeassistant.helpers.event import (
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
async_track_time_interval,
|
async_track_time_interval,
|
||||||
EventStateChangedData,
|
EventStateChangedData,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import EventType as HASSEventType
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
HVACAction,
|
HVACAction,
|
||||||
HVACMode,
|
HVACMode,
|
||||||
@@ -600,7 +599,7 @@ class ThermostatOverClimate(BaseThermostat[UnderlyingClimate]):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
async def _async_climate_changed(self, event: HASSEventType[EventStateChangedData]):
|
async def _async_climate_changed(self, event: Event[EventStateChangedData]):
|
||||||
"""Handle unerdlying climate state changes.
|
"""Handle unerdlying climate state changes.
|
||||||
This method takes the underlying values and update the VTherm with them.
|
This method takes the underlying values and update the VTherm with them.
|
||||||
To avoid loops (issues #121 #101 #95 #99), we discard the event if it is received
|
To avoid loops (issues #121 #101 #95 #99), we discard the event if it is received
|
||||||
|
|||||||
@@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
""" A climate over switch classe """
|
""" A climate over switch classe """
|
||||||
import logging
|
import logging
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import Event, callback
|
||||||
from homeassistant.helpers.event import (
|
from homeassistant.helpers.event import (
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
EventStateChangedData,
|
EventStateChangedData,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import EventType as HASSEventType
|
|
||||||
from homeassistant.components.climate import HVACMode
|
from homeassistant.components.climate import HVACMode
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@@ -212,7 +211,7 @@ class ThermostatOverSwitch(BaseThermostat[UnderlyingSwitch]):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_switch_changed(self, event: HASSEventType[EventStateChangedData]):
|
def _async_switch_changed(self, event: Event[EventStateChangedData]):
|
||||||
"""Handle heater switch state changes."""
|
"""Handle heater switch state changes."""
|
||||||
new_state = event.data.get("new_state")
|
new_state = event.data.get("new_state")
|
||||||
old_state = event.data.get("old_state")
|
old_state = event.data.get("old_state")
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ from homeassistant.helpers.event import (
|
|||||||
async_track_time_interval,
|
async_track_time_interval,
|
||||||
EventStateChangedData,
|
EventStateChangedData,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import EventType as HASSEventType
|
from homeassistant.core import Event, HomeAssistant, callback
|
||||||
from homeassistant.core import HomeAssistant, callback
|
|
||||||
from homeassistant.components.climate import HVACMode
|
from homeassistant.components.climate import HVACMode
|
||||||
|
|
||||||
from .base_thermostat import BaseThermostat, ConfigData
|
from .base_thermostat import BaseThermostat, ConfigData
|
||||||
@@ -149,7 +148,7 @@ class ThermostatOverValve(BaseThermostat[UnderlyingValve]): # pylint: disable=a
|
|||||||
)
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
async def _async_valve_changed(self, event: HASSEventType[EventStateChangedData]):
|
async def _async_valve_changed(self, event: Event[EventStateChangedData]):
|
||||||
"""Handle unerdlying valve state changes.
|
"""Handle unerdlying valve state changes.
|
||||||
This method just log the change. It changes nothing to avoid loops.
|
This method just log the change. It changes nothing to avoid loops.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user