Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HP ILO integration not working in most recent update #109581

Closed
Studmuffin1134 opened this issue Feb 4, 2024 · 25 comments · Fixed by #110325
Closed

HP ILO integration not working in most recent update #109581

Studmuffin1134 opened this issue Feb 4, 2024 · 25 comments · Fixed by #110325

Comments

@Studmuffin1134
Copy link

The problem

The HP ILO integration stopped working the configuration has not change nor has the ilo login details it will not create the entity's any more even though it has worked up until the last upadte

What version of Home Assistant Core has the issue?

core

What was the last working version of Home Assistant Core?

up until the latest update

What type of installation are you running?

Home Assistant OS

Integration causing the issue

hp_ilo

Link to integration documentation on our website

https://www.home-assistant.io/integrations/hp_ilo/

Diagnostics information

I dont have any at this time

Example YAML snippet

- platform: hp_ilo
  host: 192.168.100.47
  username: Studmuffin
  password: no password for u
  monitored_variables:
    - name: Studmuffin XCP-NG Inlet Tempeture
      sensor_type: server_health
      unit_of_measurement: "°C"
      value_template: '{{ ilo_data.temperature["01-Inlet Ambient"].currentreading[0] }}'
    - name: Studmuffin ESXI 1 Power Consumption
      sensor_type: server_power_readings

Anything in the logs that might be useful for us?

Not currently at this time if u need data tell me how to get it and i can get it to u
the code snippet is 1 out of the 4 i have

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Feb 4, 2024

@christophermichaelshaw
Copy link

Can confirm ilo integration is broken in 2024.2b8 -- likely due to the Python upgrade.

This may be applicable: eventlet/eventlet#795

`Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:581
Integration: Sensor (documentation, issues)
First occurred: 19:21:37 (13 occurrences)
Last logged: 19:21:48

hp_ilo: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 581, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1261, in async_device_update
await hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/hp_ilo/sensor.py", line 166, in update
ilo_data = getattr(self.hp_ilo_data.data, self._ilo_function)()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/hpilo.py", line 1035, in get_embedded_health
return self._info_tag('SERVER_INFO', 'GET_EMBEDDED_HEALTH', 'GET_EMBEDDED_HEALTH_DATA',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/hpilo.py", line 730, in _info_tag
header, message = self._request(root)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/hpilo.py", line 238, in _request
self._detect_protocol()
File "/usr/local/lib/python3.12/site-packages/hpilo.py", line 278, in _detect_protocol
header, data = self._communicate(b'', ILO_HTTP, save=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/hpilo.py", line 406, in _communicate
sock = self._get_socket()
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/hpilo.py", line 401, in _get_socket
return ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLS)
^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'`

@Studmuffin1134
Copy link
Author

Studmuffin1134 commented Feb 6, 2024 via email

@christophermichaelshaw
Copy link

Give the devs some time to update the integration -- appears as if the ssl.wrap_socket() function, deprecated in Python 3.7, needs to be replaced with context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) or something along those lines.

@phidauex
Copy link

phidauex commented Feb 8, 2024

More context here from the Python documentation: https://docs.python.org/3.12/whatsnew/3.12.html#ssl

Remove the ssl.wrap_socket() function, deprecated in Python 3.7: instead, create a ssl.SSLContext object and call its ssl.SSLContext.wrap_socket method. Any package that still uses ssl.wrap_socket() is broken and insecure. The function neither sends a SNI TLS extension nor validates server hostname. Code is subject to CWE-295: Improper Certificate Validation. (Contributed by Victor Stinner in gh-94199.)

@gdiciancia
Copy link

I see the same error on my instance. Went from 2023.x to 2024.2.0

@christophermichaelshaw
Copy link

I see the same error on my instance. Went from 2023.x to 2024.2.0

Thank you for the report and confirmation!

For further reporters of similar issues -- I don't see a need for any additional "me too" reports at this point, as we've identified the issue (deprecated Python function).

