ateodorescu / home-assistant-ipmi

IPMI connector for Home Assistant
MIT License
36 stars 8 forks source link

Feature request: add support for power consumption sensors #5

Closed 35gh closed 1 year ago

35gh commented 1 year ago

It will be nice to add power consumption sensors to this integration. This can be retrieved in a standard way with ipmitools:

> ipmitool -I lanplus -H 192.168.1.1 -U ADMIN -P ADMIN dcmi power reading

    Instantaneous power reading:                   210 Watts
    Minimum during sampling period:                 32 Watts
    Maximum during sampling period:                294 Watts
    Average power reading over sample period:      219 Watts
    IPMI timestamp:                           Wed Jun 21 11:09:07 2023
    Sampling period:                          01798845 Seconds.
    Power reading state is:                   activated

Thanks!

ateodorescu commented 1 year ago

The integration uses this library python-ipmi which can't extract the power sensors. If you know of any python library that can extract that info then we can change the integration.

python-ipmi can also use the ipmitool executable to do more stuff but I don't know how to add ipmitool as a requirement for the integration so that it gets installed when the integration is installed. Do you?

35gh commented 1 year ago

I don't think adding ipmitool as a dependency for the integration is feasible, as it's a compiled binary hence platform dependent.

However I found this example in Github for reading power sensors with the python-ipmi library: https://github.com/kontron/python-ipmi/blob/master/examples/dcmi.py

While the example connects with ipmitool, it should work using rmcp.

ateodorescu commented 1 year ago

I did another integration + addon

Please give them a try. This one adds power sensors too.

35gh commented 1 year ago

While we fait for a fix for the new integration (https://github.com/ateodorescu/home-assistant-ipmi/issues/6), would the example I pointed above work to get power sensor data with a RMCP connection ? Thanks!

ateodorescu commented 1 year ago

While we fait for a fix for the new integration (#6), would the example I pointed above work to get power sensor data with a RMCP connection ? Thanks!

That example relies on the existance of ipmitool executable. Basically that example does not use RMCP native connection to fetch that power info.

So, if the RMCP connection works for the user's server then the ipmi integration can be installed otherwise they can use ipmitool integration with the addon ipmi-server

ateodorescu commented 1 year ago

I will close this ticket as it cannot be implemented in the ipmi integration.