Giter Site home page Giter Site logo

guillaumelamirand / docker-monitor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sanderhuisman/home-assistant-custom-components

2.0 2.0 0.0 94 KB

๐Ÿก Custom components for Home-Assistant

Home Page: https://www.home-assistant.io/

License: Apache License 2.0

Python 100.00%

docker-monitor's People

Contributors

ceerbeerus avatar guillaumelamirand avatar sanderhuisman avatar walthowd avatar

Stargazers

 avatar  avatar

Watchers

 avatar

docker-monitor's Issues

`IndexError: list index out of range` while setting up

Hi. Great to see a HACS compilement fork of the docker monitor integration!

RPi 4 running 64-bit Ubuntu Server.
Docker: 19.03.9, build 9d98839
Docker Compose: 1.21.0, build unknown
Home Assistant Core: 0.111.2
HACS: 1.1.0
Docker Monitor: 0.0.5

Installing through HACS went fine however I get this error while HA tries to setup the integration:

Logger: homeassistant.components.sensor
Source: custom_components/docker_monitor/sensor.py:328
Integration: Sensor (documentation, issues)
First occurred: 19.14.14 (1 occurrences)
Last logged: 19.14.14

Error while setting up docker_monitor platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 297, in async_write_ha_state
    self._async_write_ha_state()  # type: ignore
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 323, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/config/custom_components/docker_monitor/sensor.py", line 328, in state_attributes
    attributes[ATTR_IMAGE] = stats['info']['image'][0]
IndexError: list index out of range

This is my setup in configuration.yaml. I'm going for the default value of adding all containers and their states. When manually adding them, there is no issue.

docker_monitor:
  name: Docker
  url: unix://var/run/docker.sock
  scan_interval: 10

As I'm running Home Assistant Core in Docker, I'm using Docker Compose, and this is my config where the docker socket is added as a volume.

version: 3.6
services:
  homeassistant:
    image: homeassistant/home-assistant:latest
    ...
    volumes:
      - /etc/localtim:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock
      - ./services/homeassistant:/config:rw
    ...

No long term statistics

Hi, Thanks for forking this component, the original doesn't appear to be active anymore. Would it be possible to support long term statistics by setting the state_class?

To give an example, this is all I had to do via a template sensor copy to enable it:

- sensor:
    - name: "Frigate CPU use copy"
      unit_of_measurement: "%"
      state_class: "measurement"
      device_class: "temperature"
      state: >
        {{ states('sensor.docker_monitor_frigate_cpu_use') }}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.