Skip to content

Commit

Permalink
Add _entity_component_unrecorded_attributes to exclude attributes fro…
Browse files Browse the repository at this point in the history
…m record (#140)

Co-authored-by: Jean-Marc Collin <[email protected]>
  • Loading branch information
jmcollin78 and Jean-Marc Collin authored Oct 28, 2023
1 parent 17a0217 commit e1c4fa1
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 2 deletions.
39 changes: 37 additions & 2 deletions custom_components/versatile_thermostat/base_thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
"""Representation of a base class for all Versatile Thermostat device."""

# The list of VersatileThermostat entities
# No more needed
# _registry: dict[str, object] = {}
_hass: HomeAssistant
_last_temperature_mesure: datetime
_last_ext_temperature_mesure: datetime
Expand All @@ -135,6 +133,43 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
_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",
}
))

def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None:
"""Initialize the thermostat."""

Expand Down
7 changes: 7 additions & 0 deletions custom_components/versatile_thermostat/thermostat_climate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=line-too-long
""" A climate over switch classe """
import logging
from datetime import timedelta
Expand All @@ -18,6 +19,12 @@
class ThermostatOverClimate(BaseThermostat):
"""Representation of a base class for a Versatile Thermostat over a climate"""

_entity_component_unrecorded_attributes = BaseThermostat._entity_component_unrecorded_attributes.union(frozenset(
{
"is_over_climate", "start_hvac_action_date", "underlying_climate_0", "underlying_climate_1",
"underlying_climate_2", "underlying_climate_3"
}))

def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None:
"""Initialize the thermostat over switch."""
super().__init__(hass, unique_id, name, entry_infos)
Expand Down
9 changes: 9 additions & 0 deletions custom_components/versatile_thermostat/thermostat_switch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# pylint: disable=line-too-long

""" A climate over switch classe """
import logging
from homeassistant.core import HomeAssistant
Expand All @@ -20,6 +22,13 @@
class ThermostatOverSwitch(BaseThermostat):
"""Representation of a base class for a Versatile Thermostat over a switch."""

_entity_component_unrecorded_attributes = BaseThermostat._entity_component_unrecorded_attributes.union(frozenset(
{
"is_over_switch", "underlying_switch_0", "underlying_switch_1",
"underlying_switch_2", "underlying_switch_3", "on_time_sec", "off_time_sec",
"cycle_min", "function", "tpi_coef_int", "tpi_coef_ext"
}))

def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None:
"""Initialize the thermostat over switch."""
super().__init__(hass, unique_id, name, entry_infos)
Expand Down
7 changes: 7 additions & 0 deletions custom_components/versatile_thermostat/thermostat_valve.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
class ThermostatOverValve(BaseThermostat):
"""Representation of a class for a Versatile Thermostat over a Valve"""

_entity_component_unrecorded_attributes = BaseThermostat._entity_component_unrecorded_attributes.union(frozenset(
{
"is_over_valve", "underlying_valve_0", "underlying_valve_1",
"underlying_valve_2", "underlying_valve_3", "on_time_sec", "off_time_sec",
"cycle_min", "function", "tpi_coef_int", "tpi_coef_ext"
}))

def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None:
"""Initialize the thermostat over switch."""
super().__init__(hass, unique_id, name, entry_infos)
Expand Down

0 comments on commit e1c4fa1

Please sign in to comment.