From 216a174cba645d5866c34af306000f052b76f1d4 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Mon, 4 Sep 2023 22:35:58 +0200 Subject: [PATCH] Move variables out of constructor in nightscout (#99612) * Move variables out of constructor in nightscout * Update homeassistant/components/nightscout/sensor.py Co-authored-by: G Johansson --------- Co-authored-by: G Johansson --- homeassistant/components/nightscout/sensor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/nightscout/sensor.py b/homeassistant/components/nightscout/sensor.py index 795e7b17a16..f60c70cc67c 100644 --- a/homeassistant/components/nightscout/sensor.py +++ b/homeassistant/components/nightscout/sensor.py @@ -37,15 +37,15 @@ async def async_setup_entry( class NightscoutSensor(SensorEntity): """Implementation of a Nightscout sensor.""" + _attr_native_unit_of_measurement = "mg/dL" + _attr_icon = "mdi:cloud-question" + def __init__(self, api: NightscoutAPI, name, unique_id) -> None: """Initialize the Nightscout sensor.""" self.api = api self._attr_unique_id = unique_id self._attr_name = name self._attr_extra_state_attributes: dict[str, Any] = {} - self._attr_native_unit_of_measurement = "mg/dL" - self._attr_icon = "mdi:cloud-question" - self._attr_available = False async def async_update(self) -> None: """Fetch the latest data from Nightscout REST API and update the state."""