diff --git a/custom_components/weenect/const.py b/custom_components/weenect/const.py index a4335bd..c9a0716 100644 --- a/custom_components/weenect/const.py +++ b/custom_components/weenect/const.py @@ -12,7 +12,7 @@ NAME = "Weenect" DOMAIN = "weenect" DOMAIN_DATA = f"{DOMAIN}_data" -VERSION = "2.0.3" +VERSION = "2.0.4" ATTRIBUTION = "Data provided by https://my.weenect.com/" ISSUE_URL = "https://github.com/eifinger/hass-weenect/issues" diff --git a/custom_components/weenect/entity.py b/custom_components/weenect/entity.py index 8ef7921..a34f6fc 100644 --- a/custom_components/weenect/entity.py +++ b/custom_components/weenect/entity.py @@ -1,4 +1,5 @@ """weenect class""" +from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -51,16 +52,16 @@ def unique_id(self): @property def device_info(self): - return { - "identifiers": {(DOMAIN, self.id)}, - "name": self.device_name, - "model": self.tracker_type, - "manufacturer": NAME, - "sw_version": self.firmware, - } + return DeviceInfo( + identifiers={(DOMAIN, self.id)}, + name=self.device_name, + model=self.tracker_type, + manufacturer=NAME, + sw_version=self.firmware, + ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { "attribution": ATTRIBUTION, diff --git a/custom_components/weenect/sensor.py b/custom_components/weenect/sensor.py index 5bf0c11..f83996d 100644 --- a/custom_components/weenect/sensor.py +++ b/custom_components/weenect/sensor.py @@ -85,7 +85,7 @@ def entity_registry_enabled_default(self) -> bool: return self._enabled @property - def unit_of_measurement(self): + def native_unit_of_measurement(self): """Return the units of measurement.""" return self._unit_of_measurement @@ -94,7 +94,7 @@ class WeenectSensor(WeenectSensorBase): """weenect sensor for general informatio.""" @property - def state(self): + def native_value(self): """Return the state of the resources if it has been received yet.""" if self.id in self.coordinator.data: return self.coordinator.data[self.id][self._value_name] @@ -104,7 +104,7 @@ class WeenectLocationSensor(WeenectSensorBase): """weenect sensor for location informatio.""" @property - def state(self): + def native_value(self): """Return the state of the resources if it has been received yet.""" if self.id in self.coordinator.data: return self.coordinator.data[self.id]["position"][0][self._value_name] diff --git a/hacs.json b/hacs.json index 31b4c4d..c87f3ea 100644 --- a/hacs.json +++ b/hacs.json @@ -7,5 +7,5 @@ "sensor" ], "iot_class": "Cloud Polling", - "homeassistant": "2021.5.0" + "homeassistant": "2021.12.0" } \ No newline at end of file