home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.62k stars 30.78k forks source link

Glances API changed #15849

Closed roblandry closed 6 years ago

roblandry commented 6 years ago

Home Assistant release with the issue:

0.75.1

Last working Home Assistant release (if known):

none, all will be affected if you upgrade glances to v3

Operating environment (Hass.io/Docker/Windows/etc.):

Docker

Component/platform:

https://www.home-assistant.io/components/sensor.glances/

Description of problem: Glances API is changing in V3. Instead of http://ipaddress:port/api/2/all it is now http://ipaddress:port/api/3/all

Details of the change: https://github.com/nicolargo/glances/wiki/The-Glances-RESTFULL-JSON-API

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

sensor:
  # GLANCES
  - platform: glances
    host: X.X.X.X
    #port:
    name: MYNAME
    resources:
      - 'disk_use_percent'
      - 'disk_use'
      - 'disk_free'
      - 'memory_use_percent'
      - 'memory_use'
      - 'memory_free'
      - 'swap_use_percent'
      - 'swap_use'
      - 'swap_free'
      - 'processor_load'
      - 'process_running'
      - 'process_total'
      - 'process_thread'
      - 'process_sleeping'
      - 'cpu_temp'
      - 'docker_active'
      - 'docker_cpu_use'
      - 'docker_memory_use'

Traceback (if applicable):

Additional information: Current workaround is to copy the homeassistant/components/sensor/glances.py file to your custom_components/sensor/ folder and manually change line 21 from:

_RESOURCE = 'api/2/all'

to:

_RESOURCE = 'api/3/all'
awarecan commented 6 years ago

v3 haven't released yet. Even after release, the better way to handle it is add a config to allow user select v2 or v3 api to use.

roblandry commented 6 years ago

Agreed, just putting it out there as i ran into this issue, and this is how i fixed it, until a better way is developed.

fabaff commented 6 years ago

Moving the glances to async is on my todo list for a while now. I guess that now it's time to do it.