I haven't yet had time to submit a fix, as I'm unfamiliar with the codebase, but will likely submit a PR with a fix by the end of this weekend if need be. The devs are awesome, so I would predict the fix will be released very soon!

@Redblockmasteur
Copy link

Same Here I updated to 2024.2 and all my entities related to HI ILO disappear afterwards

@tranzistori
Copy link

me 3

@daemongloom
Copy link

2024.2.1 - iLo also doesn't work.

@pergolafabio
Copy link

Please guys, try to read!

Nirostar added a commit to Nirostar/homeassistant-core that referenced this issue Feb 12, 2024
The issue with the deprecated and now removed ssl.wrap_socket function was fixed years ago in the library
Nirostar added a commit to Nirostar/homeassistant-core that referenced this issue Feb 12, 2024
@Nirostar
Copy link
Contributor

Nirostar commented Feb 12, 2024

I created a PR that should fix the problem. In the meantime, if you want a temporary fix until the next update, you can run

docker exec -it homeassistant bash -c "wget https://raw.githubusercontent.com/seveas/python-hpilo/5881ffab4fba6ea136176a92de58c710704e9653/hpilo.py -O /usr/local/lib/python3.12/site-packages/hpilo.py"

Be aware: This won't carry over after updates.

If you want to do that in HAOS you need the https://github.com/hassio-addons/addon-ssh addon (this is the non-restricted community version) and disable the Safe mode.

@Nirostar
Copy link
Contributor

I see the same error on my instance. Went from 2023.x to 2024.2.0

Thank you for the report and confirmation!

For further reporters of similar issues -- I don't see a need for any additional "me too" reports at this point, as we've identified the issue (deprecated Python function).

I haven't yet had time to submit a fix, as I'm unfamiliar with the codebase, but will likely submit a PR with a fix by the end of this weekend if need be. The devs are awesome, so I would predict the fix will be released very soon!

I already created a PR. Would you maybe review it?

@Studmuffin1134
Copy link
Author

i will try it later

@globus243
Copy link

globus243 commented Feb 12, 2024

I see, I have chosen a bad day to start using the hp_ilo integration :D

I created a PR that should fix the problem. In the meantime, if you want a temporary fix until the next update, you can run

docker exec -it homeassistant bash -c "wget https://raw.githubusercontent.com/seveas/python-hpilo/5881ffab4fba6ea136176a92de58c710704e9653/hpilo.py -O /usr/local/lib/python3.12/site-packages/hpilo.py"

Be aware: This won't carry over after updates.

If you want to do that in HAOS you need the https://github.com/hassio-addons/addon-ssh addon (this is the non-restricted community version) and disable the Safe mode.

I downloaded your version as you described and tested it in advanced terminal where it worked, but HA still does not create the entities no matter how often and thoroughly I restart. could there maybe more broken?

also, I don't know if it was something with my python installation but I needed to change the \ to \\ on line 204, 336 and 432, otherwise it refused to run as well.

docker exec -it homeassistant bash
cd /usr/local/lib/python3.12/site-packages/
python

and then

hpilo.Ilo("xx.xx.0.200", login="a_username", password="a_password", timeout=60, port=443, protocol=None, delayed=False, ssl_verify=False, ssl_context=None)
ilo.get_power_readings

works! but:

sensor:
  - platform: hp_ilo
    host: xx.xx.0.200
    username: a_username
    password: a_password
    monitored_variables:
      - name: Server Power Wattage
        sensor_type: server_power_readings
        unit_of_measurement: Watt
        value_template: '{{ ilo_data.present_power_reading }}'

not

@Nirostar
Copy link
Contributor

Nirostar commented Feb 13, 2024

but:

