diff --git a/custom_components/waste_collection_schedule/__init__.py b/custom_components/waste_collection_schedule/__init__.py index 42fc848a..82e20e10 100644 --- a/custom_components/waste_collection_schedule/__init__.py +++ b/custom_components/waste_collection_schedule/__init__.py @@ -7,7 +7,7 @@ from random import randrange import homeassistant.helpers.config_validation as cv import homeassistant.util.dt as dt_util import voluptuous as vol -from homeassistant.core import HomeAssistant, callback +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers.dispatcher import dispatcher_send from .const import DOMAIN, UPDATE_SENSORS_SIGNAL @@ -123,12 +123,14 @@ async def async_setup(hass: HomeAssistant, config: dict): # initial fetch of all data hass.add_job(api._fetch) - - def fetch_data(): + + async def async_fetch_data(service: ServiceCall) -> None: hass.add_job(api._fetch) # Register new Service fetch_data - hass.services.async_register(DOMAIN, 'fetch_data', fetch_data) + hass.services.async_register( + DOMAIN, "fetch_data", async_fetch_data, schema=vol.Schema({}) + ) return True diff --git a/custom_components/waste_collection_schedule/services.yaml b/custom_components/waste_collection_schedule/services.yaml index 1a316482..c6838ceb 100644 --- a/custom_components/waste_collection_schedule/services.yaml +++ b/custom_components/waste_collection_schedule/services.yaml @@ -1,3 +1,3 @@ fetch_data: - name: fetch_data - description: fetch current source data \ No newline at end of file + name: Fetch data from all sources. + description: Fetch data from all sources.