Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions custom_components/climate_scheduler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,29 @@ async def _async_setup_common(hass: HomeAssistant) -> None:

# Start coordinator updates
_LOGGER.info(f"Starting coordinator with {UPDATE_INTERVAL_SECONDS}s update interval")
await coordinator.async_refresh()
_LOGGER.info("Forcing initial temperature sync for all entities")
await coordinator.force_update_all()

# Run initial sync in background so setup doesn't block waiting for climate entities
async def _initial_sync():
"""Run initial sync after setup completes."""
import asyncio
_LOGGER.info("[DEBUG] _initial_sync: waiting 5s for climate entities to be ready")
await asyncio.sleep(5)
_LOGGER.info("[DEBUG] _initial_sync: starting async_refresh()")
try:
await coordinator.async_refresh()
_LOGGER.info("[DEBUG] _initial_sync: async_refresh() complete")
except Exception as e:
_LOGGER.error("[DEBUG] _initial_sync: async_refresh() failed: %s", e)
_LOGGER.info("[DEBUG] _initial_sync: starting force_update_all()")
try:
await coordinator.force_update_all()
_LOGGER.info("[DEBUG] _initial_sync: force_update_all() complete")
except Exception as e:
_LOGGER.error("[DEBUG] _initial_sync: force_update_all() failed: %s", e)
coordinator._initial_setup = False
_LOGGER.info("[DEBUG] _initial_sync: all done, _initial_setup=False")

hass.async_create_task(_initial_sync())

# Schedule periodic updates
async def _scheduled_update(now):
Expand Down Expand Up @@ -106,6 +126,7 @@ async def _scheduled_update(now):
"factory_reset",
"reregister_card",
"diagnostics",
"create_groups_from_areas",
)
missing = [s for s in expected_services if not hass.services.has_service(DOMAIN, s)]
if not missing:
Expand Down Expand Up @@ -388,7 +409,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"save_settings","reload_integration","advance_schedule","advance_group",
"cancel_advance","get_advance_status","clear_advance_history","test_fire_event","create_profile",
"delete_profile","rename_profile","set_active_profile","get_profiles",
"cleanup_derivative_sensors","factory_reset"
"cleanup_derivative_sensors","factory_reset","create_groups_from_areas"
]:
try:
hass.services.async_remove(DOMAIN, svc)
Expand Down
89 changes: 53 additions & 36 deletions custom_components/climate_scheduler/coordinator.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion custom_components/climate_scheduler/frontend/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.14.12
1.15.3
Loading