fix fetch_data service call

> takes 0 positional arguments but 1 was given

fix #705
This commit is contained in:
mampfes
2023-02-25 15:25:48 +01:00
parent a712fda4be
commit 79e74c2e53
2 changed files with 8 additions and 6 deletions

View File

@@ -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

View File

@@ -1,3 +1,3 @@
fetch_data:
name: fetch_data
description: fetch current source data
name: Fetch data from all sources.
description: Fetch data from all sources.