Playing around with this new component: https://github.com/wxt9861/esxi_stats.
I am trying to parse a long json but this doesn’t seem like it can be done by a rest sensor since the information is coming from an internal sensor.
Examples:
The sensor: sensor.esxi_stats_hosts
with a numeric state: 28
and json state attributes:
{
"hassio": {
"name": "hassio",
"status": "green",
"state": "running",
"uptime_hours": 15.1,
"cpu_count": 1,
"cpu_use_%": 44,
"memory_allocated_mb": 1024,
"memory_used_mb": 1092,
"used_space_gb": 8.29,
"tools_status": "toolsOk",
"guest_os": "Ubuntu Linux (64-bit)"
},
"callforce01": {
"name": "callforce01",
"status": "green",
"state": "running",
"uptime_hours": 35.5,
"cpu_count": 1,
"cpu_use_%": 23,
"memory_allocated_mb": 4096,
"memory_used_mb": 3907,
"used_space_gb": 44.99,
"tools_status": "toolsOk",
"guest_os": "Microsoft Windows 7 (64-bit)"
},
"dsu-vdi2": {
"name": "dsu-vdi2",
"status": "green",
"state": "off",
"uptime_hours": "n/a",
"cpu_count": 1,
"cpu_use_%": "n/a",
"memory_allocated_mb": 2048,
"memory_used_mb": "n/a",
"used_space_gb": 29.06,
"tools_status": "toolsNotRunning",
"guest_os": "Microsoft Windows 7 (64-bit)"
},
I am trying to create an automation where when any of the devices change from “status”: “green”. It sends a notification of the device’s name (e.g. “name”: “callforce01”).
Similarly there is another sensor sensor.esxi_stats_datastores
with a numeric state: 8
and json state attributes:
{
"sso14-local": {
"name": "sso14-local",
"type": "vmfs",
"free_space_gb": 127.55,
"total_space_gb": 128.5,
"connected_hosts": 1,
"virtual_machines": 0
},
"sso15-local": {
"name": "sso15-local",
"type": "vmfs",
"free_space_gb": 59.8,
"total_space_gb": 60.75,
"connected_hosts": 1,
"virtual_machines": 0
},
"sso16-local": {
"name": "sso16-local",
"type": "vmfs",
"free_space_gb": 59.8,
"total_space_gb": 60.75,
"connected_hosts": 1,
"virtual_machines": 0
},
Here I am trying to create an automation for free space percentage ((“free_space_gb”: 59.8 / “total_space_gb”: 60.75) * 100). When this value for any of the devices falls below 30%. It sends a notification of the device’s name (e.g. “name”: “sso14-local”).
Any help is appreciated!