telegraf_to_vu1/dial_configs/MEMUsage.py
2024-12-02 18:28:01 +01:00

17 lines
545 B
Python

from dial_configs.dial_config import DialConfig
class MEMUsage(DialConfig):
def __init__(self, target_dial, asset_path):
super().__init__(target_dial, asset_path, "mem.png")
def transform_color(self, value):
return super().Colors.get_gradient_color(self, value, 30, 0)
def transform_value(self, json_data):
return int(json_data.get("fields", {}).get("used_percent", 100))
def __eq__(self, other):
try:
return (other.get("name", "") == "mem")
except Exception:
return False