Just wanted to say this is awesome and thanks for the hard work! Just installed yesterday (manually), but I’ll be working on breaking some info out into individual sensors sometime soon. Hoping to use this data to help with a server rack RGB project (LEDs on each side of the rack - using host data to change colors to help indicate resource usage and/or issues).
This will also help me get rid of Glances on each VM.
Thanks again for the excellent component. I now have a way to pull data from my NUC running ESXi and present it in HA.
This screenshot is still a work in progress but figured I’d share in the hopes that it inspires others to do the same. Still need to add VM counts and a few other things here and there.
Wow, this looks great. Do you mind sharing what you did to create this view?
Next I want to present some host networking information to allow us to monitor status - for example, if you have multiple physical adapters attached to a vswitch it would be helpful to see this in HASS and alert if one goes down.
That looks good - if you copy the templates from the github repo, you should only need to replace the names of your VMs to get it working.
What version of button card are you running? I am not an expert on button card, but i think some of the features only supported in later versions (2.0+). Maybe check the button card thread, I think the creator is active and should be able to help further
Thank you for the great feedback. The view itself leverages several different cards. This includes,
Bar Card (for the graphs)
Picture Card (For the image)
Button-Card (For the Headers)
Vertical and Horizontal Stack (for organizing cards within a row or column)
Vertical Stack In Card (for eliminating the gap between stacks)
Decluttering Card (used to create a template for each card so they can be easily reused).
Layout Card (Optional - Used for controlling the overall size and layout of the view itself)
From there I just used slightly modified versions of the Value Templates to create dedicated sensors for each attribute that I wanted to display. For example, I leveraged the Total Disk Space and Free Disk Space attributes to calculate a Used Disk Space value. The Used Disk Space and Total Disk Space sensors were then piped into Bar Card to create the bar itself.
Here is the YAML code I used to generate the Used Disk Space value. This needs to go inside of your sensor.yaml file. Make sure to replace the placeholder text ( i.e. <PLACEHOLDER>) with your desired entity names and actual datastore names.
- platform: template
sensors:
<DESIRED_ENTITY_NAME>: #This will be the entity name of your sensor. You can call this whatever you want.
entity_id: sensor.esxi_stats_hosts # This is the default entity created by the ESXi Custom Component from which the attributes are pulled.
friendly_name: 'ESXI Used Disk Space - Datastore 1' #Again, this can be whatever you want
value_template: "{{ states['sensor.esxi_stats_datastores'].attributes.<DATASTORE_NAME_HERE>.total_space_gb - states['sensor.esxi_stats_datastores'].attributes.<DATASTORE_NAME_HERE>.free_space_gb | round () }}"
unit_of_measurement: 'GBs'
One thing to note about the value_template - I had to add | round () to the template because one of my datastores returned a value with 14 decimal places! That bit of code limits the value to two decimal places, however it may not be necessary for other use cases.
To be honest, the hardest part was having to convert the attributes into dedicated sensor entities in order to leverage the associated values. The value templates on the github page were a huge help but I could see where novice HA users would be completely lost. Heck, it took me a while to wrap my head around the whole thing.
@wxt9861 Considering the nested nature of all the information (basically everything is nested below sensor.esxi_stats_hosts, esxi_stats_vms, or sensor.esxi_stats_datastores), would it be possible for the component to generate unique datastore and vm sensor entities rather than presenting them as nested attributes? This would make it much easier to leverage the data generated by the component. Just a thought.
Thank you for the write up. I’d like to try something like this.
I don’t see a problem with that. Initially I nested it this way to keep the number of additional sensors lower, but the downsides are exactly what you described.
Breaking out each object into its own entity would certainly make things a lot easier. It would be a breaking change, but the upsides are easier management.
Something like this.
With the entity name being something like - sensor.esxi_vm_<vm_name>
Also, the status can be anything - either status, uptime, state… maybe make it configurable via yaml/Integration UI.