I recently faced a challenge while trying to set up CPU temperature monitoring in Home Assistant. After some research, I found a solution that involved adding a command-line sensor to my configuration. Initially, I encountered issues due to duplicated mapping keys and formatting errors, but after careful adjustments and consulting the community, I managed to get it working smoothly. Here’s a quick guide for anyone looking to do the same:
- Open Your Configuration File: Navigate to your
configuration.yamland ensure you have thesensor.yamlincluded correctly. - Add the Sensor Configuration: Insert the following code snippet into your
sensor.yamlfile:
yaml
- platform: command_line
name: CPU Temperature
command: ‘cat /sys/class/thermal/thermal_zone0/temp’
unit_of_measurement: ‘°C’
value_template: ‘{{ value | multiply(0.001) }}’
- Reload Your Configuration: After saving, reload your Home Assistant configuration to apply the changes.
- Check Your Dashboard: The CPU temperature should now appear in your Overview section.
This setup not only helps monitor your system health but also serves as a great example of how flexible Home Assistant can be. If you run into any issues, don’t hesitate to ask for help—there’s a vibrant community ready to assist!
Happy automating! ![]()