From 8bf6aba1cf44ee841de063755c935ea78040f399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Sat, 1 Jan 2022 13:11:56 +0100 Subject: [PATCH] Mill use walrus operator (#63166) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Mill use walrus operator Signed-off-by: Daniel Hjelseth Høyer * Mill use walrus operator Signed-off-by: Daniel Hjelseth Høyer --- homeassistant/components/mill/climate.py | 3 +-- homeassistant/components/mill/sensor.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/mill/climate.py b/homeassistant/components/mill/climate.py index f78133d8e5b..8a7fc77ea31 100644 --- a/homeassistant/components/mill/climate.py +++ b/homeassistant/components/mill/climate.py @@ -205,8 +205,7 @@ class LocalMillHeater(CoordinatorEntity, ClimateEntity): """Initialize the thermostat.""" super().__init__(coordinator) self._attr_name = coordinator.mill_data_connection.name - if coordinator.mill_data_connection.mac_address: - mac = self.coordinator.mill_data_connection.mac_address + if mac := coordinator.mill_data_connection.mac_address: self._attr_unique_id = mac self._attr_device_info = DeviceInfo( connections={(CONNECTION_NETWORK_MAC, mac)}, diff --git a/homeassistant/components/mill/sensor.py b/homeassistant/components/mill/sensor.py index 5925650ed65..376ef33f987 100644 --- a/homeassistant/components/mill/sensor.py +++ b/homeassistant/components/mill/sensor.py @@ -203,8 +203,7 @@ class LocalMillSensor(CoordinatorEntity, SensorEntity): self._attr_name = ( f"{coordinator.mill_data_connection.name} {entity_description.name}" ) - if coordinator.mill_data_connection.mac_address: - mac = self.coordinator.mill_data_connection.mac_address + if mac := coordinator.mill_data_connection.mac_address: self._attr_unique_id = f"{mac}_{entity_description.key}" self._attr_device_info = DeviceInfo( connections={(CONNECTION_NETWORK_MAC, mac)},