We have moved at community.getvera.com

Author Topic: Code to convert from seconds to hh:mm:ss  (Read 1001 times)

Offline Talisker

  • Sr. Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
Code to convert from seconds to hh:mm:ss
« on: January 26, 2019, 05:44:59 pm »
I keep a count of the number of seconds my boiler is on, which ultimately I use to estimate gas usage.  I would like to display the boiler second count in a multistring in hh:mm:ss format.  Is there a slick way of doing it?  Can anyone give me some direction or exemplar code to get me started please?

Offline akbooer

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: Code to convert from seconds to hh:mm:ss
« Reply #1 on: January 26, 2019, 05:57:29 pm »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 1464
  • Karma: +41/-36
Re: Code to convert from seconds to hh:mm:ss
« Reply #2 on: January 28, 2019, 07:58:23 pm »
Not a direct answer but a similar solution I used to monitor my furnace blower (to change the filter). Attached is my PLEG logic that converts seconds to hours.
Vera 3, 1.7.1040, CT101, Everspring Motion, GE/Jasco Switch/Dimmer, Leviton outlet, AeonLabs sensor, NuTone garage door, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual/Multi Switch, LB60Z-1 bulb, Hue, Alexa, Zooz 4-1