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 <goran.johansson@shiftit.se>

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
Joost Lekkerkerker 2023-09-04 22:35:58 +02:00 committed by GitHub
parent b8f35fb577
commit 216a174cba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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."""