Compare commits

...

1 Commits

Author SHA1 Message Date
epenet
662554ec46 Drop single-use service name constants in blue_current 2026-02-27 09:17:11 +00:00
3 changed files with 9 additions and 14 deletions

View File

@@ -13,7 +13,6 @@ UID = "uid"
BCU_APP = "BCU-APP"
WITHOUT_CHARGING_CARD = "without_charging_card"
CHARGING_CARD_ID = "charging_card_id"
SERVICE_START_CHARGE_SESSION = "start_charge_session"
PLUG_AND_CHARGE = "plug_and_charge"
VALUE = "value"
PERMISSION = "permission"

View File

@@ -10,7 +10,7 @@ from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.exceptions import ServiceValidationError
from homeassistant.helpers import config_validation as cv, device_registry as dr
from .const import BCU_APP, CHARGING_CARD_ID, DOMAIN, SERVICE_START_CHARGE_SESSION
from .const import BCU_APP, CHARGING_CARD_ID, DOMAIN
SERVICE_START_CHARGE_SESSION_SCHEMA = vol.Schema(
{
@@ -73,7 +73,7 @@ def async_setup_services(hass: HomeAssistant) -> None:
hass.services.async_register(
DOMAIN,
SERVICE_START_CHARGE_SESSION,
"start_charge_session",
start_charge_session,
SERVICE_START_CHARGE_SESSION_SCHEMA,
)

View File

@@ -13,11 +13,7 @@ import pytest
from voluptuous import MultipleInvalid
from homeassistant.components.blue_current import async_setup_entry
from homeassistant.components.blue_current.const import (
CHARGING_CARD_ID,
DOMAIN,
SERVICE_START_CHARGE_SESSION,
)
from homeassistant.components.blue_current.const import CHARGING_CARD_ID, DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import CONF_DEVICE_ID, Platform
from homeassistant.core import HomeAssistant
@@ -124,7 +120,7 @@ async def test_start_charging_action(
await hass.services.async_call(
DOMAIN,
SERVICE_START_CHARGE_SESSION,
"start_charge_session",
{
CONF_DEVICE_ID: list(device_registry.devices)[0],
CHARGING_CARD_ID: "TEST_CARD",
@@ -144,7 +140,7 @@ async def test_start_charging_action_without_card(
await hass.services.async_call(
DOMAIN,
SERVICE_START_CHARGE_SESSION,
"start_charge_session",
{
CONF_DEVICE_ID: list(device_registry.devices)[0],
},
@@ -166,7 +162,7 @@ async def test_start_charging_action_errors(
# No device id
await hass.services.async_call(
DOMAIN,
SERVICE_START_CHARGE_SESSION,
"start_charge_session",
{},
blocking=True,
)
@@ -175,7 +171,7 @@ async def test_start_charging_action_errors(
# Invalid device id
await hass.services.async_call(
DOMAIN,
SERVICE_START_CHARGE_SESSION,
"start_charge_session",
{CONF_DEVICE_ID: "INVALID"},
blocking=True,
)
@@ -192,7 +188,7 @@ async def test_start_charging_action_errors(
):
await hass.services.async_call(
DOMAIN,
SERVICE_START_CHARGE_SESSION,
"start_charge_session",
{
CONF_DEVICE_ID: list(device_registry.devices)[0],
},
@@ -212,7 +208,7 @@ async def test_start_charging_action_errors(
):
await hass.services.async_call(
DOMAIN,
SERVICE_START_CHARGE_SESSION,
"start_charge_session",
{
CONF_DEVICE_ID: list(device_registry.devices)[0],
},