Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bramstroker/homeassistant-powercalc
Browse files Browse the repository at this point in the history
  • Loading branch information
bramstroker committed Sep 23, 2022
2 parents 33c3e86 + f6a6828 commit 3dca698
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 5 additions & 3 deletions custom_components/powercalc/config_flow.py
Expand Up @@ -62,9 +62,9 @@
SensorType,
)
from .errors import ModelNotSupported, StrategyConfigurationError
from .power_profile.power_profile import PowerProfile
from .power_profile.library import ModelInfo, ProfileLibrary
from .power_profile.model_discovery import get_power_profile
from .power_profile.power_profile import PowerProfile
from .sensors.daily_energy import DEFAULT_DAILY_UPDATE_FREQUENCY
from .strategy.factory import PowerCalculatorStrategyFactory
from .strategy.strategy_interface import PowerCalculationStrategyInterface
Expand Down Expand Up @@ -199,7 +199,9 @@ async def async_step_integration_discovery(
) -> FlowResult:
"""Handle integration discovery."""

self.skip_advanced_step = True # We don't want to ask advanced option when discovered
self.skip_advanced_step = (
True # We don't want to ask advanced option when discovered
)
self.sensor_config.update(discovery_info)
self.selected_sensor_type = SensorType.VIRTUAL_POWER
self.name = discovery_info[CONF_NAME]
Expand Down Expand Up @@ -356,7 +358,7 @@ async def async_step_lut(self, user_input: dict[str, str] = None) -> FlowResult:
self.sensor_config.update(
{
CONF_MANUFACTURER: self.power_profile.manufacturer,
CONF_MODEL: self.power_profile.model
CONF_MODEL: self.power_profile.model,
}
)
return await self.async_step_power_advanced()
Expand Down
9 changes: 4 additions & 5 deletions tests/test_config_flow.py
Expand Up @@ -86,7 +86,9 @@ async def test_discovery_flow(hass: HomeAssistant):

# Confirm selected manufacturer/model
assert result["type"] == data_entry_flow.FlowResultType.FORM
result = await hass.config_entries.flow.async_configure(result["flow_id"], {CONF_CONFIRM_AUTODISCOVERED_MODEL: True})
result = await hass.config_entries.flow.async_configure(
result["flow_id"], {CONF_CONFIRM_AUTODISCOVERED_MODEL: True}
)

assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["data"] == {
Expand Down Expand Up @@ -280,10 +282,7 @@ async def test_lut_autodiscover_flow(hass: HomeAssistant):
_assert_default_virtual_power_entry_data(
CalculationStrategy.LUT,
result["data"],
{
CONF_MANUFACTURER: light_entity.manufacturer,
CONF_MODEL: light_entity.model
}
{CONF_MANUFACTURER: light_entity.manufacturer, CONF_MODEL: light_entity.model},
)

await hass.async_block_till_done()
Expand Down

0 comments on commit 3dca698

Please sign in to comment.