sensor:
  - platform: hp_ilo
    host: xx.xx.0.200
    username: a_username
    password: a_password
    monitored_variables:
      - name: Server Power Wattage
        sensor_type: server_power_readings
        unit_of_measurement: Watt
        value_template: '{{ ilo_data.present_power_reading }}'

not

I think you forgot a [0].

      - name: Server Power Wattage
        sensor_type: server_power_readings
        value_template: "{{ ilo_data.present_power_reading[0] }}"
        unit_of_measurement: "W"

@Nirostar
Copy link
Contributor

also, I don't know if it was something with my python installation but I needed to change the \ to \\ on line 204, 336 and 432, otherwise it refused to run as well.

This is only a syntax warning afaik. It's not nice, but in the library for ages it seems. It should work fine with the warnings.

@RobertWojtowicz
Copy link

RobertWojtowicz commented Feb 16, 2024

Hi,
Does not work on Core version 2024.2.2

I tried the commands (HAOS 11.5), what am I doing wrong ?

[core-ssh ~]$ docker exec -it homeassistant bash -c "wget https://raw.githubusercontent.com/seveas/python-hpilo/5881ffab4fba6ea136176a92de58c710704e9653/hpilo.py -O /usr/local/lib/python3.12/site-packages/hpilo.py"
-bash: docker: command not found
[core-ssh ~]$ ha docker exec -it homeassistant bash -c "wget https://raw.githubusercontent.com/seveas/python-hpilo/5881ffab4fba6ea136176a92de58c710704e9653/hpilo.py -O /usr/local/lib/python3.12/site-packages/hpilo.py"
Error: unknown shorthand flag: 'i' in -it

@christophermichaelshaw
Copy link

christophermichaelshaw commented Feb 16, 2024 via email

@Nornode
Copy link

Nornode commented Feb 16, 2024

@emontnemery - looks like you are owning this integration here: https://github.com/home-assistant/core/tree/dev/homeassistant/components/hp_ilo
Could you please help us have a look if this can be merged?

@RobertWojtowicz
Copy link

@christophermichaelshaw it works!, I used wrong ssh plugin.

Thx

@tjmjansen
Copy link

@emontnemery - looks like you are owning this integration here: https://github.com/home-assistant/core/tree/dev/homeassistant/components/hp_ilo Could you please help us have a look if this can be merged?

or @epenet ?

@pug306d
Copy link

pug306d commented Feb 23, 2024

docker exec -it homeassistant bash -c "wget https://raw.githubusercontent.com/seveas/python-hpilo/5881ffab4fba6ea136176a92de58c710704e9653/hpilo.py -O /usr/local/lib/python3.12/site-packages/hpilo.py"

This fixed it for me on 2024.2.2

gjohansson-ST pushed a commit that referenced this issue Feb 23, 2024
* Update hpilo version in requirements_all.txt (#109581)

The issue with the deprecated and now removed ssl.wrap_socket function was fixed years ago in the library

* Update hpilo version in manifest.json (#109581)
@adamllryan
Copy link

adamllryan commented Feb 27, 2024

I am using HAOS Core and don't have a python 3.12 folder, how would I go about fixing this? I'm reading addons run within docker instances but I can't seem to find it.

@Nirostar
Copy link
Contributor

I am using HAOS Core and don't have a python 3.12 folder, how would I go about fixing this? I'm reading addons run within docker instances but I can't seem to find it.

I created a PR that should fix the problem. In the meantime, if you want a temporary fix until the next update, you can run

docker exec -it homeassistant bash -c "wget https://raw.githubusercontent.com/seveas/python-hpilo/5881ffab4fba6ea136176a92de58c710704e9653/hpilo.py -O /usr/local/lib/python3.12/site-packages/hpilo.py"

Be aware: This won't carry over after updates.

If you want to do that in HAOS you need the https://github.com/hassio-addons/addon-ssh addon (this is the non-restricted community version) and disable the Safe mode.

Please read the comment to the end. You need this addon (and really the non-restricted one) and execute it in that then.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.