Custom Component - ESXi Stats

Ok, everything is working. Really great and thanks to everybody

the last question: Is it possible to delay the shutdown? my esxi own my home assistant, the idea is to turn off the host after the vm’s.

Something like this:

service: esxi_stats.host_power
data:
host: 192.168.2.99
command: shutdown --delay 20
force: true

Shutting down the host also shuts down the VMs.

If you have the vmwaretools or openvmtools installed on the guests, it should gracefully shut them down as well.

2 Likes

You are right, i just tested and all my VM’s with vmwaretools shutdown without problems.

Thanks!

Hi,

unfortunately for VMs, I only get the used disk space. I would like to have a usage percentage (so i need total space or remaining space).
Is there a solution with this integration or with another solution?

Thanks !

1 Like

No - because we’re not reporting on the space use within the VM. This is reporting how much storage the VM is consuming on the datastore. If you want to report on the space use inside of a VM, you’ll need to use a different integration like glances or similar.

I wish!

It’s the one thing I feel is missing from this integration, but I understand why. Although you do see this info if you use the VMware iOS app, so it’s possible somehow.

What I ended up doing is using snmp to pull disk values OIDs for critical stuff since I’m using snmp already for monitoring.

It is possible as long as you have vmware tools installed in the vm.

I can investigate further. I think I’m going to move 0.7 out beta soon and work on new features after that.

1 Like

Hi, is still supported this integration? Because I have lot of set-up problem (field text not appear during installation / setting panel) on HA 2024.3.3

Still supported. If you’re having problems you can always open an issue on the git page.

Great component!

I do have some Problems with Services.

I assume it is a settings issue. I have vSphere Essentials, and am running 2 hosts on ESXI 8.0.2 and vCenter 8 as VM. I installed ESXI-Stats and added my vCenter server. All data is returned, but I am unable to execute the service calls. I removed the vCenter Server and added the hosts individually. One host responds to service calls such as esxi_stats.vm_power, the other does not. Whether relevant or not, the host that does not respond contains the vCenter VM. I removed the ESXI hosts from ESXI-stat and again added the vCenter server and confirmed it will not shut down vm’s located on either host. Are there any settings on either vCenter or on the hosts that need to be enabled to allow it to respond to requests?

I am also having the same issue with vCenter/ESXi 8.0.2. I have ESXi-Stats running properly with all of my sensors showing & updating data, but I cannot execute service calls.

I installed this component some time ago, and had it running with my ESXi server running 6.7. I had 9 entities reporting, and all was fine. Recently I saw the component was not loading, but didn’t have time to troubleshoot. Now I’ve updated HAOS and HA itself, several restarts, but it’s still not loading. I can’t figure out what’s happening. There are 5 errors and 2 warnings in the log relating to this. Here’s the first error:

Logger: homeassistant.loader
Source: loader.py:1067
First occurred: 1:38:59 PM (1 occurrences)
Last logged: 1:38:59 PM

Unexpected exception importing component custom_components.esxi_stats
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/esxi_stats/__init__.py", line 7, in <module>
    from .esxi import (
  File "/config/custom_components/esxi_stats/esxi.py", line 4, in <module>
    from pyVim.connect import SmartConnect, SmartConnectNoSSL
  File "/usr/local/lib/python3.12/site-packages/pyVim/connect.py", line 37, in <module>
    from pyVmomi import vim, vmodl, SoapStubAdapter, SessionOrientedStub
  File "/usr/local/lib/python3.12/site-packages/pyVmomi/__init__.py", line 39, in <module>
    from pyVmomi.SoapAdapter import SoapStubAdapter, StubAdapterBase, SoapCmdStubAdapter, \
  File "/usr/local/lib/python3.12/site-packages/pyVmomi/SoapAdapter.py", line 1003, in <module>
    _SocketWrapper = ssl.wrap_socket
                     ^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'

Also, I was trying to figure out how to remove the integration./configuration and redo it, but I can’t even do that. When I try to delete my configuration in the Integrations menu, it never goes away. If I try to add a new entry, it comes up with another error: “Config flow could not be loaded: {“message”:“Invalid handler specified”}”

Googling around the issue as well as reading through this whole thread doesn’t seem to give me much; I’d appreciate any help provided.