{"id":849,"date":"2022-09-16T17:26:20","date_gmt":"2022-09-16T15:26:20","guid":{"rendered":"http:\/\/cln.io\/blog\/?p=849"},"modified":"2024-01-08T11:11:08","modified_gmt":"2024-01-08T09:11:08","slug":"monitoring-rpi-cpu-temp-with-ha","status":"publish","type":"post","link":"https:\/\/cln.io\/blog\/monitoring-rpi-cpu-temp-with-ha\/","title":{"rendered":"Tracking, monitoring host RPI CPU temperature with Home Assistant"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Most Linux systems give you the current temperature of the CPU when you read the file. <code>\/sys\/class\/thermal\/thermal_zone0\/temp<\/code>  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You will get a single line of text with the temperature as an&nbsp;<em>Integer<\/em>. So you have to divide the result by&nbsp;<code>1000<\/code>&nbsp;to get the temperature in&nbsp;<code>\u00b0C<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Knowing this we can make a command_line sensor in HomeAssistant<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/cln.io\/blog\/passive-cooling-a-raspberry-pi\/\" data-type=\"post\" data-id=\"848\">FYI: I needed this to evaluate my passive cooling PI case<\/a><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">command_line:\n  - sensor:\n      name: CPU Temperature\n      command: \"cat \/sys\/class\/thermal\/thermal_zone0\/temp\"\n      # If errors occur, make sure configuration file is encoded as UTF-8\n      unit_of_measurement: \"\u00b0C\"\n      value_template: \"{{ value | multiply(0.001) | round(1) }}\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Reload home assistant after the addition to the config<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"490\" height=\"76\" src=\"https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/image-49.png\" alt=\"\" class=\"wp-image-853\" srcset=\"https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/image-49.png 490w, https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/image-49-300x47.png 300w\" sizes=\"auto, (max-width: 490px) 100vw, 490px\" \/><figcaption class=\"wp-element-caption\">That&#8217;s it! you can now monitor the CPU temperature.<\/figcaption><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"571\" height=\"544\" src=\"https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/image-50.png\" alt=\"\" class=\"wp-image-862\" srcset=\"https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/image-50.png 571w, https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/image-50-300x286.png 300w\" sizes=\"auto, (max-width: 571px) 100vw, 571px\" \/><\/figure>\n<\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/alerkiv-9jmFkN-_U4-unsplash-768x1024.jpg\" alt=\"\" class=\"wp-image-857\" srcset=\"https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/alerkiv-9jmFkN-_U4-unsplash-768x1024.jpg 768w, https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/alerkiv-9jmFkN-_U4-unsplash-225x300.jpg 225w, https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/alerkiv-9jmFkN-_U4-unsplash-1152x1536.jpg 1152w, https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/alerkiv-9jmFkN-_U4-unsplash-1536x2048.jpg 1536w, https:\/\/cln.io\/blog\/wp-content\/uploads\/2022\/09\/alerkiv-9jmFkN-_U4-unsplash-scaled.jpg 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><figcaption class=\"wp-element-caption\">Photo by <a href=\"https:\/\/unsplash.com\/@aler?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" target=\"_blank\" rel=\"noreferrer noopener\">alerkiv<\/a> on <a href=\"https:\/\/unsplash.com\/s\/photos\/cpu?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" target=\"_blank\" rel=\"noreferrer noopener\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most Linux systems give you the current temperature of the CPU when you read the file. \/sys\/class\/thermal\/thermal_zone0\/temp You will get a single line of text with the temperature as an&nbsp;Integer. So you have to divide [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":854,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4,38,36],"tags":[],"class_list":["post-849","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-automation","category-homeassistant","category-monitoring","category-raspberry"],"_links":{"self":[{"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/posts\/849","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/comments?post=849"}],"version-history":[{"count":9,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/posts\/849\/revisions"}],"predecessor-version":[{"id":1488,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/posts\/849\/revisions\/1488"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/media\/854"}],"wp:attachment":[{"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/media?parent=849"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/categories?post=849"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cln.io\/blog\/wp-json\/wp\/v2\/tags?post=849"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}