Hey there,
as the HP iLO Integration doesn’t work with older hardware anymore (https://github.com/home-assistant/core/issues/87277, https://github.com/seveas/python-hpilo/issues/274) (iLO2 in my case), I need another approach to get that health data to my HA.
I can grab that iLO health data via another client, which has an older python than my HA and is able to retrieve that information as json data. Here’s my code in configurations.yaml:
- platform: command_line
name: hpdl380g6_health
command: "ssh -i /data/.ssh/id_ed25519 [email protected] 'hpilo_cli -P raw -j -l user -p pass 192.168.1.2 get_embedded_health'"
command_timeout: 55
scan_interval: 60
value_template: "{{ now().timestamp() | int }}"
json_attributes:
- health_at_a_glance
- temperature
- fans
- power_supplies
- drives_backplanes
As this command takes around 25 seconds I don’t want to split it into several requests.
As json data I get back the following data:
{
"health_at_a_glance": {
"power_supplies": {
"status": "Ok",
"redundancy": "Fully Redundant"
},
"fans": {
"status": "Ok",
"redundancy": "Fully Redundant"
},
"temperature": {
"status": "Ok"
},
"vrm": {
"status": "Ok"
},
"drive": {
"status": "Ok"
}
},
"temperature": {
"Temp 4": {
"status": "Ok",
"currentreading": [
38,
"Celsius"
],
"label": "Temp 4",
"critical": [
92,
"Celsius"
],
"caution": [
87,
"Celsius"
],
"location": "Memory"
},
"Temp 5": {
"status": "Ok",
"currentreading": [
41,
"Celsius"
],
"label": "Temp 5",
"critical": [
92,
"Celsius"
],
"caution": [
87,
"Celsius"
],
"location": "Memory"
},
"Temp 6": {
"status": "Ok",
"currentreading": [
43,
"Celsius"
],
"label": "Temp 6",
"critical": [
92,
"Celsius"
],
"caution": [
87,
"Celsius"
],
"location": "Memory"
},
... and much more information :)
Primarily I want to write that information into InfluxDB and visualize it via grafana, but as the states are very nested I didn’t find a way to feed that Sensor Attributes to grafana.
So I’ve tried to define a new template sensor
- platform: template
sensors:
hpdl380g6_health_power_supplies_status
value_template: "{{ state_attr('sensor.hpdl380g6_health', 'health_at_a_glance.power_supplies.status') }}"
but didn’t get it work.
I’ve tried different syntaxes with the template editor to figure out how it could work, but i.e. with this {{state_attr('sensor.hpdl380g6_health', 'health_at_a_glance', 'power_supplies', 'status') }}
it results in a TypeError: state_attr() takes 3 positional arguments but 5 were given
.
Any idea about failures, wrong syntax or easier approaches? Thanks in advance!