HP ILO sensor component

I’ve just tried the following and this seems to work:

sensor hp_ilo:
  platform: hp_ilo
  host: hostname
  username: username
  password: password
  monitored_variables:
    - name: Storage Status
      sensor_type: server_health
      value_template: '{{ ilo_data.health_at_a_glance["storage"]["status"] }}'

This results in:

After updating to 0.57.2 I get an error in the log for the sensor.hp_ilo_server_health. The error is:

> 2017-11-08 15:26:20 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): 
> File "/usr/local/lib/python3.6/asyncio/tasks.py", line 180, in _step result = coro.send(None) 
> File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 398, in async_process_entity new_entity, self, update_before_add=update_before_add 
> File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 246, in async_add_entity yield from entity.async_update_ha_state() 
> File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 271, in async_update_ha_state self.entity_id, state, attr, self.force_update) 
> File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 752, in async_set state = State(entity_id, new_state, attributes, last_changed) 
> File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 538, in __init__ "State max length is 255 characters.").format(entity_id)) homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity id: sensor.hp_ilo_server_health. State max length is 255 characters.

My sensors.yaml contains the following monitored_variables:

monitored_variables:
- name: Power state
sensor_type: server_power_status
- name: CPU fanspeed
sensor_type: server_health
unit_of_measurement: ‘%’
value_template: ‘{{ ilo_data.fans[“Fan 1”].speed[0] }}’
- name: Inlet temperature
sensor_type: server_health
unit_of_measurement: ‘°C’
value_template: ‘{{ ilo_data.temperature[“01-Inlet Ambient”].currentreading[0] }}’
- name: Server Health
sensor_type: server_health

Anything I need to add to the server_health to get rid of the error in my log? Thanks!

I don’t think I’ve seen this behaviour before on my own machine, but I’ll try to have a look this weekend to see if I can do anything about it.

Thanks for your work! I just tried adding my ILO sensors today, and I get the same error as wmn79 when trying to add the server_health sensor. Any news on this? How can I help debug?

My current guess is that Hass / the component doesn’t like it when it receives the entire server_health json response. That would mean you need to include a value_template in your configuration to limit what is being returned.

Could you try this and see if that helps? If it does, I will update the documentation accordingly.

guys, how can i change the value template, so my sensor changes the server_power_on_time into days instead of minutes?

This appears to be true. When using the sensor as outlined in the docs, the Server Health sensor fails and the resulting log spew returns homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity id: sensor.hp_ilo_server_host_data. State max length is 255 characters.

So here’s a question: how do I get a hold of that JSON object so I know which fields are present so I can create the template sensors?

1 Like

https://seveas.github.io/python-hpilo/health.html

This might help you out, you should be able to figure them out from there.

Here is two I setup as a guide,

- name: CPU 1 Memory Size
  sensor_type: server_health
  value_template: '{{ ilo_data.memory["memory_details_summary"]["cpu_1"]["total_memory_size"] }}'
- name: CPU 2 Memory Size
  sensor_type: server_health
  value_template: '{{ ilo_data.memory["memory_details_summary"]["cpu_2"]["total_memory_size"] }}'

I currently have it disabled at the moment in my sensor’s, can’t remember why though, might have been the log spamming, not sure.

1 Like

so any1 got the uptime sensor working of a Hp Gen 8 microserver?

Where can that uptime info found in ILO? I have a HP Gen 8 microserver but when I look in the ILO I don’t seem to be able to find that uptime info.

Don’t think it’s possible on a microserver

If anyone want’s the easy way, this is my config for alot of sensors I feel needed.

here’s how you add a new one for “health_at_a_glance” for example

Find the value you want to import here: http://seveas.github.io/python-hpilo/health.html

 'health_at_a_glance': {'bios_hardware': {'status': 'OK'},
                        'fans': {'status': 'OK'},
                        'memory': {'status': 'OK'},
                        'network': {'status': 'OK'},
                        'processor': {'status': 'OK'},
                        'storage': {'status': 'OK'},
                        'temperature': {'status': 'OK'}},

For this sensor I wanna get the status of the storage, the value template would look like this

    value_template: "{{ ilo_data.health_at_a_glance['storage']['status'] }}"

As you can see the template follows the api, first ilo.data to call the ILO component in HA.
Then I wanna start with the topic health_at_a_glance. from that I want to look at the [‘storage’] topic and to show me the value [‘status’].

