Giter Site home page Giter Site logo

tomaae / homeassistant-portainer Goto Github PK

View Code? Open in Web Editor NEW
72.0 6.0 4.0 487 KB

Portainer integration for Home Assistant

License: Apache License 2.0

Python 100.00%
homeassistant docker hacs homeassistant-components homeassistant-custom-component homeassistant-integration portainer

homeassistant-portainer's People

Contributors

iamthemilkmanmymilkisdelicious avatar imgbotapp avatar tomaae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

homeassistant-portainer's Issues

[Feature] Implement health-checks as status

Is your feature request related to a problem? Please describe.

I have implemented health-checks for most of my containers, which is really helpful when trying to solve problems before they affect production. This feature is not available via the integration, thus making it impossible to reflect the actual status in home assistant (running ≠ healthy).

Describe the solution you'd like

Implement (if possible) health status, so that the dashboard for example could show all containers that are unhealthy.

Describe alternatives you've considered

Additional context

[Feature] Environment as attribute

Is your feature request related to a problem? Please describe.

I want to have a list of my containers and their environments visible in home assistant.

Describe the solution you'd like

An attribute value for every entity called environment which would match the environment name the container is in

[Bug] Container entity environment attribute shows incorrect endpoint name

I have 5 environments, i connect 4 of them using portainer agent to portainer installed on my main environment.
So 4 portainer agents installs and 1 portainer install.
I connected the portainer install to the integration.
To make it easy to explain the issue lets name my 5 environments a b c d e
The integration created 2 devices and named them Portainer Endpoints and Portainer a
It added all the container entities under Portainer a which is not a big deal for me.
But inside every container entity there is a attribute called environment that is set to e on all of them.
That is the issue i wanted to point out because i have the same container running on more than 1 endpoint and i can not differentiate.

How to reproduce the issue

On initial install

Expected behavior

Each container entity to have the correct environment name

Screenshots

image

Software versions

  • Home Assistant version: 2023.10.5
  • Portainer integration version: v1.0.2
  • Portainer software version: 2.19.1

Diagnostics data

config_entry-portainer-e16601bca67a2762bd40d71edfa86a23.json.txt

CE edition

Hi,
Did your integration works with CE (community édition= free)
I'm not sur because in CE you can't attaché token to user.
Tks

[Question] No response from host.

Hello together,
I'm running my Homeassistant as an Container and installed HACS.
Now I want to control my other containers with Homeassistant and found your Addon.
When I tried to connect to docker, it says:
unable to fetch data "endpoints" (no_response)

So I activated the debug and he says:
query: endpoints, get, {}
and in the second line:
unable to fetch data "endpoints" (no_response)

I've tried to use https and without, tried to add "/api/endpoints/2/" and other things.
I even removed the docker from the swarm and it didn't helped.
I have no clue how i could go further.

Hopefully, somebody could help me.
Thanks, before.
Greetings
Ralf

[Bug] Creating new entities

Describe the issue

Sometimes (usually after a restart of homeassistant) the list of entities will have duplicates. So I'll have two containers:

  • sensor.portainer_myserver_watchtower_2
  • sensor.portainer_myserver_watchtower_3

When I click into sensor.portainer_myserver_watchtower_2 it says the entity is no longer in use by the integration:

Screenshot from 2023-06-30 12-10-15

This means my list of entities keeps growing until I manually remove old entities.

How to reproduce the issue

Hard to reproduce, seems to happen randomly when I restart homeassistant or the machine itself.

Expected behavior

Container entities should always be the same and new ones should not be created:
There should only ever be one entity:

  • sensor.portainer_myserver_watchtower

[Bug] 200 Error

Describe the issue

When attempting to connect to my remote box via portainer.mywebsite.com and issuing the access token the setup screen replies with 200 and doesn't move forward.

How to reproduce the issue

Expected behavior

Screenshots

Software versions

  • Home Assistant version: 2023.11.3
  • Portainer integration version: 1.0.2
  • Portainer software version:

Diagnostics data

Traceback/Error logs

Additional context

[Feature]

Is your feature request related to a problem? Please describe.

My favorite Language ist not aviable in lokalise.

Describe the solution you'd like

Describe alternatives you've considered

Additional context


[Feature] Rename sensors based on environment name

Is your feature request related to a problem? Please describe.

I have multple environments in Portainer, each for different endpoints.
There are common containers across all these endpoints, for example telegraf/glances/etc.
For containers with the same names across different environments, this integration creates similar name sensors, like
sensor.telegraf_xx_1, sensor.telegraf_xx_2, etc. This becomes difficult to maintain in HA.

Describe the solution you'd like

Append environment name to the sensor entity,
sensor.environment_one_telegraf, sensor.environment_two_telegraf, etc

Describe alternatives you've considered

Additional context

[Bug] all Endpoints shown offline if one Endpoint is offline

Describe the issue

HA shows both Endpoints as offline if one Endpoint is offline.

How to reproduce the issue

