Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…e-Assistant-Integration into 80-bug-data-for-key-data-does-not-exist
  • Loading branch information
jontofront committed Dec 18, 2024
2 parents aee83fa + 084c69a commit e5cb581
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 45 deletions.
9 changes: 5 additions & 4 deletions custom_components/econet300/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
_LOGGER = logging.getLogger(__name__)


@dataclass(frozen=True)
@dataclass
class EconetBinarySensorEntityDescription(BinarySensorEntityDescription):
"""Describes Econet binary sensor entity."""

Expand Down Expand Up @@ -58,12 +58,13 @@ def __init__(
self.entity_description,
)

def _sync_state(self, value):
def _sync_state(self, value: bool):
"""Sync state."""
value = bool(value)
_LOGGER.debug("EconetBinarySensor _sync_state: %s", value)
self._attr_is_on = value
_LOGGER.debug(
"Updated Binary sensor _attr_is_on for %s: %s",
"Updated EconetBinarySensor _attr_is_on for %s: %s",
self.entity_description.key,
self._attr_is_on,
)
Expand Down Expand Up @@ -131,7 +132,7 @@ async def async_setup_entry(
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> bool:
"""Set up the sensor platform."""
"""Set up the binary sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id][SERVICE_COORDINATOR]
api = hass.data[DOMAIN][entry.entry_id][SERVICE_API]

Expand Down
2 changes: 1 addition & 1 deletion custom_components/econet300/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def _async_update_data(self):
try:
# Note: asyncio.TimeoutError and aiohttp.ClientError are already
# handled by the data update coordinator.
async with asyncio.timeout(20):
async with asyncio.timeout(10):
data = await self._api.fetch_sys_params()
reg_params = await self._api.fetch_reg_params()
params_edits = await self._api.fetch_param_edit_data()
Expand Down
1 change: 1 addition & 0 deletions custom_components/econet300/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"tempFeeder": SensorDeviceClass.TEMPERATURE,
"tempExternalSensor": SensorDeviceClass.TEMPERATURE,
"tempCO": SensorDeviceClass.TEMPERATURE,
"tempCOSet": SensorDeviceClass.TEMPERATURE,
"boilerPower": SensorDeviceClass.POWER_FACTOR,
"boilerPowerKW": SensorDeviceClass.POWER,
"fanPower": SensorDeviceClass.POWER_FACTOR,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/econet300/mem_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get(self, key):

return self._data[key].value()

def set(self, key, value, duration: int = 60):
def set(self, key, value, duration: int = 30):
"""Set the value of the specified key in the cache."""
_LOGGER.debug("Caching value for: '%s'", key)
self._data[key] = MemCacheItem(key, value, duration)
24 changes: 9 additions & 15 deletions custom_components/econet300/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
"unseal": {
"name": "Unseal"
},
"thermostat": {
"name": "Boiler thermostat"
},
"pump_co_works": {
"name": "Pump CO"
},
Expand All @@ -44,12 +41,12 @@
"additional_feeder": {
"name": "Additional feeder"
},
"pump_fireplace_works": {
"name": "Boiler Pump"
},
"pump_cwu_works": {
"name": "Pump CWU"
},
"pump_fireplace_works": {
"name": "Boiler pump"
},
"mixer_pump1": {
"name": "Mixer 1 pump"
},
Expand Down Expand Up @@ -159,15 +156,6 @@
"mixer_set_temp1": {
"name": "Mixer target temperature"
},
"pump_cwu_works": {
"name": "HUW pump"
},
"status_cwu": {
"name": "Water heater status"
},
"pump_fireplace_works": {
"name": "Boiler pump"
},
"quality": {
"name": "Signal quality"
},
Expand All @@ -183,6 +171,12 @@
"temp_cwu": {
"name": "Water heater temperature"
},
"status_cwu": {
"name": "Water heater status"
},
"temp_cwu_set": {
"name": "Water heater set temperature"
},
"temp_upper_buffer": {
"name": "Upper buffer temperature"
},
Expand Down
18 changes: 6 additions & 12 deletions custom_components/econet300/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
"unseal": {
"name": "Unseal"
},
"thermostat": {
"name": "Boiler thermostat"
},
"pump_co_works": {
"name": "Pump CO"
},
"fan_works": {
"name": "Fan"
},
"feeder_works": {
"name": "Feeder"
},
"additional_feeder": {
"name": "Additional feeder"
},
Expand Down Expand Up @@ -106,9 +106,6 @@
"feeder_work": {
"name": "Feeder work"
},
"feeder_works": {
"name": "Feeder"
},
"firing_up_count": {
"name": "Firing up count"
},
Expand Down Expand Up @@ -138,15 +135,9 @@
"mixer_set_temp1": {
"name": "Mixer target temperature"
},
"pump_cwu_works": {
"name": "HUW pump"
},
"status_cwu": {
"name": "Water heater status"
},
"pump_fireplace_works": {
"name": "Boiler pump"
},
"quality": {
"name": "Signal quality"
},
Expand Down Expand Up @@ -183,6 +174,9 @@
"temp_cwu": {
"name": "Water heater temperature"
},
"temp_cwu_set": {
"name": "Water heater set temperature"
},
"temp_upper_buffer": {
"name": "Upper buffer temperature"
},
Expand Down
15 changes: 3 additions & 12 deletions custom_components/econet300/translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
"unseal": {
"name": "Unseal"
},
"thermostat": {
"name": "Boiler thermostat"
},
"pump_co_works": {
"name": "Pump CO"
},
Expand All @@ -38,9 +35,6 @@
"aditional_feeder": {
"name": "Aditional feeder"
},
"pump_fireplace_works": {
"name": "Boiler Pump"
},
"pump_cwu_works": {
"name": "Pump CWU"
},
Expand All @@ -50,6 +44,9 @@
"boiler_pump": {
"name": "Boiler pump"
},
"pump_fireplace_works": {
"name": "Boiler pump"
},
"main_srv": {
"name": "Econet24.com server"
},
Expand Down Expand Up @@ -113,12 +110,6 @@
"unknown": "Unknown"
}
},
"pump_cwu_works": {
"name": "HUW pump"
},
"pump_fireplace_works": {
"name": "Boiler pump"
},
"valve_mixer1": {
"name": "Zawór mieszacza 1"
},
Expand Down

0 comments on commit e5cb581

Please sign in to comment.