Coder Social home page Coder Social logo

Comments (12)

balloob avatar balloob commented on July 25, 2024 2

I think just making it device class timestamp is the way to go . If timestamp is in the future, we add "in X", else it's "X ago", depending on locale.

With experimental UI, people can choose if they want to see the relative time or the timestamp.

from architecture.

OttoWinter avatar OttoWinter commented on July 25, 2024 1

I mean it might be appear as a period in the frontend, but in the back end it's just a timestamp, right?

If we were to call it "time period" I'm sure that could cause some confusion when someone tries to use this device class to show a static time period, like travel time to work.

So I would say "timestamp" would be more appropriate.

from architecture.

c727 avatar c727 commented on July 25, 2024 1

Hmmm... Uptime: 3 hours ago is a bit strange. So I will also change the default name to something like Restarted or we create 2 new classes: one will show 3 hours and the other will show 3 hours ago

from architecture.

OttoWinter avatar OttoWinter commented on July 25, 2024

Ok so I think there are three types of times that could be represented by sensors:

  • "Static" time period, like the amount of time to get to work. 15 min. Suggestion: time_period (TBD)
  • A timestamp; an event at a specific time. As per @c727: 3 hours ago. Suggestion: timestamp (TBD)
  • Combination of the two. A time period that starts from a static timestamp like uptime. Suggestion: relative_timestamp (this issue)

Obviously, it won't be possible to accommodate all of these in a single device class and we don't need the other device classes yet, but naming these consistently from the start is definitely good 👍

from architecture.

balloob avatar balloob commented on July 25, 2024

I guess if we keep device classes to the content, timestamp is in this case the most appropriate. I guess the frontend will need to be updated to render it then both by showing the timestamp and showing how long it was ago. Depending on the data, one could be more important than the other.

from architecture.

c727 avatar c727 commented on July 25, 2024

And do you think we should support both: uptime: 3 hours and restart: 3 hours _ago_ or is one enough?

from architecture.

c727 avatar c727 commented on July 25, 2024

Otto, I think for the static example we don't need a class as the state would not be updated every interval

from architecture.

exxamalte avatar exxamalte commented on July 25, 2024

Displaying a timestamp as a relative time from now is very use-case dependent, so keeping data type and view type independent would be preferable.
Also, keep in mind that the timestamp can be in the future: "Next Bus: in 5 minutes"

from architecture.

c727 avatar c727 commented on July 25, 2024

^it will only effect this one device_class

from architecture.

awarecan avatar awarecan commented on July 25, 2024

I also need one to display timestamp in future. For example, ETA: in 5 minutes

Ha, just saw @exxamalte comment after submit my comment.

from architecture.

balloob avatar balloob commented on July 25, 2024

Okay, we're going for timestamp. UI support is landing in 0.84 for it: home-assistant/frontend#2087

UI will support all the different display options so we don't have to make a choice

from architecture.

balloob avatar balloob commented on July 25, 2024

Dev docs PR: home-assistant/developers.home-assistant#147

from architecture.

Related Issues (20)

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.