Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: frontend: components: SystemCondition: Improve temperature code #2485

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -107,17 +107,17 @@ export default Vue.extend({
}
},
temperature(): Record<string, unknown> {
// Temperature data
const temperature_sensors = system_information.system?.temperature
const main_sensor = temperature_sensors?.find((sensor) => sensor.name === 'CPU')
const main_temperature = main_sensor ? main_sensor.temperature.toFixed(1) : 'Loading..'
const temperature_text = temperature_sensors ? temperature_sensors.map(
const main_sensor = temperature_sensors?.find((sensor) => sensor.name.toLowerCase().includes('cpu'))
const main_temperature = main_sensor?.temperature.toFixed(1) ?? 'Loading..'
console.log(`main_temperature: ${main_temperature}`)
const temperature_text = temperature_sensors?.map(
(sensor) => {
const critical_temp = sensor.critical_temperature || 0
return `${sensor.name} ${sensor.temperature.toFixed(1)}ºC`
+ `, Max: ${sensor.maximum_temperature.toFixed(1)}ºC, Crit: ${critical_temp.toFixed(1)}ºC`
},
).join('<br/>') : 'Loading..'
).join('<br/>') ?? 'Loading..'

return {
name: 'Temperature',
Expand Down