diff --git a/homeassistant/components/nws/services.py b/homeassistant/components/nws/services.py index 2a982d8f7c1f..b30f90152077 100644 --- a/homeassistant/components/nws/services.py +++ b/homeassistant/components/nws/services.py @@ -1,5 +1,7 @@ """Services for the National Weather Service (NWS) integration.""" +from enum import StrEnum + import probatio from homeassistant.components.weather import DOMAIN as WEATHER_DOMAIN @@ -9,6 +11,18 @@ from homeassistant.helpers import service from .const import DOMAIN +class NWSService(StrEnum): + """Store keys for National Weather Service (NWS) services.""" + + GET_FORECASTS_EXTRA = "get_forecasts_extra" + + +class NWSServiceArgument(StrEnum): + """Store keys for National Weather Service (NWS) service arguments.""" + + TYPE = "type" + + @callback def async_setup_services(hass: HomeAssistant) -> None: """Set up the services for the National Weather Service (NWS) integration.""" @@ -16,9 +30,13 @@ def async_setup_services(hass: HomeAssistant) -> None: service.async_register_platform_entity_service( hass, DOMAIN, - "get_forecasts_extra", + NWSService.GET_FORECASTS_EXTRA, entity_domain=WEATHER_DOMAIN, - schema={probatio.Required("type"): probatio.In(("hourly", "twice_daily"))}, + schema={ + probatio.Required(NWSServiceArgument.TYPE): probatio.In( + ("hourly", "twice_daily") + ) + }, func="async_get_forecasts_extra_service", supports_response=SupportsResponse.ONLY, )