not ideal but working bat charging

This commit is contained in:
2026-02-03 15:05:29 +01:00
parent 5b39f80862
commit a7a2da2eb2
11 changed files with 1241 additions and 37 deletions

View File

@ -46,7 +46,7 @@ class PstrykMqttPublisher:
# Load translations
try:
self._translations = await async_get_translations(
self.hass, self.hass.config.language, DOMAIN, ["mqtt"]
self.hass, self.hass.config.language, DOMAIN
)
except Exception as ex:
_LOGGER.warning("Failed to load translations for MQTT publisher: %s", ex)
@ -202,7 +202,8 @@ class PstrykMqttPublisher:
last_time = formatted_prices[-1]["start"]
_LOGGER.debug(f"Formatted {len(formatted_prices)} prices for MQTT from {first_time} to {last_time}")
# Verify we have complete days
# Verify we have complete days (debug only, not critical)
today = dt_util.now().strftime("%Y-%m-%d")
hours_by_date = {}
for fp in formatted_prices:
date_part = fp["start"][:10] # YYYY-MM-DD
@ -212,7 +213,15 @@ class PstrykMqttPublisher:
for date, hours in hours_by_date.items():
if hours != 24:
_LOGGER.warning(f"Incomplete day {date}: only {hours} hours instead of 24")
# Only log as debug - incomplete days are normal for past/future data
# Past days get cleaned up, future days may not be available yet
if date < today:
_LOGGER.debug(f"Past day {date}: {hours} hours (old data being cleaned)")
elif date == today and hours >= 20:
# Today with 20+ hours is acceptable (may be missing 1-2 hours at edges)
_LOGGER.debug(f"Today {date}: {hours}/24 hours (acceptable)")
else:
_LOGGER.debug(f"Incomplete day {date}: {hours}/24 hours")
else:
_LOGGER.warning("No prices formatted for MQTT")