Git Product home page Git Product logo

Comments (7)

warthog618 avatar warthog618 commented on September 26, 2024

The cpu module feels like a more natural fit for uptime.

The rest all change rarely and together, so bundling them makes sense.

Would:

  • machine (uname -m)
  • kernel_name (uname -s)
  • kernel_version (uname -v)
  • kernel_release (uname -r)
  • os_release (os-release PRETTY_NAME)
  • os_release_name (os-release NAME)
  • os_release_version (os-release VERSION)

work for you?

from dunnart.

plord12 avatar plord12 commented on September 26, 2024

Yes, that looks perfect :-) Many thanks.

from dunnart.

warthog618 avatar warthog618 commented on September 26, 2024

I've pushed some updates that add the sys_info module and the uptime to the cpu module.
I had to tweak the os_XX names a little as the original naming confused HA, I suspect as the os_release name overlapped the others.
I'm not happy with the formatting of uptime in HA, but haven't found a good solution for that yet.

from dunnart.

plord12 avatar plord12 commented on September 26, 2024

Brilliant ! Actually I think the uptime is as it should be ( expressed in seconds ), can always be formatted eg

{% set total_seconds = states('sensor.arm2_cpu_uptime') | float %}
{% set days = (total_seconds / 86400) | int %}
{% set hours = ((total_seconds % 86400) / 3600 ) | int %}
{% set minutes = ((total_seconds % 3600) / 60 ) | int %}
**OS:** {{ states('sensor.arm2_sys_info_os_release') }}
**Kernel:** {{ states('sensor.arm2_sys_info_kernel_release') }}
**Uptime:** {{ days }} day, {{ hours }} hours, {{ minutes }} minutes

from dunnart.

warthog618 avatar warthog618 commented on September 26, 2024

I'm fine with the class and units passed to HA, I'm not happy with any of the standard formatting options.

My preference would be something that displays as days, hours, minutes and seconds, drops the leading terms if they are zero, and maybe drops the seconds if the uptime is greater than an hour (or some other threshold).
I'm a bit surprised to find there isn't something that can do that out of the box, rather than having to do a whole lot of templating.

from dunnart.

plord12 avatar plord12 commented on September 26, 2024

I suppose you could call uptime -p and return a string

from dunnart.

warthog618 avatar warthog618 commented on September 26, 2024

No, I'm not going to do formatting on the wrong end.
The class and units being passed are appropriate - it is the disappointing lack of formatting options in HA itself that is my problem.

from dunnart.

Related Issues (4)

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.