Skip to content

Commit

Permalink
V2025.03.01
Browse files Browse the repository at this point in the history
Update lovelace data reference
update latency timeout for slow loading resources referenced by this component
  • Loading branch information
petergridge authored Mar 5, 2025
1 parent cf6c66d commit 69b56a8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions custom_components/irrigationprogram/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
CONST_OFF_DELAY = 5
CONST_SUN_OFFSET = 240
CONST_DELAY_OFFSET = 10
CONST_START_LATENCY = 120

CONST_ENTITY = "entity_id"
CONST_SWITCH = "switch"
Expand Down
4 changes: 2 additions & 2 deletions custom_components/irrigationprogram/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from homeassistant.util import slugify

from . import IrrigationData
from .const import CONST_CLOSED, CONST_LATENCY, CONST_OFF, CONST_ON, CONST_OPEN
from .const import CONST_START_LATENCY
from .program import IrrigationProgram
from .zone import Zone

Expand Down Expand Up @@ -45,7 +45,7 @@ async def async_setup_entry(
for i, zone in enumerate(zones):
#check if the switch is ready
switch_not_ready = True
for _ in range(CONST_LATENCY):
for _ in range(CONST_START_LATENCY):
try:
friendly_name = hass.states.get(zone.zone).attributes.get('friendly_name')
switch_not_ready = False
Expand Down
2 changes: 1 addition & 1 deletion custom_components/irrigationprogram/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def init_resource(hass: HomeAssistant, url: str, ver: str) -> bool:
random url to avoid problems with the cache. But chromecast don't support
extra JS urls and can't load custom card.""" # noqa: D205, D209

resources: ResourceStorageCollection = hass.data["lovelace"]["resources"]
resources: ResourceStorageCollection = hass.data["lovelace"].resources
# force load storage
await resources.async_get_info()

Expand Down

0 comments on commit 69b56a8

Please sign in to comment.