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!
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.
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?
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’].
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'
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.
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
But the sensor names showing there do not work when used in configuration for example