Skip to content

Commit

Permalink
fix: Add support for 2022.1
Browse files Browse the repository at this point in the history
  • Loading branch information
eifinger committed Dec 27, 2021
1 parent 7a5f294 commit d4e4f31
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion custom_components/weenect/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
17 changes: 9 additions & 8 deletions custom_components/weenect/entity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""weenect class"""
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions custom_components/weenect/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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]
Expand All @@ -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]
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"sensor"
],
"iot_class": "Cloud Polling",
"homeassistant": "2021.5.0"
"homeassistant": "2021.12.0"
}

0 comments on commit d4e4f31

Please sign in to comment.