JurajNyiri / sensor.rpi_power

A Custom component for Home-Assistant that checks if your Raspberry Pi power supply is giving enough voltage from the kernel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Raspberry Pi Power Supply Checker

GitHub Release License Project Maintenance Contributors Discord

A sensor for Home-Assistant that checks your power supply and reports back to your setup this simple sensor reports values from the kernel and if it reports anything else then 0 then there are issues with the power supply.

For more information about Raspberry Pi Power supplies check the following link

Getting started

⚠️ This requires kernel 4.14 or higher.

Place the component at this location on your setup:

  • Hass.io: /custom_components/rpi_power/sensor.py

  • Hassbian / Other: <config directory>/custom_components/rpi_power/sensor.py

    _init_.py and manifest.json needs to be in the same folder

Here is a list of the current values the component checks for

Value Description
0 Everything is working as intended
1000* Under-voltage was detected, consider getting a uninterruptible power supply for your Raspberry Pi.
2000* Your Raspberry Pi is limited due to a bad powersupply, replace the power supply.
3000* Your Raspberry Pi is limited due to a bad powersupply, replace the power supply.
4000* The Raspberry Pi is throttled due to a bad power supply this can lead to corruption and instability, please replace your changer and cables.
5000* The Raspberry Pi is throttled due to a bad power supply this can lead to corruption and instability, please replace your changer and cables.
8000* Your Raspberry Pi is overheating, consider getting a fan or heat sinks.

Example configuration.yaml

sensor:
  platform: rpi_power
  text_state: true

and then this as an automation that sets off a notification in homeassistant.

- id: 'rpi_power_issue'
  alias: Power Problem Notification
  trigger:
  - platform: numeric_state
    entity_id: sensor.rpi_power_status
    above: 0
    for:
      minutes: 1
  condition:
  action:
    service: persistent_notification.create
    data:
      message: "Charger reported {{ states.sensor.rpi_power_status.state }}"
      title: "Power Supply Issue"

Optional config options:

key required default description
text_state no false Sets the description as the state if true.

Due to how custom_components are loaded, it is normal to see a ModuleNotFoundError error on first boot after adding this, to resolve it, restart Home-Assistant.

Issues

Use the bugtracker for your issues if a value is missing please use the following command to get the value

cat /sys/devices/platform/soc/soc:firmware/get_throttled

Then post in the bug report makes it so much easier for me to implement the missing values.

Donate

Toast

or contribute code to the project :) just make sure to lint your stuff before submitting.

About

A Custom component for Home-Assistant that checks if your Raspberry Pi power supply is giving enough voltage from the kernel.

License:MIT License


Languages

Language:Python 100.0%