Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions homeassistant/components/matter/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def _update_from_device(self) -> None:
entity_description=MatterBinarySensorEntityDescription(
key="HueMotionSensor",
device_class=BinarySensorDeviceClass.MOTION,
name="Motion",
measurement_to_ha=lambda x: (x & 1 == 1) if x is not None else None,
),
entity_class=MatterBinarySensor,
Expand All @@ -78,7 +77,6 @@ def _update_from_device(self) -> None:
entity_description=MatterBinarySensorEntityDescription(
key="ContactSensor",
device_class=BinarySensorDeviceClass.DOOR,
name="Contact",
Comment thread
frenck marked this conversation as resolved.
# value is inverted on matter to what we expect
measurement_to_ha=lambda x: not x,
),
Expand All @@ -90,7 +88,6 @@ def _update_from_device(self) -> None:
entity_description=MatterBinarySensorEntityDescription(
key="OccupancySensor",
device_class=BinarySensorDeviceClass.OCCUPANCY,
name="Occupancy",
# The first bit = if occupied
measurement_to_ha=lambda x: (x & 1 == 1) if x is not None else None,
),
Expand All @@ -102,7 +99,6 @@ def _update_from_device(self) -> None:
entity_description=MatterBinarySensorEntityDescription(
key="BatteryChargeLevel",
device_class=BinarySensorDeviceClass.BATTERY,
name="Battery Status",
measurement_to_ha=lambda x: x
!= clusters.PowerSource.Enums.BatChargeLevelEnum.kOk,
),
Expand Down
12 changes: 8 additions & 4 deletions homeassistant/components/matter/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def _update_from_device(self) -> None:
DISCOVERY_SCHEMAS = [
MatterDiscoverySchema(
platform=Platform.COVER,
entity_description=CoverEntityDescription(key="MatterCover"),
entity_description=CoverEntityDescription(key="MatterCover", name=None),
entity_class=MatterCover,
required_attributes=(
clusters.WindowCovering.Attributes.OperationalStatus,
Expand All @@ -212,7 +212,9 @@ def _update_from_device(self) -> None:
),
MatterDiscoverySchema(
platform=Platform.COVER,
entity_description=CoverEntityDescription(key="MatterCoverPositionAwareLift"),
entity_description=CoverEntityDescription(
key="MatterCoverPositionAwareLift", name=None
),
entity_class=MatterCover,
required_attributes=(
clusters.WindowCovering.Attributes.OperationalStatus,
Expand All @@ -225,7 +227,9 @@ def _update_from_device(self) -> None:
),
MatterDiscoverySchema(
platform=Platform.COVER,
entity_description=CoverEntityDescription(key="MatterCoverPositionAwareTilt"),
entity_description=CoverEntityDescription(
key="MatterCoverPositionAwareTilt", name=None
),
entity_class=MatterCover,
required_attributes=(
clusters.WindowCovering.Attributes.OperationalStatus,
Expand All @@ -239,7 +243,7 @@ def _update_from_device(self) -> None:
MatterDiscoverySchema(
platform=Platform.COVER,
entity_description=CoverEntityDescription(
key="MatterCoverPositionAwareLiftAndTilt"
key="MatterCoverPositionAwareLiftAndTilt", name=None
),
entity_class=MatterCover,
required_attributes=(
Expand Down
16 changes: 11 additions & 5 deletions homeassistant/components/matter/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def _update_from_device(self) -> None:
DISCOVERY_SCHEMAS = [
MatterDiscoverySchema(
platform=Platform.LIGHT,
entity_description=LightEntityDescription(key="MatterLight"),
entity_description=LightEntityDescription(key="MatterLight", name=None),
entity_class=MatterLight,
required_attributes=(clusters.OnOff.Attributes.OnOff,),
optional_attributes=(
Expand All @@ -380,7 +380,9 @@ def _update_from_device(self) -> None:
# Additional schema to match (HS Color) lights with incorrect/missing device type
MatterDiscoverySchema(
platform=Platform.LIGHT,
entity_description=LightEntityDescription(key="MatterHSColorLightFallback"),
entity_description=LightEntityDescription(
key="MatterHSColorLightFallback", name=None
),
entity_class=MatterLight,
required_attributes=(
clusters.OnOff.Attributes.OnOff,
Expand All @@ -398,7 +400,9 @@ def _update_from_device(self) -> None:
# Additional schema to match (XY Color) lights with incorrect/missing device type
MatterDiscoverySchema(
platform=Platform.LIGHT,
entity_description=LightEntityDescription(key="MatterXYColorLightFallback"),
entity_description=LightEntityDescription(
key="MatterXYColorLightFallback", name=None
),
entity_class=MatterLight,
required_attributes=(
clusters.OnOff.Attributes.OnOff,
Expand All @@ -417,7 +421,7 @@ def _update_from_device(self) -> None:
MatterDiscoverySchema(
platform=Platform.LIGHT,
entity_description=LightEntityDescription(
key="MatterColorTemperatureLightFallback"
key="MatterColorTemperatureLightFallback", name=None
),
entity_class=MatterLight,
required_attributes=(
Expand All @@ -430,7 +434,9 @@ def _update_from_device(self) -> None:
# Additional schema to match generic dimmable lights with incorrect/missing device type
MatterDiscoverySchema(
platform=Platform.LIGHT,
entity_description=LightEntityDescription(key="MatterDimmableLightFallback"),
entity_description=LightEntityDescription(
key="MatterDimmableLightFallback", name=None
),
entity_class=MatterLight,
required_attributes=(
clusters.OnOff.Attributes.OnOff,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/matter/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class DoorLockFeature(IntFlag):
DISCOVERY_SCHEMAS = [
MatterDiscoverySchema(
platform=Platform.LOCK,
entity_description=LockEntityDescription(key="MatterLock"),
entity_description=LockEntityDescription(key="MatterLock", name=None),
entity_class=MatterLock,
required_attributes=(clusters.DoorLock.Attributes.LockState,),
optional_attributes=(clusters.DoorLock.Attributes.DoorState,),
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/matter/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def _update_from_device(self) -> None:
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="TemperatureSensor",
name="Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
measurement_to_ha=lambda x: x / 100,
Expand All @@ -80,7 +79,6 @@ def _update_from_device(self) -> None:
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="PressureSensor",
name="Pressure",
native_unit_of_measurement=UnitOfPressure.KPA,
device_class=SensorDeviceClass.PRESSURE,
measurement_to_ha=lambda x: x / 10,
Expand All @@ -92,9 +90,8 @@ def _update_from_device(self) -> None:
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="FlowSensor",
name="Flow",
Comment thread
frenck marked this conversation as resolved.
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
device_class=SensorDeviceClass.WATER, # what is the device class here ?
translation_key="flow",
measurement_to_ha=lambda x: x / 10,
),
entity_class=MatterSensor,
Expand All @@ -104,7 +101,6 @@ def _update_from_device(self) -> None:
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="HumiditySensor",
name="Humidity",
native_unit_of_measurement=PERCENTAGE,
device_class=SensorDeviceClass.HUMIDITY,
measurement_to_ha=lambda x: x / 100,
Expand All @@ -118,7 +114,6 @@ def _update_from_device(self) -> None:
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="LightSensor",
name="Illuminance",
native_unit_of_measurement=LIGHT_LUX,
device_class=SensorDeviceClass.ILLUMINANCE,
measurement_to_ha=lambda x: round(pow(10, ((x - 1) / 10000)), 1),
Expand All @@ -130,7 +125,6 @@ def _update_from_device(self) -> None:
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="PowerSource",
name="Battery",
native_unit_of_measurement=PERCENTAGE,
device_class=SensorDeviceClass.BATTERY,
# value has double precision
Expand Down
7 changes: 7 additions & 0 deletions homeassistant/components/matter/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,12 @@
"install_addon": "Please wait while the Matter Server add-on installation finishes. This can take several minutes.",
"start_addon": "Please wait while the Matter Server add-on starts. This add-on is what powers Matter in Home Assistant. This may take some seconds."
}
},
"entity": {
"sensor": {
"flow": {
"name": "Flow"
}
}
}
}
2 changes: 1 addition & 1 deletion homeassistant/components/matter/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _update_from_device(self) -> None:
MatterDiscoverySchema(
platform=Platform.SWITCH,
entity_description=SwitchEntityDescription(
key="MatterPlug", device_class=SwitchDeviceClass.OUTLET
key="MatterPlug", device_class=SwitchDeviceClass.OUTLET, name=None
),
entity_class=MatterSwitch,
required_attributes=(clusters.OnOff.Attributes.OnOff,),
Expand Down
4 changes: 2 additions & 2 deletions tests/components/matter/test_binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def test_contact_sensor(
contact_sensor_node: MatterNode,
) -> None:
"""Test contact sensor."""
state = hass.states.get("binary_sensor.mock_contact_sensor_contact")
state = hass.states.get("binary_sensor.mock_contact_sensor_door")
assert state
assert state.state == "off"

Expand All @@ -40,7 +40,7 @@ async def test_contact_sensor(
hass, matter_client, data=(contact_sensor_node.node_id, "1/69/0", False)
)

state = hass.states.get("binary_sensor.mock_contact_sensor_contact")
state = hass.states.get("binary_sensor.mock_contact_sensor_door")
assert state
assert state.state == "on"

Expand Down