HWInfo integration into Home Assistant, via MQTT

mhwlng

Active Member
First, you need to have MQTT installed and working in Home Assistant.

Go to https://github.com/mhwlng/fipha/releases

Download the latest version fip-ha-...zip file. under 'Assets'

Unzip all the files and subdirectories somewhere on your hard disk. (not in program files)

See further information here:

https://github.com/mhwlng/fipha

You need to edit mqtt.config with your mqtt credentials and hwinfo.inc with your hwinfo sensor information.

Then run fipha.exe.

HWInfo Sensor Entities will be automatically added to Home Assistant via the MQTT Discovery process.

There is a log file, that may contain error messages if there are problems.


KackkpM.png

p5S3FWw.png

AJBazTy.png

tkaNJDd.png
 
Last edited:
Great addition! I was planning to add MQTT support in HWiNFO.
Hey @Martin

Just f.y.i.

The MQTT functionality in this application is pretty much identical to this older application :


(In both programs, the flight instrument panel is optional, if you're only interested in MQTT)

The only difference is, that in this application : The MQTT topics and payload are specially formatted, so that Home Assistant will automatically add the sensors to it's database, without any additional configuration in Home Assistant.
 
I cannot get this to work with Home Assistant.
See the below errors:

ERROR 2022-09-15 23:20:48,068 MoveNext - No Home Assistant Connection
ERROR 2022-09-15 23:20:48,081 ReadMem - HWINFO Shared Memory Read Problem
System.IO.FileNotFoundException: Unable to find the specified file.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.MemoryMappedFiles.MemoryMappedFile.OpenCore(String mapName, HandleInheritability inheritability, Int32 desiredAccessRights, Boolean createOrOpen)
at System.IO.MemoryMappedFiles.MemoryMappedFile.OpenExisting(String mapName, MemoryMappedFileRights desiredAccessRights, HandleInheritability inheritability)
at fipha.HWInfo.ReadMem(String incPath)
ERROR 2022-09-15 23:20:48,083 MoveNext - No HWINFO Sensors Found
INFO 2022-09-15 23:20:48,085 MoveNext - fipha started

I do have an active MQTT connection with my HA instance.
Furthermore, it cannot find any sensors.

Any ideas?
 
>HWINFO Shared Memory Read Problem

It can't connect to the hwinfo shared memory area.
You need the 64 bit version of hwinfo and the shared memory support option must be ENABLED in hwinfo.
See github for more information

>No HWINFO Sensors Found

There will be no MQTT connection made (with the credentials as defined in mqtt.config) if the software can't access any HWINFO sensors

If it does find sensors, then all the sensors are written to hwinfo.json and the sensors that will actually be sent via MQTT are defined in HWINFO.inc

No long running token is necessary, if you don't use the flight instrument panel.
In that case the 'No Home Assistant Connection' error is normal.

see github for more info.
 
Last edited:
>HWINFO Shared Memory Read Problem

It can't connect to the hwinfo shared memory area.
You need the 64 bit version of hwinfo and the shared memory support option must be ENABLED in hwinfo.
See github for more information

>No HWINFO Sensors Found

There will be no MQTT connection made (with the credentials as defined in mqtt.config) if the software can't access any HWINFO sensors

If it does find sensors, then all the sensors are written to hwinfo.json and the sensors that will actually be sent via MQTT are defined in HWINFO.inc

No long running token is necessary, if you don't use the flight instrument panel.
In that case the 'No Home Assistant Connection' error is normal.

see github for more info.

This worked perfectly, thank you.
 
Can I add more sensors than is currently listed in HWINFO.inc?

For instance, I want to add another motherboard temp sensor.
I added a sensor to the file manually which I did correctly link to HWinfo using the HWiNFOSharedMemoryViewer tool. It does not appear in Home Assistant however.
See below:

MotherboardTemp-SensorId=0xf7067980
MotherboardTemp-SensorInstance=0x0
MotherboardTemp-EntryId=0x1000000

MotherboardTemp2-SensorId=0xf7067980
MotherboardTemp2-SensorInstance=0x0
MotherboardTemp2-EntryId=0x1000007

The first sensor (MotherboardTemp) worked fine. The second one (MotherboardTemp2) does not appear in HASS though.
 
You can add as many sensors as you like.
Did you restart the software after modifying the hwinfo.inc file?
Otherwise post hwinfo.json and hwinfo.inc here
 
I did restart fipha.exe after making changes to hwinfo.inc. Still not seeing it in HASS. Logs are showing no issues.

I converted hex to decimal and the numbers match in both files.

I attached them both here as txt files, as the json is huge.

Note that in hwinfo.inc, I am referencing this piece:
Code:
MotherboardTemp2-SensorId=0xf7067980
MotherboardTemp2-SensorInstance=0x0
MotherboardTemp2-EntryId=0x1000007

In hwinfo.json, I am referencing this piece:
Code:
      "4144396672-0-16777223": {
        "SensorType": 1,
        "ElementId": 16777223,
        "LabelOrig": "CPU Package",
        "LabelUser": "CPU Package",
        "Unit": "°C",
        "Value": "42.0 °C",
        "ValueMin": "31.0 °C",
        "ValueMax": "61.0 °C",
        "ValueAvg": "39.8 °C",
        "Node": null,
        "Name": null,
        "DeviceClass": "temperature",
        "Component": "sensor"
 

Attachments

  • HWINFO.txt
    2.1 KB · Views: 3
  • hwinfo.txt
    190.2 KB · Views: 2
The problem is that you didn't add MotherboardTemp2 at the bottom of the file :

[HWINFO-Config-TEMPERATURE]
CPUTemp=CPU
GPUTemp=GPU
RAMTemp=RAM
SSDTemp=SSD
VRMTemp=VRM
ChipsetTemp=Chipset
MotherboardTemp=Motherboard
WaterTemp=Water
 
The problem is that you didn't add MotherboardTemp2 at the bottom of the file :

[HWINFO-Config-TEMPERATURE]
CPUTemp=CPU
GPUTemp=GPU
RAMTemp=RAM
SSDTemp=SSD
VRMTemp=VRM
ChipsetTemp=Chipset
MotherboardTemp=Motherboard
WaterTemp=Water
My man you are an ace!!!
Fantastic! Working great... thanks.

One last question. I cannot seem to change the temperature unit in HASS. It defaults to F, and when I choose C, it doesn't stick.

Any ideas?
HASS_Temp.JPG
 
It's coming from HWinfo as Celsius and displayed in HASS as Fahrenheit.
See below.

This is the motherboard2 entry we worked on earlier. You can reference my hwinfo.inc file above to check my ID numbers to confirm it's the same sensor I'm referencing.

hwinfo1.JPG
hwinfo2.JPG
 
I see it in the core.entity_registry file as Fahrenheit.

"config_entry_id": "0884b17c6fbb49a61b9dad93c9b3483a",
"device_class": null,
"device_id": null,
"disabled_by": null,
"entity_category": null,
"entity_id": "sensor.infinity_temperature_motherboard2",
"hidden_by": null,
"icon": null,
"id": "30f9e78e781a5a504903a45f05385fa9",
"has_entity_name": false,
"name": null,
"options": {},
"original_device_class": "temperature",
"original_icon": null,
"original_name": "infinity temperature motherboard2",
"platform": "mqtt",
"supported_features": 0,
"unique_id": "infinity_temperature_motherboard2",
"unit_of_measurement": "°F"
},

It must be defaulting to that like you said... when I change it, it no longer syncs. When I restarted, it reverted back.
I'll have to create some custom gauges that convert to C in the code.
I'll let you know how it comes out.

Thanks for all your help.
 
I checked my own home assistant (which is 'Home Assistant Operating System' runs on a raspberry pi 4).

I don't have any unit_system: metric in my configuration.yaml file

If I go to menu settings\system\general

There I see a radio button, that is selected : Unit System : metric (celcius,kilogram)
 
I checked my own home assistant (which is 'Home Assistant Operating System' runs on a raspberry pi 4).

I don't have any unit_system: metric in my configuration.yaml file

If I go to menu settings\system\general

There I see a radio button, that is selected : Unit System : metric (celcius,kilogram)
I'm using Core, but that did work.
I'm in the States though, where we do everything backwards. So I need Fahrenheit for all my other temps, and just Celsius for the computer temps... lol.
I'll keep messing with it.

Thanks
 
>>I'm in the States though, <<

Ok, you left that part out, before :)

Then it seems normal behaviour.....
 
>>I'm in the States though, <<

Ok, you left that part out, before :)

Then it seems normal behaviour.....
I got it working... I had to create a template for my sensors in configuration.yaml, and then create a new Gauge based on the friendly name.

Code:
sensor:
  - platform: template
    sensors:

      infinity_cpu_temp:
        friendly_name: "Infinity CPU Temperature"
        unit_of_measurement: 'C'
        device_class: temperature
        value_template: "{{ (((states('sensor.infinity_temperature_cpu') | float) - 32) * 5.0/9.0) | round(1)}}"

hwinfo3.JPG
 
Back
Top