PiJuice in Hass.io

I recently got a Pi Juice for my Hass is setup. This in case that the power goes out. The raspberry pi won’t just shut down but be able to run a battery for a period of time.

Pi Juice Info

I would like to show some information in Hass io from the hat, such as state of charge and if it is running on battery or not. The Pi Juice does have its own python script, but since I am running Hass io. I am unable to install it.

I am looking for some advice on this, since I would still like to run Hass io. Should I develop my own platform for Home Assistant or create a docker container to install the script and send the data via MQTT? Other suggestions are appreciated.

The Pi Juice offers, battery and power information along with LED and Switch control, which are on the hat.

I would also be willing to install Hass io in a different way in order to add the python script.

Thanks in advance,

Chris

2 Likes

Hi,

Did you ever get some help with the Piejuice & hassio?

Cherrs,
Ambi

No, actually I didn’t. I have been using my pi juice.

Chris

So it keeps the Pi running, but you can’t query some status from Hassio and shut it down from there? They say they have a python script to handle shutdown and monitoring (for a regular Pi, but I don’t know how many of those hooks are “exposed” in Hassio)…maybe just add that to hassio (or a smaller version) and trigger a status check every X mins?

Cheers,
Ambi

Here’s a link (albiet from 2017) where a python script is called by automations in HA.

https://community.home-assistant.io/t/brighten-a-light-then-return-to-previous-brightness-state/20802

They do an:
action: - service: python_script.dimmer

To launch the Python script.

So if we had a simple script running…then probed the GPIOs or the Pijuice board (somehow), we could a) send an email “shutting down now, battery drained”, then b) take a snapshot, and c) shutdown.

I think you’re going to make me buy one, just to see it work! :smiley:

Cheers,
Ambi

I actually would be interest in this too at some point, but have too many other projects right now. I have changed some direction on my server setup and I don’t need the piJuice now. Still running a raspberry pi.

I will probably use by piJuice somewhere else, so I would still want the data in HASS. Like you said some python would do the trick.

I am not using HASSIO anymore, but running home assistant in a docker container. When I first researched this it seemed it would be a pain to do in HASSIO, but I am sure if you use a python script it works that same in either case.

Chris

Hello,

Since there was no real solution for PiJuice support for Home Assistant, I created a component for it as an Integration.
This is available here : GitHub - Racailloux/home-assistant-pijuice: Home Assistant integration to support PiJuice UPS Hat and retrieve values to sensors.
This will be soon released into HACS too.

3 Likes