Skip to content

String that pretty prints started time (ago) does not handle long durations #138

@neel-m

Description

@neel-m

I have a multiple devices that stay up for a long time. One is currently running for more than 1469 hours and the string says: started 1 week 4 days ago

Looking at events I see:

retry: 30000
id: 996648978
event: ping
data: {"title":"genny","comment":"monitoring for Genny","ota":true,"log":true,"lang":"en"}

event: state
data: {"id":"binary_sensor-device_status","name":"Device Status","icon":"","entity_category":2,"value":true,"state":"ON"}

event: state
data: {"id":"sensor-uptime","name":"uptime","icon":"mdi:timer-outline","entity_category":2,"value":1469.893,"state":"1469.89 hours","uom":"hours"}

Looking at the js code I saw that it was dividing the value it gets from the ping by 1000. This is probably causing the value to wrap around very quickly since 32-bits can only hold so many milliseconds.

Is there an easy way to turn off the friendly time stamp string, since it is wrong pretty quickly and annoying when that happens?

Current config:

web_server: 
  port: 80
  version: 3

time:
  - platform: sntp
    id: sntp_time
    timezone: America/Los_Angeles

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions