Raspberry Pi 4 Model B temperature

47ºC in the current warm weather ? The poor thing will be shivering :smile: Perhaps it needs more to do.

My R Pi 4b has ranged between 56ºC and 64ºC loafing along in the last 24 hours. I do have a fan that would cut in at 65ºC but it’s not reached that, even with a dashboard of 6 mjpeg IP cams displayed.

This part did not work for me… everything else is great.
Any idea why this would not work?

Did you install? E.g. with HACS.

1 Like

Hi,

Yes download zip and extract.

copy folder rpi_power over to custom_components and restart HA.

image
image
Regards,

Thanks. I did install other HACS components, but missed that one. It works now.

Thank you for your configuration!

You have this defined two times:

and

Is this:

working?
I always get the version “latest”. I don’t think that this is intended?

Hi,
Yeah I made some tweaks since I first posted my config.

This is my latest configuration.yaml


#==================
#=== System Sensors
#==================

  - platform: command_line
    name: RPi CPU Temperature
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    value_template: "{{ value | multiply(0.001) | round(2) }}"

  #===========================================
  #=== Latest Sonoff Tasmota firmware version
  #===========================================
  - platform: command_line
    name: Tasmota Current Version
    command: "curl -s https://github.com/arendst/Sonoff-Tasmota/releases/latest | cut -d'\"' -f2 | rev | cut -d'/' -f1 | rev"
    scan_interval: 86400

  #==============================
  #=== Installed hass.io version
  #==============================
  - platform: version
    name: Installed Version
    source: local


  #================================
  #=== Latest Available HA Version
  #================================
  - platform: version
    name: Latest Available Version
    beta: false
    image: raspberrypi4
    source: hassio


  #=======================
  #=== Raspberry Pi Power
  #=======================
  - platform: rpi_power
    text_state: True


  #=============================================
  #=== Last boot time, Disk, memory & CPU usage
  #=============================================
  - platform: systemmonitor
    resources:
      - type: last_boot
      - type: disk_use_percent
        arg: /
      - type: memory_use_percent
      - type: processor_use

  
  #====================
  #=== CPU Temperature
  #====================
  - platform: command_line
    name: CPU Temp
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    unit_of_measurement: "°C"
    value_template: '{{ value | multiply(0.001) | round(0) }}'


  #===================
  #=== System Up Time
  #===================
  - platform: uptime


  - platform: template
    sensors:

      #==========================
      #=== Home Assistant uptime
      #==========================
      ha_uptime:
        friendly_name: HA Uptime
        value_template: >
          {% if states('sensor.uptime') == '0.0' %} 
            Just restarted...
          {% else %}
            {% macro phrase(value, name) %}
            {%- set value = value | int %}
            {%- set end = 's' if value > 1 else '' %}
            {{- '{} {}{}'.format(value, name, end) if value | int > 0 else '' }}
            {%- endmacro %}
            
            {% set weeks = (states('sensor.uptime') | int / 7) | int %}
            {% set days = (states('sensor.uptime') | int) - (weeks * 7) %}
            {% set hours = (states('sensor.uptime') | float - states('sensor.uptime') | int) * 24 %}
            {% set minutes = (hours - hours | int) * 60 %}

            {{ [ phrase(weeks, 'week'), phrase(days, 'day'), phrase(hours, 'hr'), phrase(minutes, 'min') ] | select('!=','') | list | join(', ') }}
          {% endif %}


      #=========================================
      #=== Raspberry Pi last boot date and time
      #=========================================
      last_boot_date_time:
        friendly_name: Last Boot
        value_template: >
          {% set date = as_timestamp(states('sensor.last_boot')) | timestamp_custom('%d') %}
          {% set date = '{:01}'.format(date | int) %}
          {% if date in ('1', '21', '31') %}
            {% set date = date ~ 'st' %}
          {% elif date in ('2', '22') %}
            {% set date = date ~ 'nd' %}
          {% elif date in ('3', '23') %}
            {% set date = date ~ 'rd' %}
          {% else %}
            {% set date = date ~ 'th' %}
          {% endif %}

          {{ as_timestamp(states('sensor.last_boot')) | timestamp_custom('%H:%M on %a') }} {{ date }} {{ as_timestamp(states('sensor.last_boot')) | timestamp_custom('%b %Y') }}


      #=========================
      #=== Raspberry Pi Up Time
      #=========================
      rpi_uptime:
        friendly_name: RPi Uptime
        entity_id: sensor.time
        value_template: >
          {% set up_time = as_timestamp(now()) - as_timestamp(states('sensor.last_boot')) %}

          {% set minutes = (up_time // 60) | int %}
          {% set hours = (minutes // 60) %}
          {% set days = (hours // 24) %}
          {% set weeks = (days // 7) %}

          {% set minutes = (minutes % 60) %}
          {% set hours =  (hours % 24) %}
          {% set days = (days % 7) %}

          {% macro phrase(value, name) %}
                    {%- set value = value %}
                    {%- set end = 's' if value > 1 else '' %}
                    {{- '{} {}{}'.format(value, name, end) if value | int > 0 else '' }}
          {%- endmacro %}
                    
          {% set text = [ phrase(weeks, 'week'), phrase(days, 'day'), phrase(hours, 'hr'), phrase(minutes, 'min') ] | select('!=','') | list | join(', ') %}
          {% set last_comma = text.rfind(',') %}
          {% if last_comma != -1 %}
            {% set text = text[:last_comma] + ' and' + text[last_comma + 1:] %}
          {% endif %}
          
          {{ text }}

As far as I am aware the Tasmota sensor is working as intended.
Regards,

It looks the same. The Pi temperature is still defined two times. One time at the beginning and one time a little bit later. You use this command at both entries: “cat /sys/class/thermal/thermal_zone0/temp”, so you will get the same. :slight_smile:

If I look at your picture at the beginning the entry is “latest” and not 8.3.1. That is because the curl command gives this:

curl -s https://github.com/arendst/Sonoff-Tasmota/releases/latest
<html><body>You are being <a href="https://github.com/arendst/Tasmota/releases/latest">redirected</a>.</body></html>

The URL should be Release Tasmota v13.4.0 Quinta · arendst/Tasmota · GitHub. Then you get this:

curl -s https://github.com/arendst/Tasmota/releases/latest
<html><body>You are being <a href="https://github.com/arendst/Tasmota/releases/tag/v8.3.1">redirected</a>.</body></html>

with the correct version number inside.

Thanks for the observation, updated.

For those interested in the original thread I have installed the Pi 4 B in the FLIRC case and my temperature now is averaging 45 °C


#==================
#=== System Sensors
#==================

  - platform: command_line
    name: RPi CPU Temperature
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    value_template: "{{ value | multiply(0.001) | round(2) }}"

  #===========================================
  #=== Latest Tasmota firmware version
  #===========================================
  - platform: command_line
    name: Tasmota Current Version
    command: "curl -s https://github.com/arendst/Tasmota/releases/latest | cut -d'\"' -f2 | rev | cut -d'/' -f1 | rev"
    scan_interval: 86400

  #==============================
  #=== Installed hass.io version
  #==============================
  - platform: version
    name: Installed Version
    source: local


  #================================
  #=== Latest Available HA Version
  #================================
  - platform: version
    name: Latest Available Version
    beta: false
    image: raspberrypi4
    source: hassio


  #=======================
  #=== Raspberry Pi Power
  #=======================
  - platform: rpi_power
    text_state: True


  #=============================================
  #=== Last boot time, Disk, memory & CPU usage
  #=============================================
  - platform: systemmonitor
    resources:
      - type: last_boot
      - type: disk_use_percent
        arg: /
      - type: memory_use_percent
      - type: processor_use


  #===================
  #=== System Up Time
  #===================
  - platform: uptime


  - platform: template
    sensors:

      #==========================
      #=== Home Assistant uptime
      #==========================
      ha_uptime:
        friendly_name: HA Uptime
        value_template: >
          {% if states('sensor.uptime') == '0.0' %} 
            Just restarted...
          {% else %}
            {% macro phrase(value, name) %}
            {%- set value = value | int %}
            {%- set end = 's' if value > 1 else '' %}
            {{- '{} {}{}'.format(value, name, end) if value | int > 0 else '' }}
            {%- endmacro %}
            
            {% set weeks = (states('sensor.uptime') | int / 7) | int %}
            {% set days = (states('sensor.uptime') | int) - (weeks * 7) %}
            {% set hours = (states('sensor.uptime') | float - states('sensor.uptime') | int) * 24 %}
            {% set minutes = (hours - hours | int) * 60 %}

            {{ [ phrase(weeks, 'week'), phrase(days, 'day'), phrase(hours, 'hr'), phrase(minutes, 'min') ] | select('!=','') | list | join(', ') }}
          {% endif %}


      #=========================================
      #=== Raspberry Pi last boot date and time
      #=========================================
      last_boot_date_time:
        friendly_name: Last Boot
        value_template: >
          {% set date = as_timestamp(states('sensor.last_boot')) | timestamp_custom('%d') %}
          {% set date = '{:01}'.format(date | int) %}
          {% if date in ('1', '21', '31') %}
            {% set date = date ~ 'st' %}
          {% elif date in ('2', '22') %}
            {% set date = date ~ 'nd' %}
          {% elif date in ('3', '23') %}
            {% set date = date ~ 'rd' %}
          {% else %}
            {% set date = date ~ 'th' %}
          {% endif %}

          {{ as_timestamp(states('sensor.last_boot')) | timestamp_custom('%H:%M on %a') }} {{ date }} {{ as_timestamp(states('sensor.last_boot')) | timestamp_custom('%b %Y') }}


      #=========================
      #=== Raspberry Pi Up Time
      #=========================
      rpi_uptime:
        friendly_name: RPi Uptime
        entity_id: sensor.time
        value_template: >
          {% set up_time = as_timestamp(now()) - as_timestamp(states('sensor.last_boot')) %}

          {% set minutes = (up_time // 60) | int %}
          {% set hours = (minutes // 60) %}
          {% set days = (hours // 24) %}
          {% set weeks = (days // 7) %}

          {% set minutes = (minutes % 60) %}
          {% set hours =  (hours % 24) %}
          {% set days = (days % 7) %}

          {% macro phrase(value, name) %}
                    {%- set value = value %}
                    {%- set end = 's' if value > 1 else '' %}
                    {{- '{} {}{}'.format(value, name, end) if value | int > 0 else '' }}
          {%- endmacro %}
                    
          {% set text = [ phrase(weeks, 'week'), phrase(days, 'day'), phrase(hours, 'hr'), phrase(minutes, 'min') ] | select('!=','') | list | join(', ') %}
          {% set last_comma = text.rfind(',') %}
          {% if last_comma != -1 %}
            {% set text = text[:last_comma] + ' and' + text[last_comma + 1:] %}
          {% endif %}
          
          {{ text }}

Just waiting for the ability to boot the PI from SSD, fingers crossed.
Regards,

1 Like

Now suddenly, the graph for the top four items are no longer showing up. I tried to reinstall the HACS custom cards, but still no luck. My configuration.yaml (actually sensors.yaml) is the same as what it was before when it was working.

Any thoughts?

I take it you have tried refresh, restart and clear cache?

my lovelace config.

cards:
  - cards:
      - entities:
          - sensor.rpi_cpu_temperature
        font_size: 75
        line_color: red
        line_width: 8
        show:
          average: true
          extrema: true
          fill: fade
          icon: true
          name: true
          points: true
          state: true
        type: 'custom:mini-graph-card'
      - entities:
          - sensor.disk_use_percent
        font_size: 75
        line_color: blue
        line_width: 8
        show:
          average: true
          extrema: true
          fill: fade
          icon: true
          name: true
          points: true
          state: true
        type: 'custom:mini-graph-card'
    type: horizontal-stack
  - cards:
      - entities:
          - sensor.memory_use_percent
        font_size: 75
        line_color: red
        line_width: 8
        show:
          average: true
          extrema: true
          fill: fade
          icon: true
          name: true
          points: true
          state: true
        type: 'custom:mini-graph-card'
      - entities:
          - sensor.processor_use
        font_size: 75
        line_color: blue
        line_width: 8
        show:
          average: true
          extrema: true
          fill: fade
          icon: true
          name: true
          points: true
          state: true
        type: 'custom:mini-graph-card'
    type: horizontal-stack
  - cards:
      - columns: 3
        entities:
          - sensor.ha_uptime
          - sensor.hacs
          - sensor.installed_version
          - sensor.last_boot
          - sensor.last_boot_date_time
          - sensor.latest_available_version
          - sensor.rpi_power_status
          - sensor.rpi_uptime
          - sensor.tasmota_current_version
          - binary_sensor.updater
          - sensor.uptime
        type: glance
    type: horizontal-stack
title: SYSTEM MONITORING
type: 'custom:vertical-stack-in-card'

what is sensors.yaml?

Yes, I did the refresh and cache clear etc. Still didn’t work.

Sensor.yaml is just split out from configuration.yaml with an include statement.


group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
panel_iframe: !include panel_iframe.yaml
switch: !include switches.yaml
cover: !include cover.yaml
sensor: !include sensors.yaml
ios: !include ios.yaml

Reinstall of custom mini-graph-card via HACS, I am running v0.9.3 ?

Other than that I’m stumped, try opening an issue.

Regards,

1 Like

Ok, thanks. It’s strange because it worked for a while then suddenly stopped. I have reinstalled all the HACS cards and still no graphing.

This fixed it:

Just a few days ago, HACS updated [custom-components/sensor.rpi_power](https://github.com/custom-components/sensor.rpi_power) to version 0.2.0. The breaking change was that the rpi_power sensor went from sensor: to binary_sensor:. I did the changes recommended on the Github page (changes to configuration.yaml plus change lovelace cards and automations from sensor.rpi_power_status to binary_sensor.rpi_power_status.) Unfortunately after restarting the server, I get a Notification that “Platform error binary_sensor.rpi_power - No module named 'custom_components.rpi_power.binary_sensor” and the System Monitoring Card from @MarkB1 still does not show “RPi Power Status” (little yellow triangle indicating the entity isn’t available, see below).

This is frustrating because rpi_power is in fact in the custom components directory, and I did exactly what the rpi_power GitHub told me to do. There is no binary_sensor.rpi_power in the entities list. Any ideas?

See the folllowing.

https://github.com/custom-components/sensor.rpi_power/issues/45

Just checked my own as i am not experiencing this.

I manually installed 0.1.5 and it still works fine for now, might not in future, will cross that bridge when I get to it.

Thanks. I used the process proposed by regystro:

This brought the integration to 0.2.0 and it works. So, if you want to upgrade to 0.2.0, it appears to be a working process.

Could you post the steps? seems that link gets the good ol 404 now.