Skip to content

Commit

Permalink
Add swap usage
Browse files Browse the repository at this point in the history
  • Loading branch information
cyr-ius committed Dec 21, 2023
1 parent 5bb0806 commit cceba6f
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions custom_components/truenas/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class TruenasSensorEntityDescription(SensorEntityDescription):
entity_category=EntityCategory.DIAGNOSTIC,
category="System",
refer="system_infos",
attr="memory-usage_percent",
attr="memory_usage_percent",
extra_attributes=EXTRA_ATTRS_MEMORY,
),
TruenasSensorEntityDescription(
Expand All @@ -151,38 +151,50 @@ class TruenasSensorEntityDescription(SensorEntityDescription):
entity_category=EntityCategory.DIAGNOSTIC,
category="System",
refer="system_infos",
attr="cache_size-arc_value",
),
TruenasSensorEntityDescription(
key="system_cache_size-L2_value",
name="L2ARC size",
icon="mdi:memory",
native_unit_of_measurement=UnitOfInformation.GIBIBYTES,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
category="System",
refer="system_infos",
attr="cache_size-L2_value",
attr="memory_arc_size",
),
# TruenasSensorEntityDescription(
# key="system_cache_size-L2_value",
# name="L2ARC size",
# icon="mdi:memory",
# native_unit_of_measurement=UnitOfInformation.GIBIBYTES,
# state_class=SensorStateClass.MEASUREMENT,
# entity_category=EntityCategory.DIAGNOSTIC,
# category="System",
# refer="system_infos",
# attr="memory_arc_size",
# ),
TruenasSensorEntityDescription(
key="system_cache_ratio-arc_value",
name="ARC ratio",
icon="mdi:aspect-ratio",
native_unit_of_measurement=PERCENTAGE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
category="System",
refer="system_infos",
attr="cache_ratio-arc_value",
attr="arc_size_ratio",
),
# TruenasSensorEntityDescription(
# key="system_cache_ratio-L2_value",
# name="L2ARC ratio",
# icon="mdi:aspect-ratio",
# state_class=SensorStateClass.MEASUREMENT,
# entity_category=EntityCategory.DIAGNOSTIC,
# category="System",
# refer="system_infos",
# attr="cache_ratio-L2_value",
# ),
TruenasSensorEntityDescription(
key="system_cache_ratio-L2_value",
name="L2ARC ratio",
icon="mdi:aspect-ratio",
key="system_swap",
name="Swap used",
icon="mdi:memory",
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
native_unit_of_measurement=UnitOfInformation.BYTES,
category="System",
refer="system_infos",
attr="cache_ratio-L2_value",
attr="swap_used",
),
TruenasSensorEntityDescription(
key="pool_free",
Expand All @@ -204,7 +216,7 @@ class TruenasSensorEntityDescription(SensorEntityDescription):
state_class=SensorStateClass.MEASUREMENT,
category="System",
refer="interfaces",
attr="rx",
attr="received",
extra_attributes=EXTRA_ATTRS_NETWORK,
reference="id",
),
Expand All @@ -216,7 +228,7 @@ class TruenasSensorEntityDescription(SensorEntityDescription):
state_class=SensorStateClass.MEASUREMENT,
category="System",
refer="interfaces",
attr="tx",
attr="sent",
extra_attributes=EXTRA_ATTRS_NETWORK,
reference="id",
),
Expand Down

0 comments on commit cceba6f

Please sign in to comment.