racailloux / home-assistant-pijuice Goto Github PK
View Code? Open in Web Editor NEWHome Assistant integration to support PiJuice UPS Hat and retrieve values to sensors.
License: Apache License 2.0
Home Assistant integration to support PiJuice UPS Hat and retrieve values to sensors.
License: Apache License 2.0
This is logged on every reboot:
Logger: homeassistant.components.sensor
Source: components/sensor/init.py:597
Integration: Sensor (documentation, issues)
First occurred: 12:45:59 (2 occurrences)
Last logged: 12:45:59
Sensor sensor.pijuice_battery_status has device class None, state class and unit None thus indicating it has a numeric value; however, it has the non-numeric value: normal (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
Sensor sensor.pijuice_power_input_io_status has device class None, state class and unit None thus indicating it has a numeric value; however, it has the non-numeric value: present (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
Setup : Rpi 3b
Power connected to Pijuice direct.
battery : 12000 mAh
power supply 2.5 A
latest version of your excellent Hacs plugin
I choose the right battery config , ( with booting into normal pi OS
All works correct except PiJuice IO current is way to high, when charging is between 9 A and 206 A
when running on Batterij juice alone it is between 12 A and 250 A.
I there another setting in the Pjuice config i should change ( i left everything on default value except the battery type ( setting for 12000 mAh.
Or is there a error in your code that puts the "." wrong ?
Provide the sensor entities as part of a device.
Should allow to set an area for the device.
PiJuice integration writes this kind of errors into log quite often (5897 times in less than 2 days in example below).
However, in most times the PiJuice integration gets all the values, I guess.
Maybe some error handling should be enhanced?
If falue_not_got, try again (or skip and try again next time), or something.
This error originated from a custom integration.
Logger: homeassistant.helpers.entity
Source: custom_components/pijuice/sensor.py:192
Integration: pijuice (documentation, issues)
First occurred: June 9, 2021, 16:58:55 (5897 occurrences)
Last logged: 13:23:29
Update for sensor.pijuice_io_current fails
Update for sensor.pijuice_battery_status fails
Update for sensor.pijuice_power_input_status fails
Update for sensor.pijuice_power_input_io_status fails
Update for sensor.pijuice_charge fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 350, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 558, in async_device_update
raise exc
File "/config/custom_components/pijuice/sensor.py", line 192, in async_update
data = bus.read_i2c_block_data(i2c_address, self._index, self._size)
File "/usr/local/lib/python3.8/site-packages/smbus2/smbus2.py", line 617, in read_i2c_block_data
ioctl(self.fd, I2C_SMBUS, msg)
TimeoutError: [Errno 110] Operation timed out
The method for providing platform translations has changed in Home Assistant Core, and this integration needs to be updated.
Details can be found in https://developers.home-assistant.io/blog/2024/03/05/platform_entity_translations_deprecation
Read the firmware info and add the possibility to update it.
Add a protection if I2C is not activated in the OS (based on /dec/i2c-1)
These error messages are shown in logs in HA Core 2024.1.x
TEMP_CELSIUS was used from pijuice, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.CELSIUS instead, please create a bug report at https://github.com/Racailloux/home-assistant-pijuice/issues
TEMP_FAHRENHEIT was used from pijuice, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.FAHRENHEIT instead, please create a bug report at https://github.com/Racailloux/home-assistant-pijuice/issues
ELECTRIC_POTENTIAL_VOLT was used from pijuice, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfElectricPotential.VOLT instead, please create a bug report at https://github.com/Racailloux/home-assistant-pijuice/issues
ELECTRIC_CURRENT_AMPERE was used from pijuice, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfElectricCurrent.AMPERE instead, please create a bug report at https://github.com/Racailloux/home-assistant-pijuice/issues
STATE_CLASS_MEASUREMENT was used from pijuice, this is a deprecated constant which will be removed in HA Core 2025.1. Use SensorStateClass.MEASUREMENT instead, please create a bug report at https://github.com/Racailloux/home-assistant-pijuice/issues
Hi Racailloux,
I run HA core on a Raspberry Pi 4
Your plugin worked beautiful until i upgraded to HA Core Version core-2021.8.0 .
All the entities are "' not available".
I rebooted the Pi , did not help either.
The error log is
`This error originated from a custom integration.
Logger: homeassistant.config
Source: custom_components/pijuice/sensor.py:12
Integration: pijuice (documentation, issues)
First occurred: 19:00:01 (1 occurrences)
Last logged: 19:00:01
Platform error: sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config.py", line 857, in async_process_component_config
platform = p_integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 498, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/usr/src/homeassistant/homeassistant/loader.py", line 503, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/local/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/config/custom_components/pijuice/sensor.py", line 12, in
from homeassistant.const import (
ImportError: cannot import name 'VOLT' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)
I upgraded to HA Core Version core-2021.8.0 today and that did not fix it
Could you have a look ?
Regards
Karel
In the main README section https://github.com/Racailloux/home-assistant-pijuice#hacs-installation-easy-mode
the link to HACS (https://hacs.xyz/docs/) does not work. Do you mean https://hacs.xyz/docs/community_guides ??
Breaking pijuice since HA 2023.11
https://developers.home-assistant.io/blog/2023/10/03/conversion-functions-cleanup/
2023-12-21 02:43:54.773 ERROR (MainThread) [homeassistant.config] Platform error: sensor - No module named 'homeassistant.util.temperature'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config.py", line 1380, in async_process_component_config
platform = p_integration.get_platform(domain)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 834, in get_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 851, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/config/custom_components/pijuice/sensor.py", line 12, in
from homeassistant.util.temperature import celsius_to_fahrenheit
ModuleNotFoundError: No module named 'homeassistant.util.temperature'
Already fixed, just not mentioned clearly enough at first glance in the release notes.
After installing HA 2023.11, this error appears and HA can't be restarted without disabling PiJuice component:
"Platform error sensor.pijuice - No module named 'homeassistant.util.temperature'"
Hi,
Could this also be setup to enable the use of the Waveshare UPS Hat?
https://www.waveshare.com/product/raspberry-pi/hats/interface-power/ups-hat.htm
It seems to also use I2C and I'm not sure if there is an addon supporting that HAT (or if I even need one)
After update to Home Assistant 2023.5.0 the sensors pijuice_battery_status and pijuice_power_input_io_status are no longer available. The other PiJuice entities are still available. Not using HACS, manual install through configuration.yaml.
Allow to set :
Hi,
First, thanks for putting this together!
I manually added the files as per your instructions. And when validating configurations prompted the following error:
Platform error sensor.pijuice - cannot import name 'SensorEntity' from 'homeassistant.components.sensor' (/usr/src/homeassistant/homeassistant/components/sensor/init.py)
What am I doing wrong? Please advise
Thanks
Val
Logs below. I'm not a python guy (I hate significant whitespace), but I assume that self._attr_native_value
is null, which means it's not being set somehow.
HA version 2024.2.2
I2C is confirmed to be enabled.
Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:533
Integration: Sensor (documentation, issues)
First occurred: 10:01:30 AM (1 occurrences)
Last logged: 10:01:30 AM
Error adding entities for domain sensor with platform pijuice
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 533, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 782, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1325, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 989, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1110, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1071, in __async_calculate_state
shadowed_attr[ATTR_ICON] = self.icon
^^^^^^^^^
File "/config/custom_components/pijuice/sensor.py", line 195, in icon
if self._attr_native_value > 90:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '>' not supported between instances of 'NoneType' and 'int'
Also getting this:
This error originated from a custom integration.
Logger: custom_components.pijuice.sensor
Source: custom_components/pijuice/sensor.py:244
Integration: pijuice (documentation, issues)
First occurred: 10:01:22 AM (9 occurrences)
Last logged: 10:01:30 AM
PiJuice: Error while retrieving data for sensor 'Temperature' (Error code: '[Errno 110] Operation timed out')
PiJuice: Error while retrieving data for sensor 'Battery voltage' (Error code: '[Errno 110] Operation timed out')
PiJuice: Error while retrieving data for sensor 'Battery current' (Error code: '[Errno 110] Operation timed out')
PiJuice: Error while retrieving data for sensor 'IO voltage' (Error code: '[Errno 110] Operation timed out')
PiJuice: Error while retrieving data for sensor 'IO current' (Error code: '[Errno 110] Operation timed out')
I got PiJuice and the sensors up and running but how can I set the battery profile or other settings for that matter? (don't know if I need to but it seems to be recommended in the official docs). As of now I am using the 12,000mah battery with everything factory default.
https://github.com/PiSupply/PiJuice/blob/master/Software/Configs/Batteries/LIPO_12000_PIS-1129.JSON
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.