Compare commits

..

4 Commits

Author SHA1 Message Date
Martin Hjelmare
cdda624d8a Bump zwave-js-server-python to 0.68.0 2026-01-14 11:15:55 +01:00
dependabot[bot]
20102cd83f Bump j178/prek-action from 1.0.11 to 1.0.12 (#160902)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-14 10:28:11 +01:00
Erik Montnemery
6d6324dae5 Fix some reversed asserts in sensor group tests (#160905) 2026-01-14 09:43:26 +01:00
Erik Montnemery
2ee5410a6c Remove set of _attr_extra_state_attributes in sensor group (#160846)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2026-01-14 09:21:54 +01:00
7 changed files with 31 additions and 36 deletions

View File

@@ -260,7 +260,7 @@ jobs:
run: |
echo "::add-matcher::.github/workflows/matchers/codespell.json"
- name: Run prek
uses: j178/prek-action@91fd7d7cf70ae1dee9f4f44e7dfa5d1073fe6623 # v1.0.11
uses: j178/prek-action@9d6a3097e0c1865ecce00cfb89fe80f2ee91b547 # v1.0.12
env:
PREK_SKIP: no-commit-to-branch,mypy,pylint,gen_requirements_all,hassfest,hassfest-metadata,hassfest-mypy-config
RUFF_OUTPUT_FORMAT: github

View File

@@ -346,7 +346,6 @@ class SensorGroup(GroupEntity, SensorEntity):
self._attr_name = name
if name == DEFAULT_NAME:
self._attr_name = f"{DEFAULT_NAME} {sensor_type}".capitalize()
self._attr_extra_state_attributes = {ATTR_ENTITY_ID: entity_ids}
self._attr_unique_id = unique_id
self._ignore_non_numeric = ignore_non_numeric
self.mode = all if ignore_non_numeric is False else any

View File

@@ -9,7 +9,7 @@
"integration_type": "hub",
"iot_class": "local_push",
"loggers": ["zwave_js_server"],
"requirements": ["pyserial==3.5", "zwave-js-server-python==0.67.1"],
"requirements": ["pyserial==3.5", "zwave-js-server-python==0.68.0"],
"usb": [
{
"known_devices": ["Aeotec Z-Stick Gen5+", "Z-WaveMe UZB"],

2
requirements_all.txt generated
View File

@@ -3291,7 +3291,7 @@ ziggo-mediabox-xl==1.1.0
zm-py==0.5.4
# homeassistant.components.zwave_js
zwave-js-server-python==0.67.1
zwave-js-server-python==0.68.0
# homeassistant.components.zwave_me
zwave-me-ws==0.4.3

View File

@@ -2746,7 +2746,7 @@ zeversolar==0.3.2
zha==0.0.84
# homeassistant.components.zwave_js
zwave-js-server-python==0.67.1
zwave-js-server-python==0.68.0
# homeassistant.components.zwave_me
zwave-me-ws==0.4.3

View File

@@ -215,14 +215,14 @@ async def test_not_enough_sensor_value(hass: HomeAssistant) -> None:
state = hass.states.get("sensor.test_max")
assert state.state not in [STATE_UNAVAILABLE, STATE_UNKNOWN]
assert entity_ids[1] == state.attributes.get("max_entity_id")
assert state.attributes.get("max_entity_id") == entity_ids[1]
hass.states.async_set(entity_ids[2], STATE_UNKNOWN)
await hass.async_block_till_done()
state = hass.states.get("sensor.test_max")
assert state.state not in [STATE_UNAVAILABLE, STATE_UNKNOWN]
assert entity_ids[1] == state.attributes.get("max_entity_id")
assert state.attributes.get("max_entity_id") == entity_ids[1]
hass.states.async_set(entity_ids[1], STATE_UNAVAILABLE)
await hass.async_block_till_done()
@@ -857,8 +857,8 @@ async def test_last_sensor(hass: HomeAssistant) -> None:
hass.states.async_set(entity_id, str(value))
await hass.async_block_till_done()
state = hass.states.get("sensor.test_last")
assert str(float(value)) == state.state
assert entity_id == state.attributes.get("last_entity_id")
assert state.state == str(float(value))
assert state.attributes.get("last_entity_id") == entity_id
async def test_sensors_attributes_added_when_entity_info_available(

View File

@@ -16,10 +16,6 @@ from homeassistant.const import (
STATE_ON,
)
from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.helpers.condition import (
ConditionCheckerTypeOptional,
async_from_config,
)
from homeassistant.setup import async_setup_component
from tests.components import (
@@ -75,22 +71,15 @@ async def setup_automation_with_light_condition(
)
async def create_condition(
hass: HomeAssistant,
*,
condition: str,
target: dict,
behavior: str,
) -> ConditionCheckerTypeOptional:
"""Set up automation with light state condition."""
return await async_from_config(
hass,
{
CONF_CONDITION: condition,
CONF_TARGET: target,
CONF_OPTIONS: {"behavior": behavior},
},
)
async def has_single_call_after_trigger(
hass: HomeAssistant, service_calls: list[ServiceCall]
) -> bool:
"""Check if there is a single service call after the trigger event."""
hass.bus.async_fire("test_event")
await hass.async_block_till_done()
num_calls = len(service_calls)
service_calls.clear()
return num_calls == 1
@pytest.fixture(name="enable_experimental_triggers_conditions")
@@ -147,6 +136,7 @@ async def test_light_conditions_gated_by_labs_flag(
)
async def test_light_state_condition_behavior_any(
hass: HomeAssistant,
service_calls: list[ServiceCall],
target_lights: list[str],
target_switches: list[str],
condition_target_config: dict,
@@ -164,7 +154,7 @@ async def test_light_state_condition_behavior_any(
set_or_remove_state(hass, eid, states[0]["included"])
await hass.async_block_till_done()
condition = await create_condition(
await setup_automation_with_light_condition(
hass,
condition=condition,
target=condition_target_config,
@@ -176,19 +166,25 @@ async def test_light_state_condition_behavior_any(
for eid in target_switches:
set_or_remove_state(hass, eid, state["included"])
await hass.async_block_till_done()
assert condition(hass) is False
assert not await has_single_call_after_trigger(hass, service_calls)
for state in states:
included_state = state["included"]
set_or_remove_state(hass, entity_id, included_state)
await hass.async_block_till_done()
assert condition(hass) == state["condition_true"]
assert (
await has_single_call_after_trigger(hass, service_calls)
== state["condition_true"]
)
# Check if changing other lights also passes the condition
for other_entity_id in other_entity_ids:
set_or_remove_state(hass, other_entity_id, included_state)
await hass.async_block_till_done()
assert condition(hass) == state["condition_true"]
assert (
await has_single_call_after_trigger(hass, service_calls)
== state["condition_true"]
)
@pytest.mark.usefixtures("enable_experimental_triggers_conditions")
@@ -234,7 +230,7 @@ async def test_light_state_condition_behavior_all(
set_or_remove_state(hass, eid, states[0]["included"])
await hass.async_block_till_done()
condition = await create_condition(
await setup_automation_with_light_condition(
hass,
condition=condition,
target=condition_target_config,
@@ -247,7 +243,7 @@ async def test_light_state_condition_behavior_all(
set_or_remove_state(hass, entity_id, included_state)
await hass.async_block_till_done()
# The condition passes if all entities are either in a target state or invalid
assert condition(hass) == (
assert await has_single_call_after_trigger(hass, service_calls) == (
(not state["state_valid"])
or (state["condition_true"] and entities_in_target == 1)
)
@@ -257,6 +253,6 @@ async def test_light_state_condition_behavior_all(
await hass.async_block_till_done()
# The condition passes if all entities are either in a target state or invalid
assert condition(hass) == (
assert await has_single_call_after_trigger(hass, service_calls) == (
(not state["state_valid"]) or state["condition_true"]
)