mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 12:26:19 -05:00
Creating CPU Temperature Icon which displays only when temperature is too high.
This commit is contained in:
parent
e2535a49ee
commit
1e4644e15c
5 changed files with 77 additions and 19 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import {useContext, useEffect, useRef, useState} from "react";
|
||||
import React, {useContext, useEffect, useRef, useState} from "react";
|
||||
import {
|
||||
fetchDecoded,
|
||||
fetchDomains,
|
||||
|
|
@ -742,6 +742,15 @@ export const useStatusFlag = (flag) => {
|
|||
return status && status['flags'] && status['flags'].indexOf(flag) >= 0;
|
||||
}
|
||||
|
||||
export const useCPUTemperature = () => {
|
||||
const {status} = React.useContext(StatusContext);
|
||||
const temperature = status && status['cpu_info'] ? status['cpu_info']['temperature'] : 0;
|
||||
const high_temperature = status && status['cpu_info'] ? status['cpu_info']['high_temperature'] : 75;
|
||||
const critical_temperature = status && status['cpu_info'] ? status['cpu_info']['critical_temperature'] : 85;
|
||||
|
||||
return {temperature, high_temperature, critical_temperature}
|
||||
}
|
||||
|
||||
|
||||
export const useVideoStatistics = () => {
|
||||
const [statistics, setStatistics] = useState({});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue