diff --git a/custom_components/libreview/const.py b/custom_components/libreview/const.py index f295424..d494994 100755 --- a/custom_components/libreview/const.py +++ b/custom_components/libreview/const.py @@ -25,7 +25,13 @@ 4: "mdi:arrow-top-right-thick", 5: "mdi:arrow-up-thick", } - +TREND_MESSAGE = { + 1: "decreasing_fast", + 2: "decreasing", + 3: "stable", + 4: "increasing", + 5: "increasing_fast", +} class GlucoseUnitOfMeasurement(Enum): MMOLL = "mmol/L" diff --git a/custom_components/libreview/sensor.py b/custom_components/libreview/sensor.py index 2975a3b..92ec566 100644 --- a/custom_components/libreview/sensor.py +++ b/custom_components/libreview/sensor.py @@ -149,4 +149,6 @@ def extra_state_attributes(self) -> Dict[str, int | float]: "target_low_mmol_l": round(self.connection.target_low / 18, 1), "target_high_mg_dl": self.connection.target_high, "target_low_mg_dl": self.connection.target_low, + "trend": TREND_MESSAGE.get(self.trend_arrow, "unknown"), + "measurement_timestamp": self.gcm.factory_timestamp.replace(tzinfo=UTC), }