From 0b63510cab085b9b7e57d27e2b2ccae4c891ce44 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Mon, 1 Feb 2021 02:45:24 -0600 Subject: [PATCH] Add zwave_js binary sensors property name for Notification CC (#45810) --- homeassistant/components/zwave_js/binary_sensor.py | 8 ++++++++ tests/components/zwave_js/common.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/zwave_js/binary_sensor.py b/homeassistant/components/zwave_js/binary_sensor.py index 6dc5cc58df5..42394fe127c 100644 --- a/homeassistant/components/zwave_js/binary_sensor.py +++ b/homeassistant/components/zwave_js/binary_sensor.py @@ -349,6 +349,14 @@ class ZWaveNotificationBinarySensor(ZWaveBaseEntity, BinarySensorEntity): return self.info.primary_value.value in self._mapping_info["states"] return bool(self.info.primary_value.value != 0) + @property + def name(self) -> str: + """Return default name from device name and value name combination.""" + node_name = self.info.node.name or self.info.node.device_config.description + property_name = self.info.primary_value.property_name + property_key_name = self.info.primary_value.property_key_name + return f"{node_name}: {property_name}: {property_key_name}" + @property def device_class(self) -> Optional[str]: """Return device class.""" diff --git a/tests/components/zwave_js/common.py b/tests/components/zwave_js/common.py index a7be137657c..399b009f4c2 100644 --- a/tests/components/zwave_js/common.py +++ b/tests/components/zwave_js/common.py @@ -6,7 +6,9 @@ SWITCH_ENTITY = "switch.smart_plug_with_two_usb_ports_current_value" LOW_BATTERY_BINARY_SENSOR = "binary_sensor.multisensor_6_low_battery_level" ENABLED_LEGACY_BINARY_SENSOR = "binary_sensor.z_wave_door_window_sensor_any" DISABLED_LEGACY_BINARY_SENSOR = "binary_sensor.multisensor_6_any" -NOTIFICATION_MOTION_BINARY_SENSOR = "binary_sensor.multisensor_6_motion_sensor_status" +NOTIFICATION_MOTION_BINARY_SENSOR = ( + "binary_sensor.multisensor_6_home_security_motion_sensor_status" +) PROPERTY_DOOR_STATUS_BINARY_SENSOR = ( "binary_sensor.august_smart_lock_pro_3rd_gen_the_current_status_of_the_door" )