diff --git a/platypush/plugins/system/__init__.py b/platypush/plugins/system/__init__.py index 07620623..09b01570 100644 --- a/platypush/plugins/system/__init__.py +++ b/platypush/plugins/system/__init__.py @@ -792,6 +792,7 @@ class SystemPlugin(SensorPlugin, EntityManager): 'cpu': { 'info': self._cpu_info, 'times': self._cpu_times_avg(), + 'percent': self.cpu_percent().output / 100.0, # type: ignore }, } ) @@ -824,6 +825,11 @@ class SystemPlugin(SensorPlugin, EntityManager): for key, time_percent in cpu['times'].items() ], ), + PercentSensor( + id='system:cpu:percent', + name='Percent', + value=cpu['percent'], + ), ], ) ] diff --git a/platypush/schemas/system.py b/platypush/schemas/system.py index 0acd0ba7..c123ca64 100644 --- a/platypush/schemas/system.py +++ b/platypush/schemas/system.py @@ -197,6 +197,7 @@ class CpuData: info: CpuInfo times: CpuTimes + percent: float = percent_field() @dataclass