small changes that came up in implementing tests

This commit is contained in:
Bas Nijholt 2020-10-19 20:43:58 +02:00
commit 5aed27eb0a
3 changed files with 2 additions and 19 deletions

View file

@ -84,7 +84,7 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
"""Handle options flow."""
conf = self.config_entry
if conf.source == config_entries.SOURCE_IMPORT:
return self.async_show_form(step_id="init", data_schema={})
return self.async_show_form(step_id="init", data_schema=None)
errors = {}
if user_input is not None:
validate_options(user_input, errors)

View file

@ -86,11 +86,6 @@ def timedelta_as_int(value):
return value.total_seconds()
def join_strings(lst):
"""Join a list to comma-separated values string."""
return ",".join(lst)
# conf_option: (validator, coerce) tuples
# these validators cannot be serialized but can be serialized when coerced by coerce.
EXTRA_VALIDATION = {

View file

@ -17,10 +17,6 @@ from typing import Any, Dict, List, Optional, Tuple, Union
import astral
import voluptuous as vol
from homeassistant.components.homeassistant import (
DOMAIN as HA_DOMAIN,
SERVICE_UPDATE_ENTITY,
)
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
@ -158,8 +154,6 @@ def is_our_context(context: Optional[Context]) -> bool:
async def handle_apply(switch: AdaptiveSwitch, service_call: ServiceCall):
"""Handle the entity service apply."""
if not isinstance(switch, AdaptiveSwitch):
raise ValueError("Apply can only be called for a AdaptiveSwitch.")
hass = switch.hass
data = service_call.data
all_lights = _expand_light_groups(hass, data[CONF_LIGHTS])
@ -1173,13 +1167,7 @@ class TurnOnOffListener:
if light not in self.last_state_change:
return False
old_states: List[State] = self.last_state_change[light]
await self.hass.services.async_call(
HA_DOMAIN,
SERVICE_UPDATE_ENTITY,
{ATTR_ENTITY_ID: light},
blocking=True,
context=context,
)
await self.hass.helpers.entity_component.async_update_entity(light)
new_state = self.hass.states.get(light)
compare_to = functools.partial(
_attributes_have_changed,