Add measurement to TrafficSensor

Enables the usage of TrafficSensor within the statistics card
This commit is contained in:
Marti Markov 2021-11-07 17:07:43 +00:00 committed by GitHub
parent 3e4223c525
commit 526b29ca67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -478,6 +478,11 @@ 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"""
return f"measurement"
@property
def device_info(self) -> Dict[str, Any]: