Sanderhuisman / home-assistant-custom-components

šŸ” Custom components for Home-Assistant
https://www.home-assistant.io/
Apache License 2.0
33 stars 12 forks source link

Container uptime? #2

Closed ualex73 closed 5 years ago

ualex73 commented 5 years ago

I like the docker monitor, but i am only missing the uptime of each container. Is it possible to add this too?

Sanderhuisman commented 5 years ago

Hi Alexander,

I've been on a short holiday and haven't been behind my laptop for the last days;) I added an initial up time sensor which you can test with branch 'feature/2' (the ID of this feature). I will work on it further during the week.

ualex73 commented 5 years ago

Hi Sander,

Np, holiday is always nice and best not to bring your laptop ;-)

Ok, i will test it tomorrow, but the "uptime" is similar to the "docker ps" output? Like the following example: $ docker ps -a 60440cfbd8f3 homeassistant/home-assistant:0.86.2 "python -m homeassisā€¦" 24 hours ago Up 11 hours hass 981139a2f69f ualex73/devolo-avpromanager:1.0 "/init" 5 weeks ago Exited (0) 4 weeks ago avpro

So the Up 11 hours and Exited (0) 4 weeks ago

Regards, Alex

Sanderhuisman commented 5 years ago

I took the start time of the container for the up time sensor, so the value itself is the date the container started and HA shows that as uptime (as I marked that specific sensor value as timestamp device class).

I merged the branch with the master, but I will keep this issue open for feedback ;)