Glances GPU and CPU
Node-RED

Glances GPU and CPU

# GPU and CPU Monitoring Flow The **GPU and CPU Monitoring** flow is a smart home automation solution that provides real-time tracking of your computer's GPU and CPU performance by integrating Glances on your gaming PC and connecting it to Home Assistant for seamless data transmission and visualization. This setup ensures you can monitor your system's performance directly within your smart home environment, enhancing both convenience and system management. https://github.com/hendkai/awtrix_node_red/tree/main
A flow by Hendrik Kaiser

Download flow

Flow Details

Install Icon 39900.

Overview

The GPU and CPU Monitoring flow is designed to monitor the performance of your GPU and CPU in real-time using connected sensors. This guide focuses on configuring the flow with your specific device details and security settings, specifically when using Glances to send data from your gaming PC to Home Assistant.

Steps to Configure the Flow

  1. Install and Configure Glances:

    • Ensure Glances is installed on your gaming PC. You can install it via pip:
      pip install glances
      
    • Configure Glances to expose the necessary metrics (GPU and CPU usage) via its API.
  2. Add Glances to Home Assistant:

    • In Home Assistant, navigate to the "Integrations" page.
    • Search for and add the "Glances" integration.
    • Configure the integration with the IP address and port of your gaming PC where Glances is running.
  3. Identify Device IP Addresses:

    • Find the IP addresses of your gaming PC where Glances is running. This info is usually in device settings or network management tools.
  4. Input Device IP Addresses:

    • Go to the flow settings in your smart home control panel.
    • Add the IP addresses of your gaming PC under "Device Management" or "Network Settings."
  5. Set Up Bearer Token:

    • Generate a bearer token from your smart home system or service provider for API authentication.
    • Enter this token in the flow settings under "Security" or "Authentication" to secure data transmission.
  6. Test the Setup:

    • Verify that the flow communicates correctly with your gaming PC and that data is securely transmitted.

By completing these steps, you ensure the GPU and CPU Monitoring flow operates effectively with your specific smart home devices and security configurations, leveraging Glances for data collection.

[{"id":"27e9be846c2ebce9","type":"tab","label":"Show GPU and CPU","disabled":false,"info":"","env":[]},{"id":"d0df86f57e017e5a","type":"inject","z":"27e9be846c2ebce9","name":"1x/10min","props":[{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":"1","topic":"gpucpu","x":230,"y":240,"wires":[["b4be4d173c51f4fb","f524228265c22d31"]]},{"id":"b4be4d173c51f4fb","type":"api-current-state","z":"27e9be846c2ebce9","name":"","server":"36cc9f18.c96dd","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.192_168_1_157_amd_gpu_gpu_amd0_prozessorauslastung","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":610,"y":80,"wires":[["869df1d1dc5dd7a0"]]},{"id":"f524228265c22d31","type":"api-current-state","z":"27e9be846c2ebce9","name":"","server":"36cc9f18.c96dd","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.192_168_1_157_cpu_auslastung","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":520,"y":300,"wires":[["0d3a1ab68e3525e9"]]},{"id":"869df1d1dc5dd7a0","type":"function","z":"27e9be846c2ebce9","name":"Data","func":"msg.payload = { gpu: msg.payload };\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":990,"y":80,"wires":[["68a1649d86ae4a92"]]},{"id":"0d3a1ab68e3525e9","type":"function","z":"27e9be846c2ebce9","name":"Data","func":"msg.payload = { cpu: msg.payload };\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":300,"wires":[["68a1649d86ae4a92"]]},{"id":"68a1649d86ae4a92","type":"join","z":"27e9be846c2ebce9","name":"Join GPU and CPU","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","useparts":true,"accumulate":true,"timeout":"1","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1100,"y":200,"wires":[["9e2dfe9ff49c9ff6","44399341fe610354"]]},{"id":"9e2dfe9ff49c9ff6","type":"function","z":"27e9be846c2ebce9","name":"Parser","func":"var gpu = parseFloat(msg.payload.gpu).toFixed(1);\nvar cpu = parseFloat(msg.payload.cpu).toFixed(1);\n\nif (isNaN(gpu) || isNaN(cpu)) {\n node.error('GPU or CPU data is not a number', msg);\n return null;\n}\n\nmsg.payload = {\n gpu: gpu,\n cpu: cpu\n};\n\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1290,"y":200,"wires":[["4fe5317a8793c187","d07152f3533f111a"]]},{"id":"4fe5317a8793c187","type":"debug","z":"27e9be846c2ebce9","name":"Payload Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1580,"y":100,"wires":[]},{"id":"d07152f3533f111a","type":"function","z":"27e9be846c2ebce9","name":"Format Payload","func":"msg.payload = {\n \"text\": \"GPU: \" + msg.payload.gpu + \"% CPU: \" + msg.payload.cpu + \"%\",\n \"icon\": 39900,\n \"duration\": 8\n};\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1520,"y":200,"wires":[["31fbe575684c80d8"]]},{"id":"31fbe575684c80d8","type":"http request","z":"27e9be846c2ebce9","name":"AwtrixLight/Custom","method":"POST","ret":"txt","paytoqs":"body","url":"http://192.168.1.193/api/custom?name=gpucpu","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"Content-Type","keyValue":"","valueType":"other","valueValue":"application/json"}],"x":1730,"y":200,"wires":[["4692a178972751d7"]]},{"id":"4692a178972751d7","type":"debug","z":"27e9be846c2ebce9","name":"Response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1720,"y":260,"wires":[]},{"id":"44399341fe610354","type":"debug","z":"27e9be846c2ebce9","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1280,"y":120,"wires":[]},{"id":"36cc9f18.c96dd","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"","statusSeparator":"","enableGlobalContextStore":false}]
-- Flow first published on July 2, 2024, last updated on July 7, 2024 at 18:55.