Steps to reproduce the behavior:

  1. Shutdown one Endpoint, here the Endpoint "PBS":
    Bildschirmfoto 2024-04-01 um 09 33 27

  2. Click on Portainer Card:
    Bildschirmfoto 2024-04-01 um 09 34 07
    Bildschirmfoto 2024-04-01 um 09 13 15
    Bildschirmfoto 2024-04-01 um 09 13 04

  3. Start the previously stopped Endpoint:
    Bildschirmfoto 2024-04-01 um 09 12 21
    Bildschirmfoto 2024-04-01 um 09 12 46

Expected behavior

HA Portainer integration shows only the offline Endpoint as offline.

Screenshots

Software versions

  • Home Assistant version:
    Core 2024.3.3
    Supervisor 2024.03.1
    Operating System 12.1
    Frontend 20240307.0

  • Portainer integration version: v1.0.2

  • Portainer software version:
    Endpoint Homeserver 24.0.5
    Endpoint PBS 25.0.3

Diagnostics data

Traceback/Error logs

Additional context

The second integration is on another system, witch is online only every 3 days.

[Bug] Messed up integration entries list when more than one hosts added

Describe the issue

Adding more than one portainer entry results in messed up integration entries list.
In my case portainers running on hosts frigate:9000 and dtake:9000
All devices and entities are there but all are listed under first added host (frigate:9000 in my case).
Please, see attached pictures.

How to reproduce the issue

Just add more than one portainer entry.

Expected behavior

Screenshots

Software versions

  • Home Assistant version:
  • Portainer integration version:
  • Portainer software version:
    Home Assistant Core 2023.9.3, Frontend 20230911.0 - latest
    Portainer integration version: v1.0.2
    Portainer(s) version: Community Edition 2.19.1

Diagnostics data

Traceback/Error logs

Additional context

portainer1
portainer2
portainer3

[Question] I don't see entities nor portainer in the menu

I thought this was supposed to add portainer as a menu item on the left side, but maybe this plugin just makes entities.

Home Assistant 2023.9.1

I am getting an error, I followed the :

2023-09-14 15:43:59.575 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.portainer
2023-09-14 15:43:59.582 ERROR (MainThread) [homeassistant.components.sensor] portainer: Not adding entity with invalid device info: Invalid device info {'configuration_url': 'http://192.168.0.46:9443', 'connections': {('portainer', 'Portainer_Endpoints')}, 'default_manufacturer': 'Portainer', 'default_name': 'Portainer Endpoints', 'identifiers': {('portainer', 'Portainer_Endpoints')}, 'sw_version': ''} for 'portainer' config entry: device info needs to either describe a device, link to existing device or provide extra information.

image

[Bug] Entities not working (portainer-agent stopped)

Describe the issue

After adding integration, all entities are unavailable when using portainer-agent

Steps to reproduce the behavior:

  1. Have 2 separate docker hosts with portainer and portainer-agent installed on both
  2. configure connections:
    from portainer1 to docker1 using local socket (default), portainer1 to docker2 using portainer-agent2
    from portainer2 to docker2 using local socket (default), portainer2 to docker1 using portainer-agent1
  3. stop portainer agents on both hosts
  4. configure portainer integration with portainer1

Expected behavior

Working entities that are on docker1, when integration is configured to use portainer1.

Software versions

  • Home Assistant version: 2023.10.5
  • Portainer integration version: v1.0.2
  • Portainer software version: CE 2.18.4

Additional context

Weird is that if I start portainer-agent on docker2, it will immedialy start working for both, docker1 and docker2 containers.

[Feature] Update entity that uses webhooks

Is your feature request related to a problem? Please describe.

It would be nice to have a way to monitor the availability of a new image for a stack/container and trigger the update from Home Assistant.

Describe the solution you'd like

I don't know if it's feasible, but maybe it could be possible to introduce an update. entity in Home Assistant that senses whether or not there is a new image available and sends a POST request to a specific stack webhook, triggering the image pull and the stack re-deployment.

Looking for testers

If you are interested in testing, let me know here.
Integration wont be added to HACS until it is in decent functionality stage and well tested. So all testing will be done by pulling from github directly.
You can also let me know bit about your setup and what would you like to monitor/automate using HA. It will help with development, as my own requirements for this integration are quite basic.

[Feature]Add servicies to start/stop/restart

Is your feature request related to a problem? Please describe.

Hi, I would like to start/stop but mostly restart my containers.
This is because it sometimes happens, for example, that Zigbee2mqtt needs a restart when some devices stop responding correctly.

The best thing would be if the "recreate" function were also included, allowing updates to the containers directly from Home Assistant.

Describe the solution you'd like

a bunch of services:

  • portainer.start
  • portainer.stop
  • portainer.restart
  • portainer.recreate

all of them should accept the sensor entity created by this integration to know which container should be the target.

Additional context