sensor:
  - platform: hp_ilo
    host: !secret hpilo_gen9host
    username: Administrator
    password: !secret hpilo_gen9password
    scan_interval: 120
    monitored_variables:
      - name: power_status
        sensor_type: server_power_status
      - name: power_readings
        sensor_type: sserver_power_readings
      - name: power_on_time
        sensor_type: server_power_on_time
      - name: uid_status
        sensor_type: server_uid_status

      - name: bios_hardware
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['bios_hardware']['status'] }}"

      - name: fan_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['fans']['status'] }}"

      - name: memory_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['memory']['status'] }}"

      - name: network_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['network']['status'] }}"

      - name: processor_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['processor']['status'] }}"

      - name: storage_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['storage']['status'] }}"

      - name: temperature_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['temperature']['status'] }}"

      - name: memory_cpu1_sockets
        sensor_type: server_health
        value_template: "{{ ilo_data.memory['memory_details_summary']['cpu_1']['number_of_sockets'] }}"

      - name: memory_cpu1_frequency
        sensor_type: server_health
        value_template: "{{ ilo_data.memory['memory_details_summary']['cpu_1']['operating_frequency'] }}"

      - name: memory_cpu1_voltage
        sensor_type: server_health
        value_template: "{{ ilo_data.memory['memory_details_summary']['cpu_1']['operating_voltage'] }}"

      - name: memory_cpu1_size
        sensor_type: server_health
        value_template: "{{ ilo_data.memory['memory_details_summary']['cpu_1']['total_memory_size'] }}"

      - name: nic_ilo_ip_address
        sensor_type: server_health
        value_template: "{{ ilo_data.nic_information['iLO iLO Dedicated Network Port']['ip_address'] }}"

      - name: nic_ilo_mac
        sensor_type: server_health
        value_template: "{{ ilo_data.nic_information['iLO iLO Dedicated Network Port']['mac_address'] }}"

      - name: nic_ilo_status
        sensor_type: server_health
        value_template: "{{ ilo_data.nic_information['iLO iLO Dedicated Network Port']['status'] }}"

      - name: psu_summary
        sensor_type: server_health
        value_template: "{{ ilo_data.power_supply_summary['present_power_reading'] }}"

      - name: temperature_inlet
        sensor_type: server_health
        unit_of_measurement: '°C'
        value_template: "{{ ilo_data.temperature['01-Inlet Ambient']['currentreading'] }}"

      - name: temperature_cpu1_
        sensor_type: server_health
        unit_of_measurement: '°C'
        value_template: "{{ ilo_data.temperature['02-CPU 1']['currentreading'] }}"

      - name: processors_cores
        sensor_type: server_health
        value_template: "{{ ilo_data.processors['Proc 1']['execution_technology'] }}"

      - name: processors_name
        sensor_type: server_health
        value_template: "{{ ilo_data.processors['Proc 1']['name'] }}"

      - name: processors_speed
        sensor_type: server_health
        value_template: "{{ ilo_data.processors['Proc 1']['speed'] }}"
1 Like

Verry Nice , do you have a gen8 server? Don’t think it will work on that one

The code above is for my ge9 server, I’m trying to find what works with my gen6 at the moment…

Create a template sensor, I have done it for months, as it’s a count not of the time since last power-on, but the total minutes powered on since it was manufactured. e.g:

- platform: template
  sensors:
    server_power_on_time_months:
      friendly_name: 'Server Power Converted Power On Time'
      value_template: '{{states.sensor.server_server_power_on_time.state | float // 43800 }}'
      unit_of_measurement: 'Months'

thnx for the info :slight_smile:

1 Like

Can i ask what your state value is for this?

When i do it i get (13, ‘Celsius’) instead of just 13 which messes with my graphs.

Is this a common result or am i doing something wrong ?

Thanks

That is the correct result. If you want just 13 then you’ll need to specify the starting indice for that section. Here is an example from my code.

- name: Fuji Inlet temperature
        sensor_type: server_health
        unit_of_measurement: "°F"
        value_template: >-
          {% set t = ilo_data.temperature["01-Inlet Ambient"].currentreading[0] | float(default=0) %}
          {{((t)*9/5)+32}}

I am converting the value to Fahrenheit so you can ignore the cast to float and the subsequent calculations. The part that your interested in is the [0] part.

1 Like

@DCN Solved it for me thanks … easy ehen you know how lol

I have an HP Microserver Gen8 and have managed to get a number of sensors working, but I have not managed to get any of the temperature sensors working.
The ILO is showing the following sensors
image
But the sensor names showing there do not work when used in configuration for example

    - name: temperature_inlet
      sensor_type: server_health
      unit_of_measurement: '°C'
      value_template: "{{ ilo_data.temperature['01-Inlet Ambient']['currentreading'] }}"

Has anyone else had any success with these?