Skip to content

Commit

Permalink
Add test for custom naming pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
bramstroker committed Aug 26, 2022
1 parent d839c87 commit 63ccb45
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/sensors/test_group.py
Expand Up @@ -34,6 +34,7 @@
ATTR_ENTITIES,
CONF_CREATE_GROUP,
CONF_CREATE_UTILITY_METERS,
CONF_ENERGY_SENSOR_NAMING,
CONF_ENERGY_SENSOR_UNIT_PREFIX,
CONF_FIXED,
CONF_GROUP,
Expand Down Expand Up @@ -572,3 +573,24 @@ async def test_add_virtual_power_sensor_to_group_on_creation(hass: HomeAssistant
assert group_state.attributes.get("entities") == {
"sensor.virtualsensor1_power",
}


async def test_custom_naming_pattern(hass: HomeAssistant):
await create_input_booleans(hass, ["test1", "test2"])

await run_powercalc_setup_yaml_config(
hass,
{
CONF_PLATFORM: DOMAIN,
CONF_CREATE_GROUP: "TestGroup",
CONF_ENTITIES: [
get_simple_fixed_config("input_boolean.test1", 50),
get_simple_fixed_config("input_boolean.test2", 50),
],
CONF_ENERGY_SENSOR_NAMING: "{} - Energie"
},
)
energy_state = hass.states.get("sensor.testgroup_energie")
assert energy_state
assert energy_state.name == "TestGroup - Energie"
assert energy_state.attributes["friendly_name"] == "TestGroup - Energie"

0 comments on commit 63ccb45

Please sign in to comment.