Not me… I can barely get my Arduino code to work.
I’m happy to say my proof of concept was successful. I am able to display a “CPU core temperature” in as a Home Assistant sensor from my Windows 11 PC via HWinfo. Basically, anything HWINFO has access to, it can be displayed in Home Assistant. All sorts of interesting sensors, I.E., SSD Disk life % left, CPU wattage, fan speeds, etc.
I’ll post a complete “how-to” once I add all the sensors I want to add for myself. There really isn’t much to it.
configuration.yaml
Below, is the actual working code I’m using to extract the sensor value (updated every 6 seconds) for the sensor in the green rectangle above.
rest:
- resource: http://192.168.1.249:55555/
sensor:
- name: "CPU Package Temperature"
value_template: "{{value_json
| selectattr('SensorClass', 'equalto', 'CPU [#0]: Intel Core i7-4790K: DTS')
| selectattr('SensorName', 'equalto', 'CPU Package')
| map(attribute='SensorValue')
| first}}"
unit_of_measurement: 'ºC'
verify_ssl: false
timeout: 30
scan_interval: 6
``
Thank you @Holdestmade HASS.Agent looks nice! I wish I had known about it before I added my own custom desktop screenshot and Windows Update scripts to Home Assistant.
I did give it a shot, it looks like HASS.Agent has very limited builtin CPU sensor support… just basic CpuLoad and CurrentClockSpeed; at least, for my PCs.
I’m guessing in order for it to work, I would have to also install librehardwaremonitor, add these sensors to HASS.Agent via WMIQuery.
If that’s the case, I think I’ll stick with HWiNFO and its RESTful web server since RESTful API calls are significantly faster and less resource intensive than depending on librehardwaremonitor’s WMI classes. The WMI data has to be constantly written and read from the Windows registry AND that’s not including the time it takes to re-transmit this data via MQTT to Home Assistant.
Looking forward to it.
I’m 99% done. All my HWiNFO sensors are now accessible in HA. I just added them really quick to an Entities card.
Note There are several sensors (many more than you see in the screenshot). However, they will only appear when relevant.
Hi, are you running hwinfo as a service? So it would start without a user logging in?
I am not running it as a service. I don’t think it would work correctly since it needs to interact with the logged in user’s Windows desktop.
Having said that, I haven’t tried it myself… maybe you can let us know if you were able to make it work?
I too am using HASS Agent but ive been trying to figure out what in need to get MB temp sensors, Fan speeds & Disk Space(Used/Remaining) to configure in Hass agent to show up in HA
if someone can let me know what i need to do that would be greatly appreciated thanks
I was looking for a simple way to do this with HASS.Agent and HWiNFO without adding any additional layers and found a pretty reasonable solution.
I’ll assume you already have HASS.Agent setup with MQTT and reporting sensors.
HWiNFO Setup
- Identify the sensor(s) you want to use
- Go to Settings > HWiNFO Gadget.
Check the box for “Enable Reporting to Gadget”. - On the HWiNFO Gadget page, find the entry for the sensors you want to import into Home Assistant.
Click your sensors and enable “Report Value in Gadget”.
Retrieving the sensor info via Powershell
This should expose whatever sensors you checked off in the registry at HKCU:\Software\HWiNFO64\VSB
.
You can view all the sensors you’ve exposed in Powershell using this command (Get-ItemProperty -Path "HKCU:\Software\HWiNFO64\VSB")
Which should give output similar to:
To target a specific value just add .VALUENAME
to the end as such: (Get-ItemProperty -Path "HKCU:\Software\HWiNFO64\VSB").ValueRaw1
This will return 56.4
, my GPUs temp.
HASS.Agent Setup
All you need to do is add a new sensor of type PowershellSensor and plug in the above command that corrosponds to the sensor you want to retrieve.
So if we wanted the CPU temp based on the info from the above screenshot, we’d fill out the sensor info as below:
Sensor Details
powershell command or script: (Get-ItemProperty -Path "HKCU:\Software\HWiNFO64\VSB").ValueRaw0
And under Advanced Settings…
Device Class: temperature
Unit of Measurement: ℃
State Class: measurement
That’s it! Once you Store & Activate the sensors in HASS.Agent, they should automatically start populating in Home Assistant.
And here’s my graph card for those interested:
plotly-graph Card
type: custom:plotly-graph
entities:
- entity: sensor.hass_desktop_gputemp_hwinfo
name: |
$fn ({ ys,meta }) =>
"GPU " + ys[ys.length - 1]+"℃ "
show_value: true
fillcolor: rgba(145, 199, 51, .5)
fill: tozeroy
line:
color: rgba(106, 133, 57, 1)
filters:
- map_y: "y > 0 ? y : 35"
yaxis: y1
- entity: sensor.hass_desktop_cputemp_hwinfo
name: |
$fn ({ ys,meta }) =>
"CPU " + ys[ys.length - 1]+"℃ "
show_value: true
fillcolor: rgba(242, 101, 34, .5)
fill: tozeroy
line:
color: rgba(149, 80, 29, 1)
filters:
- map_y: "y > 0 ? y : 35"
yaxis: y1
refresh_interval: 10
logarithmic_scale: false
hours_to_show: 0.25
layout:
showlegend: true
hovermode: x unified
show_value: true
margin:
r: 70
yaxis:
layer: above traces
visible: true
showgrid: true
name: Temp
range:
- 35
- 90
xaxis:
layer: above traces
rangeselector:
"y": 1.1
buttons:
- count: 1
step: minute
- count: 1
step: hour
- count: 12
step: hour
- count: 1
step: day
- count: 7
step: day
grid_options:
columns: full
rows: 8