forked from platypush/platypush
Added percent
entity to cpu
.
This commit is contained in:
parent
711cc2b239
commit
b4fbd3e915
2 changed files with 7 additions and 0 deletions
|
@ -792,6 +792,7 @@ class SystemPlugin(SensorPlugin, EntityManager):
|
||||||
'cpu': {
|
'cpu': {
|
||||||
'info': self._cpu_info,
|
'info': self._cpu_info,
|
||||||
'times': self._cpu_times_avg(),
|
'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()
|
for key, time_percent in cpu['times'].items()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
PercentSensor(
|
||||||
|
id='system:cpu:percent',
|
||||||
|
name='Percent',
|
||||||
|
value=cpu['percent'],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
|
@ -197,6 +197,7 @@ class CpuData:
|
||||||
|
|
||||||
info: CpuInfo
|
info: CpuInfo
|
||||||
times: CpuTimes
|
times: CpuTimes
|
||||||
|
percent: float = percent_field()
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|
Loading…
Reference in a new issue