diff --git a/custom_components/mikrotik_router/binary_sensor.py b/custom_components/mikrotik_router/binary_sensor.py index 1e29ba2..24b068c 100644 --- a/custom_components/mikrotik_router/binary_sensor.py +++ b/custom_components/mikrotik_router/binary_sensor.py @@ -246,7 +246,7 @@ class MikrotikControllerBinarySensor(BinarySensorEntity): return f"{self._inst} {self._type[ATTR_LABEL]}" @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the state attributes.""" return self._attrs @@ -356,7 +356,7 @@ class MikrotikControllerPPPSecretBinarySensor(MikrotikControllerBinarySensor): return "mdi:account-off-outline" @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the state attributes.""" attributes = self._attrs for variable in DEVICE_ATTRIBUTES_PPP_SECRET: @@ -450,7 +450,7 @@ class MikrotikControllerPortBinarySensor(MikrotikControllerBinarySensor): return icon @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the state attributes.""" attributes = self._attrs for variable in DEVICE_ATTRIBUTES_IFACE: diff --git a/custom_components/mikrotik_router/device_tracker.py b/custom_components/mikrotik_router/device_tracker.py index ff5d6da..11029bd 100644 --- a/custom_components/mikrotik_router/device_tracker.py +++ b/custom_components/mikrotik_router/device_tracker.py @@ -225,7 +225,7 @@ class MikrotikControllerDeviceTracker(ScannerEntity): return info @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the state attributes.""" attributes = self._attrs return attributes @@ -301,7 +301,7 @@ class MikrotikControllerHostDeviceTracker(MikrotikControllerDeviceTracker): return "mdi:lan-disconnect" @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the state attributes.""" attributes = self._attrs for variable in DEVICE_ATTRIBUTES_HOST: diff --git a/custom_components/mikrotik_router/sensor.py b/custom_components/mikrotik_router/sensor.py index 8520d95..943f29a 100644 --- a/custom_components/mikrotik_router/sensor.py +++ b/custom_components/mikrotik_router/sensor.py @@ -389,7 +389,7 @@ class MikrotikControllerSensor(SensorEntity): return val @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the state attributes.""" return self._attrs @@ -478,7 +478,7 @@ class MikrotikControllerTrafficSensor(MikrotikControllerSensor): def unique_id(self) -> str: """Return a unique id for this entity.""" return f"{self._inst.lower()}-{self._sensor.lower()}-{self._data['default-name'].lower()}" - + @property def state_class(self) -> str: """Return the state_class""" @@ -546,7 +546,7 @@ class MikrotikAccountingSensor(MikrotikControllerSensor): return info @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the state attributes.""" attributes = self._attrs for variable in DEVICE_ATTRIBUTES_ACCOUNTING: diff --git a/custom_components/mikrotik_router/switch.py b/custom_components/mikrotik_router/switch.py index fb7c877..aa35794 100644 --- a/custom_components/mikrotik_router/switch.py +++ b/custom_components/mikrotik_router/switch.py @@ -308,7 +308,7 @@ class MikrotikControllerSwitch(SwitchEntity, RestoreEntity): return self._data["enabled"] @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the state attributes.""" attributes = self._attrs @@ -348,7 +348,7 @@ class MikrotikControllerPortSwitch(MikrotikControllerSwitch): return f"{self._inst.lower()}-enable_switch-{self._data['port-mac-address']}_{self._data['default-name']}" @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the state attributes.""" attributes = self._attrs