Creating CPU Temperature Icon which displays only when temperature is too high.

This commit is contained in:
Roland 2023-08-13 10:54:43 -06:00
parent e2535a49ee
commit 1e4644e15c
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
5 changed files with 77 additions and 19 deletions

View file

@ -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({});