portainer documentation: https://app.swaggerhub.com/apis/portainer/portainer-ce/2.19.4
the docker endpoints shold be wrapped in this portainer endpoint:
https://[[HOSTNAME]]/api/endpoints/2/docker/containers/

  • portainer.start documentation: https://docs.docker.com/engine/api/v1.41/#tag/Container/operation/ContainerStart
  • portainer.stop documentation: https://docs.docker.com/engine/api/v1.41/#tag/Container/operation/ContainerStop
  • portainer.restart documentation: https://docs.docker.com/engine/api/v1.41/#tag/Container/operation/ContainerRestart
  • portainer.start documentation: https://docs.docker.com/engine/api/v1.41/#tag/Container/operation/ContainerStart
  • portainer.recreate:
    this is not a direct api call but a pipeline of it. Following an example:
    • POST: https://[[HOSTNAME]]/api/endpoints/2/docker/images/create?fromImage=lscr.io%2Flinuxserver%2Fduckdns:latest
      payload: {"fromImage":"lscr.io/linuxserver/duckdns:latest"}
    • POST:
      https://[[HOSTNAME]]/api/endpoints/2/docker/containers/0c2e56f5a2541ef1a4967fdc98d10c5770779511b1e54edce2fe4ee85ba02a01/stop
      payload: empty
    • POST: https://[[HOSTNAME]]/api/endpoints/2/docker/containers/0c2e56f5a2541ef1a4967fdc98d10c5770779511b1e54edce2fe4ee85ba02a01/rename?name=%2FDuckDns-old
      payload: {}
    • POST: https://[[HOSTNAME]]/api/endpoints/2/docker/containers/create?name=DuckDns
      payload: way too long. I think is the dump of the current image. I think this payload can be derived from the "config" section of this service: https://docs.docker.com/engine/api/v1.41/#tag/Container/operation/ContainerInspect.
      response: { "Id": "54f592b3e7ce49afe649bb0cf7aafbb0a00113233e6eb0535b2abbc7e5c55305", "Portainer": { "ResourceControl": { "Id": 294, "ResourceId": "54f592b3e7ce49afe649bb0cf7aafbb0a00113233e6eb0535b2abbc7e5c55305", "SubResourceIds": [], "Type": 1, "UserAccesses": [ { "UserId": 1, "AccessLevel": 1 } ], "TeamAccesses": [], "Public": false, "AdministratorsOnly": false, "System": false } }, "Warnings": [] }
    • POST: https://[[HOSTNAME]]/api/endpoints/2/docker/networks/my-bridge/connect
      payload: {"Container":"54f592b3e7ce49afe649bb0cf7aafbb0a00113233e6eb0535b2abbc7e5c55305"}
    • POST: https://[[HOSTNAME]]/api/endpoints/2/docker/containers/54f592b3e7ce49afe649bb0cf7aafbb0a00113233e6eb0535b2abbc7e5c55305/start
      payload: {}

[Bug] Cannot configure Integration through a FQDN, I get a "No response from host" error

Describe the issue

Cannot configure Integration through a FQDN, I get a "No response from host" error

How to reproduce the issue

Initial configuration
Host : https://<Fully Qualified Domain Name/ (Tried with or without 443 port)
Use SSL : true (tried with or without)
Verify SSL : true (tried with or without)

Expected behavior

Sucesfull configuration

Software versions

All fields in this sections are required.

  • Version | core-2023.9.3
  • Installation Type | Home Assistant OS
  • Portainer integration version: 1.0.2
  • Portainer software version: 2.19.1

Additional context

Portainer is running in a docker container
I can acccess it with no issue through the Fully Qualified Domain on the local network and from internet.

[Feature] Status/Start/Stop Stack

Is your feature request related to a problem? Please describe.

I would like a switch to start/stop the stack, that also would tell if the stack is running or "inactive".

Additional context

There are other ways to start/stop containers from HA, but I think this integration is in a unique position to take advantage of Portainer's stack concept.

Containers with the same name keep being recreated[Bug]

Describe the issue

I have multiple containers shown as sensors, and most of them are unavailable and could only be deleted manually - the problem is that I noticed it late and now I have ~1400 sensors listed in HA and it slows things down a bit.

To be clear: this is connected to Portainer with 2 docker standalone environments and running around 30 containers - definitely not in the thousands.

How to reproduce the issue

🤷‍♂️

Expected behavior

Containers as sensors don't get duplicated

Screenshots

image
image
image

Software versions

  • Home Assistant version: 2024.1.3
  • Portainer integration version: V1.0.2
  • Portainer software version: 2.19.4 BE

Diagnostics data

🤷‍♂️

Traceback/Error logs

🤷‍♂️

Additional context

I am runnig Portainer Business Edition - the problem seems to be is that when I update a stack using Portainer BE and select Re-pull image and redeploy
image
The number of entities goes up by the number of containers in the stack - indicating that this is caused by portainer stopping containers, pulling the latest image and then re deploying them. It also seems that additional container senors in the integration get a new index when they get recreated. For example:
image
image

[Bug] - no sensors in HA

Hi, I followed the steps, also with the access token in Portainer.
When I add the integration configuration it works fine, but I don't see any sensors in HA.

Am I missing something or does the integration perhaps not (yet) work with the latest HA/Portainer versions?

There are no logs generated in HA.

Thanks

Versions
HA: 2019.1
Portainer 1.25.0

The issue:
image

[Feature] Re-Configure the integration

Hello
Is it possible to view or change the configuration after the initial setup?
Or should I delete the integration and add back again?

Here attached the screen just to let me explain what am I referring to:
image

Thanks!!

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.