Raspberry Pi Power Sensor (updated: 2018-07-25) / Use Github for reports in the future

what do you mean?
can you be more explicative?

/home/homeassistant/.homeassistant/custom_components/sensor/rpi_power.py

then add

  • platform: rpi_power

too your sensor yaml

if your running hassbian that is if your running hassio i think its /config not sure though

ok i did it!

it was my mistake in downloading the .py file :frowning:

unluckily i have a further question: how can i display sensor description instead of sensor value in HA panel?

You can create a template sensor:

sensor:
  - platform: template
    sensors:
      solar_angle:
        friendly_name: "Sun angle"
        value_template: "{{ states.sensor.rp_power_status.attributes.description }}"

Or change L49 of the .py file from self._state = _throttled to self._state = self._description

great! thank you very much!

1 Like

Does this work in the new HassOS? Itā€™s not 100% clear to meā€¦

As mentioned a few times and stated in the first post: Yes

This will work for HassOS

It specifically says not hass.io in the first post because itā€™s missing the kernelā€¦ itā€™s not clear when there is conflicting information.

In this case he probably meant the ResinOS-based hass.io. Currently the requirement is Kernel version: 4.14+, which HassOS uses.

One tip to the dev: maybe there could be some clarification in the documentation that 0 is a good value to have?

thereā€™s also multiple sensor versions - 2 posts in a row - one with 2 sensors but the most recent one only has 1?
And Iā€™m assuming the post 1 script is needed as well? Although the sensor seems to run a command line so again not totally clear.

Yeah, itā€™s a bit cluttered. Latest version of the sensor is currently here: https://github.com/custom-components/sensor.rpi_power
Hopefully the sensor will make it to the official components soon.

Itā€™s quite an interesting repository, I would recommend checking it out, including the custom-components updater: https://github.com/custom-components/custom_updater

So is all I need to do is download the py file and add the platform to config yaml? The other templates/sensors/command line seem to duplicate/replace the script. Trying now anyway.

My sensor reports 0 and ā€˜No throttling detectedā€™ which is good, but what does the sensor report if it is not good?
Simply put, what does the zero mean? Is it 0% throttling?

Iā€™m playing with this in my config:

# RPI Power
  - platform: rpi_power
    value_template: >
      {% if is_state("sensor.rpi_power_status.description", "0") -%}
         No throttling detected
      {% elif regex_match(states("sensor.rpi_power_status.description"), "40005", ignorecase=FALSE) or
         regex_match(states("sensor.rpi_power_status.description"), "50005", ignorecase=FALSE) -%}
         Throttling detected 
      {%- endif %}

No it totally doesnā€™t workā€¦ I only see 0 as well. It means your power supply is good.

Iā€™m using this and it works.

sensor:
  - platform: rpi_power

  - platform: template
    sensors:
      rpi_power_description:
        friendly_name: "RPi power status"
        value_template: '{{states.sensor.rpi_power_status.attributes.description}}'
        icon_template: mdi:raspberrypi

image

1 Like

@toast, maybe change the value in the next version so
attributes.description becomes the sensor state
and the state becomes attributes.value ?
Posibilly adding a config option?

sensor:
  - platform: rpi_power
    text_state: True

Ha!

Iā€™m just trying this:

# RPI Power
  - platform: rpi_power
    value_template: '{{ states.sensor.rpi_power_status.attributes.description }}'

I think I tried that and it didnā€™t work!
Let me know if Iā€™m wrongā€¦

it seems to work in the template checker in dev toolsā€¦ takes bloody forever to restartā€¦

Yes!!!
If I had one very real complaint about HA/hassio it would be that.
It puts me off wanting to experiment with anything.