mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Ensure service calls are typed [m-z] (#63014)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
4ef9abbf3f
commit
709afc63b0
@ -16,6 +16,7 @@ from homeassistant.const import (
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
from homeassistant.core import ServiceCall
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.util.json import load_json, save_json
|
||||
@ -384,7 +385,7 @@ class MatrixBot:
|
||||
for img in data.get(ATTR_IMAGES, []):
|
||||
self._send_image(img, target_rooms)
|
||||
|
||||
def handle_send_message(self, service):
|
||||
def handle_send_message(self, service: ServiceCall) -> None:
|
||||
"""Handle the send_message service."""
|
||||
self._send_message(
|
||||
service.data.get(ATTR_MESSAGE),
|
||||
|
@ -13,6 +13,7 @@ from homeassistant.components.media_player.const import (
|
||||
SERVICE_PLAY_MEDIA,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import ServiceCall
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -41,7 +42,7 @@ CONFIG_SCHEMA = vol.Schema(
|
||||
def setup(hass, config):
|
||||
"""Set up the media extractor service."""
|
||||
|
||||
def play_media(call):
|
||||
def play_media(call: ServiceCall) -> None:
|
||||
"""Get stream URL and send it to the play_media service."""
|
||||
MediaExtractor(hass, config[DOMAIN], call.data).extract_and_send()
|
||||
|
||||
|
@ -9,6 +9,7 @@ import threading
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import ServiceCall
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from .minio_helper import MinioEventThread, create_minio_client
|
||||
@ -127,7 +128,7 @@ def setup(hass, config):
|
||||
value.hass = hass
|
||||
return value.async_render(parse_result=False)
|
||||
|
||||
def put_file(service):
|
||||
def put_file(service: ServiceCall) -> None:
|
||||
"""Upload file service."""
|
||||
bucket = _render_service_value(service, ATTR_BUCKET)
|
||||
key = _render_service_value(service, ATTR_KEY)
|
||||
@ -139,7 +140,7 @@ def setup(hass, config):
|
||||
|
||||
minio_client.fput_object(bucket, key, file_path)
|
||||
|
||||
def get_file(service):
|
||||
def get_file(service: ServiceCall) -> None:
|
||||
"""Download file service."""
|
||||
bucket = _render_service_value(service, ATTR_BUCKET)
|
||||
key = _render_service_value(service, ATTR_KEY)
|
||||
@ -151,7 +152,7 @@ def setup(hass, config):
|
||||
|
||||
minio_client.fget_object(bucket, key, file_path)
|
||||
|
||||
def remove_file(service):
|
||||
def remove_file(service: ServiceCall) -> None:
|
||||
"""Delete file service."""
|
||||
bucket = _render_service_value(service, ATTR_BUCKET)
|
||||
key = _render_service_value(service, ATTR_KEY)
|
||||
|
@ -13,6 +13,7 @@ from homeassistant.const import (
|
||||
CONF_SSL,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.core import ServiceCall
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from .const import (
|
||||
@ -95,7 +96,7 @@ def setup(hass, config):
|
||||
|
||||
hass.data[DOMAIN] = {"instance": ombi}
|
||||
|
||||
def submit_movie_request(call):
|
||||
def submit_movie_request(call: ServiceCall) -> None:
|
||||
"""Submit request for movie."""
|
||||
name = call.data[ATTR_NAME]
|
||||
movies = ombi.search_movie(name)
|
||||
@ -105,7 +106,7 @@ def setup(hass, config):
|
||||
else:
|
||||
raise Warning("No movie found.")
|
||||
|
||||
def submit_tv_request(call):
|
||||
def submit_tv_request(call: ServiceCall) -> None:
|
||||
"""Submit request for TV show."""
|
||||
name = call.data[ATTR_NAME]
|
||||
tv_shows = ombi.search_tv(name)
|
||||
@ -122,7 +123,7 @@ def setup(hass, config):
|
||||
else:
|
||||
raise Warning("No TV show found.")
|
||||
|
||||
def submit_music_request(call):
|
||||
def submit_music_request(call: ServiceCall) -> None:
|
||||
"""Submit request for music album."""
|
||||
name = call.data[ATTR_NAME]
|
||||
music = ombi.search_music_album(name)
|
||||
|
@ -26,6 +26,7 @@ from homeassistant.const import (
|
||||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import ServiceCall
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -176,14 +177,14 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
host = config.get(CONF_HOST)
|
||||
hosts = []
|
||||
|
||||
def service_handle(service):
|
||||
def service_handle(service: ServiceCall) -> None:
|
||||
"""Handle for services."""
|
||||
entity_ids = service.data.get(ATTR_ENTITY_ID)
|
||||
entity_ids = service.data[ATTR_ENTITY_ID]
|
||||
devices = [d for d in hosts if d.entity_id in entity_ids]
|
||||
|
||||
for device in devices:
|
||||
if service.service == SERVICE_SELECT_HDMI_OUTPUT:
|
||||
device.select_output(service.data.get(ATTR_HDMI_OUTPUT))
|
||||
device.select_output(service.data[ATTR_HDMI_OUTPUT])
|
||||
|
||||
hass.services.register(
|
||||
DOMAIN,
|
||||
|
@ -16,6 +16,7 @@ from homeassistant.const import (
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
from homeassistant.core import ServiceCall
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.event import track_point_in_utc_time
|
||||
from homeassistant.util import dt as dt_util
|
||||
@ -84,7 +85,7 @@ def setup(hass, config):
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_pilight_client)
|
||||
|
||||
@send_throttler.limited
|
||||
def send_code(call):
|
||||
def send_code(call: ServiceCall) -> None:
|
||||
"""Send RF code to the pilight-daemon."""
|
||||
# Change type to dict from mappingproxy since data has to be JSON
|
||||
# serializable
|
||||
|
@ -20,6 +20,7 @@ from RestrictedPython.Guards import (
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_DESCRIPTION, CONF_NAME, SERVICE_RELOAD
|
||||
from homeassistant.core import ServiceCall
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.service import async_set_service_schema
|
||||
from homeassistant.loader import bind_hass
|
||||
@ -88,7 +89,7 @@ def setup(hass, config):
|
||||
|
||||
discover_scripts(hass)
|
||||
|
||||
def reload_scripts_handler(call):
|
||||
def reload_scripts_handler(call: ServiceCall) -> None:
|
||||
"""Handle reload service calls."""
|
||||
discover_scripts(hass)
|
||||
|
||||
@ -105,7 +106,7 @@ def discover_scripts(hass):
|
||||
_LOGGER.warning("Folder %s not found in configuration folder", FOLDER)
|
||||
return False
|
||||
|
||||
def python_script_service_handler(call):
|
||||
def python_script_service_handler(call: ServiceCall) -> None:
|
||||
"""Handle python script service calls."""
|
||||
execute_script(hass, call.service, call.data)
|
||||
|
||||
|
@ -9,6 +9,7 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
||||
from homeassistant.core import ServiceCall
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.discovery import load_platform
|
||||
|
||||
@ -84,11 +85,11 @@ def setup(hass, config):
|
||||
load_platform(hass, CAMERA_DOMAIN, DOMAIN, {}, config)
|
||||
|
||||
# Register services
|
||||
def handle_start_record(call):
|
||||
def handle_start_record(call: ServiceCall) -> None:
|
||||
guid = call.data[SERVICE_CHANNEL_GUID]
|
||||
qvrpro.start_recording(guid)
|
||||
|
||||
def handle_stop_record(call):
|
||||
def handle_stop_record(call: ServiceCall) -> None:
|
||||
guid = call.data[SERVICE_CHANNEL_GUID]
|
||||
qvrpro.stop_recording(guid)
|
||||
|
||||
|
@ -4,6 +4,7 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import ATTR_ENTITY_ID, CONF_FRIENDLY_NAME, CONF_TRIGGER_TIME
|
||||
from homeassistant.core import ServiceCall
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
||||
from . import CONF_ZONES, DATA_RAINBIRD, DOMAIN, RAINBIRD_CONTROLLER
|
||||
@ -56,7 +57,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
|
||||
add_entities(devices, True)
|
||||
|
||||
def start_irrigation(service):
|
||||
def start_irrigation(service: ServiceCall) -> None:
|
||||
entity_id = service.data[ATTR_ENTITY_ID]
|
||||
duration = service.data[ATTR_DURATION]
|
||||
|
||||
@ -71,7 +72,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
schema=SERVICE_SCHEMA_IRRIGATION,
|
||||
)
|
||||
|
||||
def set_rain_delay(service):
|
||||
def set_rain_delay(service: ServiceCall) -> None:
|
||||
duration = service.data[ATTR_DURATION]
|
||||
|
||||
controller.set_rain_delay(duration)
|
||||
|
@ -10,6 +10,7 @@ import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_DOMAIN, CONF_TTL, CONF_ZONE
|
||||
from homeassistant.core import ServiceCall
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.event import track_time_interval
|
||||
|
||||
@ -56,7 +57,7 @@ def setup(hass, config):
|
||||
aws_access_key_id, aws_secret_access_key, zone, domain, records, ttl
|
||||
)
|
||||
|
||||
def update_records_service(now):
|
||||
def update_records_service(call: ServiceCall) -> None:
|
||||
"""Set up service for manual trigger."""
|
||||
_update_route53(
|
||||
aws_access_key_id, aws_secret_access_key, zone, domain, records, ttl
|
||||
|
@ -30,7 +30,7 @@ from homeassistant.const import (
|
||||
STATE_PLAYING,
|
||||
STATE_UNAVAILABLE,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import ServiceCall, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from .const import (
|
||||
@ -122,7 +122,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
hass.data[DATA_SOUNDTOUCH].append(bose_soundtouch_entity)
|
||||
add_entities([bose_soundtouch_entity], True)
|
||||
|
||||
def service_handle(service):
|
||||
def service_handle(service: ServiceCall) -> None:
|
||||
"""Handle the applying of a service."""
|
||||
master_device_id = service.data.get("master")
|
||||
slaves_ids = service.data.get("slaves")
|
||||
|
@ -5,6 +5,7 @@ from streamlabswater import streamlabswater
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_API_KEY, Platform
|
||||
from homeassistant.core import ServiceCall
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
@ -77,7 +78,7 @@ def setup(hass, config):
|
||||
for platform in PLATFORMS:
|
||||
discovery.load_platform(hass, platform, DOMAIN, {}, config)
|
||||
|
||||
def set_away_mode(service):
|
||||
def set_away_mode(service: ServiceCall) -> None:
|
||||
"""Set the StreamLabsWater Away Mode."""
|
||||
away_mode = service.data.get(ATTR_AWAY_MODE)
|
||||
client.update_location(location_id, away_mode)
|
||||
|
@ -17,7 +17,7 @@ from homeassistant.const import (
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import ServiceCall, callback
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.device_registry import format_mac
|
||||
@ -77,7 +77,7 @@ SERVICE_SCHEMA_REMOVE_DEVICE = vol.Schema(
|
||||
def setup(hass, config):
|
||||
"""Set up the Xiaomi component."""
|
||||
|
||||
def play_ringtone_service(call):
|
||||
def play_ringtone_service(call: ServiceCall) -> None:
|
||||
"""Service to play ringtone through Gateway."""
|
||||
ring_id = call.data.get(ATTR_RINGTONE_ID)
|
||||
gateway = call.data.get(ATTR_GW_MAC)
|
||||
@ -89,12 +89,12 @@ def setup(hass, config):
|
||||
|
||||
gateway.write_to_hub(gateway.sid, **kwargs)
|
||||
|
||||
def stop_ringtone_service(call):
|
||||
def stop_ringtone_service(call: ServiceCall) -> None:
|
||||
"""Service to stop playing ringtone on Gateway."""
|
||||
gateway = call.data.get(ATTR_GW_MAC)
|
||||
gateway.write_to_hub(gateway.sid, mid=10000)
|
||||
|
||||
def add_device_service(call):
|
||||
def add_device_service(call: ServiceCall) -> None:
|
||||
"""Service to add a new sub-device within the next 30 seconds."""
|
||||
gateway = call.data.get(ATTR_GW_MAC)
|
||||
gateway.write_to_hub(gateway.sid, join_permission="yes")
|
||||
@ -104,7 +104,7 @@ def setup(hass, config):
|
||||
title="Xiaomi Aqara Gateway",
|
||||
)
|
||||
|
||||
def remove_device_service(call):
|
||||
def remove_device_service(call: ServiceCall) -> None:
|
||||
"""Service to remove a sub-device from the gateway."""
|
||||
device_id = call.data.get(ATTR_DEVICE_ID)
|
||||
gateway = call.data.get(ATTR_GW_MAC)
|
||||
|
@ -14,6 +14,7 @@ from homeassistant.const import (
|
||||
CONF_USERNAME,
|
||||
CONF_VERIFY_SSL,
|
||||
)
|
||||
from homeassistant.core import ServiceCall
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.discovery import async_load_platform
|
||||
|
||||
@ -74,7 +75,7 @@ def setup(hass, config):
|
||||
|
||||
success = zm_client.login() and success
|
||||
|
||||
def set_active_state(call):
|
||||
def set_active_state(call: ServiceCall) -> None:
|
||||
"""Set the ZoneMinder run state to the given state name."""
|
||||
zm_id = call.data[ATTR_ID]
|
||||
state_name = call.data[ATTR_NAME]
|
||||
|
@ -583,49 +583,49 @@ async def async_setup_entry( # noqa: C901
|
||||
weak=False,
|
||||
)
|
||||
|
||||
def add_node(service):
|
||||
def add_node(service: ServiceCall) -> None:
|
||||
"""Switch into inclusion mode."""
|
||||
_LOGGER.info("Z-Wave add_node have been initialized")
|
||||
network.controller.add_node()
|
||||
|
||||
def add_node_secure(service):
|
||||
def add_node_secure(service: ServiceCall) -> None:
|
||||
"""Switch into secure inclusion mode."""
|
||||
_LOGGER.info("Z-Wave add_node_secure have been initialized")
|
||||
network.controller.add_node(True)
|
||||
|
||||
def remove_node(service):
|
||||
def remove_node(service: ServiceCall) -> None:
|
||||
"""Switch into exclusion mode."""
|
||||
_LOGGER.info("Z-Wave remove_node have been initialized")
|
||||
network.controller.remove_node()
|
||||
|
||||
def cancel_command(service):
|
||||
def cancel_command(service: ServiceCall) -> None:
|
||||
"""Cancel a running controller command."""
|
||||
_LOGGER.info("Cancel running Z-Wave command")
|
||||
network.controller.cancel_command()
|
||||
|
||||
def heal_network(service):
|
||||
def heal_network(service: ServiceCall) -> None:
|
||||
"""Heal the network."""
|
||||
_LOGGER.info("Z-Wave heal running")
|
||||
network.heal()
|
||||
|
||||
def soft_reset(service):
|
||||
def soft_reset(service: ServiceCall) -> None:
|
||||
"""Soft reset the controller."""
|
||||
_LOGGER.info("Z-Wave soft_reset have been initialized")
|
||||
network.controller.soft_reset()
|
||||
|
||||
def test_network(service):
|
||||
def test_network(service: ServiceCall) -> None:
|
||||
"""Test the network by sending commands to all the nodes."""
|
||||
_LOGGER.info("Z-Wave test_network have been initialized")
|
||||
network.test()
|
||||
|
||||
def stop_network(_service_or_event):
|
||||
def stop_network(_service_or_event: Event | ServiceCall) -> None:
|
||||
"""Stop Z-Wave network."""
|
||||
_LOGGER.info("Stopping Z-Wave network")
|
||||
network.stop()
|
||||
if hass.state == CoreState.running:
|
||||
hass.bus.fire(const.EVENT_NETWORK_STOP)
|
||||
|
||||
async def rename_node(service):
|
||||
async def rename_node(service: ServiceCall) -> None:
|
||||
"""Rename a node."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
|
||||
@ -644,7 +644,7 @@ async def async_setup_entry( # noqa: C901
|
||||
entity = hass.data[DATA_DEVICES][key]
|
||||
await entity.value_renamed(update_ids)
|
||||
|
||||
async def rename_value(service):
|
||||
async def rename_value(service: ServiceCall) -> None:
|
||||
"""Rename a node value."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
value_id = service.data.get(const.ATTR_VALUE_ID)
|
||||
@ -660,7 +660,7 @@ async def async_setup_entry( # noqa: C901
|
||||
entity = hass.data[DATA_DEVICES][value_key]
|
||||
await entity.value_renamed(update_ids)
|
||||
|
||||
def set_poll_intensity(service):
|
||||
def set_poll_intensity(service: ServiceCall) -> None:
|
||||
"""Set the polling intensity of a node value."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
value_id = service.data.get(const.ATTR_VALUE_ID)
|
||||
@ -687,19 +687,19 @@ async def async_setup_entry( # noqa: C901
|
||||
"Set polling intensity failed (Node %d Value %d)", node_id, value_id
|
||||
)
|
||||
|
||||
def remove_failed_node(service):
|
||||
def remove_failed_node(service: ServiceCall) -> None:
|
||||
"""Remove failed node."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
_LOGGER.info("Trying to remove zwave node %d", node_id)
|
||||
network.controller.remove_failed_node(node_id)
|
||||
|
||||
def replace_failed_node(service):
|
||||
def replace_failed_node(service: ServiceCall) -> None:
|
||||
"""Replace failed node."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
_LOGGER.info("Trying to replace zwave node %d", node_id)
|
||||
network.controller.replace_failed_node(node_id)
|
||||
|
||||
def set_config_parameter(service):
|
||||
def set_config_parameter(service: ServiceCall) -> None:
|
||||
"""Set a config parameter to a node."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
|
||||
@ -756,7 +756,7 @@ async def async_setup_entry( # noqa: C901
|
||||
selection,
|
||||
)
|
||||
|
||||
def refresh_node_value(service):
|
||||
def refresh_node_value(service: ServiceCall) -> None:
|
||||
"""Refresh the specified value from a node."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
value_id = service.data.get(const.ATTR_VALUE_ID)
|
||||
@ -764,7 +764,7 @@ async def async_setup_entry( # noqa: C901
|
||||
node.values[value_id].refresh()
|
||||
_LOGGER.info("Node %s value %s refreshed", node_id, value_id)
|
||||
|
||||
def set_node_value(service):
|
||||
def set_node_value(service: ServiceCall) -> None:
|
||||
"""Set the specified value on a node."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
value_id = service.data.get(const.ATTR_VALUE_ID)
|
||||
@ -773,7 +773,7 @@ async def async_setup_entry( # noqa: C901
|
||||
node.values[value_id].data = value
|
||||
_LOGGER.info("Node %s value %s set to %s", node_id, value_id, value)
|
||||
|
||||
def print_config_parameter(service):
|
||||
def print_config_parameter(service: ServiceCall) -> None:
|
||||
"""Print a config parameter from a node."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
|
||||
@ -785,13 +785,13 @@ async def async_setup_entry( # noqa: C901
|
||||
get_config_value(node, param),
|
||||
)
|
||||
|
||||
def print_node(service):
|
||||
def print_node(service: ServiceCall) -> None:
|
||||
"""Print all information about z-wave node."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
|
||||
nice_print_node(node)
|
||||
|
||||
def set_wakeup(service):
|
||||
def set_wakeup(service: ServiceCall) -> None:
|
||||
"""Set wake-up interval of a node."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
|
||||
@ -803,7 +803,7 @@ async def async_setup_entry( # noqa: C901
|
||||
else:
|
||||
_LOGGER.info("Node %s is not wakeable", node_id)
|
||||
|
||||
def change_association(service):
|
||||
def change_association(service: ServiceCall) -> None:
|
||||
"""Change an association in the zwave network."""
|
||||
association_type = service.data.get(const.ATTR_ASSOCIATION)
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
@ -833,18 +833,18 @@ async def async_setup_entry( # noqa: C901
|
||||
instance,
|
||||
)
|
||||
|
||||
async def async_refresh_entity(service):
|
||||
async def async_refresh_entity(service: ServiceCall) -> None:
|
||||
"""Refresh values that specific entity depends on."""
|
||||
entity_id = service.data.get(ATTR_ENTITY_ID)
|
||||
async_dispatcher_send(hass, SIGNAL_REFRESH_ENTITY_FORMAT.format(entity_id))
|
||||
|
||||
def refresh_node(service):
|
||||
def refresh_node(service: ServiceCall) -> None:
|
||||
"""Refresh all node info."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
|
||||
node.refresh_info()
|
||||
|
||||
def reset_node_meters(service):
|
||||
def reset_node_meters(service: ServiceCall) -> None:
|
||||
"""Reset meter counters of a node."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
instance = service.data.get(const.ATTR_INSTANCE)
|
||||
@ -862,7 +862,7 @@ async def async_setup_entry( # noqa: C901
|
||||
"Node %s on instance %s does not have resettable meters", node_id, instance
|
||||
)
|
||||
|
||||
def heal_node(service):
|
||||
def heal_node(service: ServiceCall) -> None:
|
||||
"""Heal a node on the network."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
update_return_routes = service.data.get(const.ATTR_RETURN_ROUTES)
|
||||
@ -870,7 +870,7 @@ async def async_setup_entry( # noqa: C901
|
||||
_LOGGER.info("Z-Wave node heal running for node %s", node_id)
|
||||
node.heal(update_return_routes)
|
||||
|
||||
def test_node(service):
|
||||
def test_node(service: ServiceCall) -> None:
|
||||
"""Send test messages to a node on the network."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
messages = service.data.get(const.ATTR_MESSAGES)
|
||||
|
Loading…
x
Reference in New Issue
Block a user