Skip to content

Commit

Permalink
implement #8
Browse files Browse the repository at this point in the history
  • Loading branch information
pantherale0 committed Mar 1, 2024
1 parent 44460a1 commit 9274463
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions custom_components/fuel_prices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ async def handle_fuel_location_lookup(call: ServiceCall) -> ServiceResponse:

return {"items": locations, "sources": entry.data.get("sources", [])}

async def handle_force_update(call: ServiceCall):
"""Handle a request to force update."""
await fuel_prices.update(force=True)

hass.services.async_register(
DOMAIN,
"find_fuel_station",
Expand All @@ -130,6 +134,8 @@ async def handle_fuel_location_lookup(call: ServiceCall) -> ServiceResponse:
supports_response=SupportsResponse.ONLY,
)

hass.services.async_register(DOMAIN, "force_update", handle_force_update)

return True


Expand Down
2 changes: 1 addition & 1 deletion custom_components/fuel_prices/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"requirements": [
"reverse-geocode==1.4.1",
"these-united-states==1.1.0.21",
"pyfuelprices==2.2.8"
"pyfuelprices==2.2.9"
],
"ssdp": [],
"version": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ colorlog==6.7.0
homeassistant==2023.8.0
pip>=21.0,<23.2
ruff==0.0.292
pyfuelprices==2.2.8
pyfuelprices==2.2.9

0 comments on commit 9274463

Please sign in to comment.