tomaae / homeassistant-portainer

Portainer integration for Home Assistant
Apache License 2.0
92 stars 7 forks source link

[Bug] Container entity environment attribute shows incorrect endpoint name #23

Open mash2k3 opened 11 months ago

mash2k3 commented 11 months ago

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

Diagnostics data

config_entry-portainer-e16601bca67a2762bd40d71edfa86a23.json.txt

fanaticDavid commented 1 month ago

I just discovered this really cool integration, but I can already confirm this bug. I have my Portainer-CE instance running on an Intel NUC, and I have 2 Portainer agents on my NAS and a Raspberry Pi. Every single container sensor has my NAS listed as its environment, which is incorrect. Sadly, #35 was auto-closed after going stale twice.

Update: being impatient as I am (😇), I manually applied the changes made to the 2 files in #35 and restarted HA. The changes seem to be working just fine:

As a last step, I removed the integration and added it back. I did this to get rid of the empty device that previously held all container entities and to update the entity_id of each container entity with the endpoint name.