Coder Social home page Coder Social logo

peterkawa / chronograph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xeroxq/chronograph

0.0 0.0 0.0 1014 KB

Adds precise timer, stopwatch and transition functionality to Homey.

Home Page: https://apps.athom.com/app/nl.fellownet.chronograph

License: GNU General Public License v3.0

JavaScript 93.29% HTML 5.88% CSS 0.83%

chronograph's Introduction

Chronograph

Adds precise timer, stopwatch and transition functionality to Homey.

Build Status Code Climate Donate

Features

  • Self-explanatory flow cards for easy integration of timers, stopwatches and transitions in your home automation,
  • Create timers, stopwatches and transitions directly from flow cards, no need for a prior configuration,
  • Start timers with a duration in milliseconds (fractional seconds), seconds, minutes, hours or days,
  • Start stopwatches without a predefined end time,
  • Start transitions to gradually change a device parameter over time,
  • Trigger flows at exact timer- or stopwatch durations with millisecond (fractional seconds) precision,
  • Pause and resume timers, stopwatches and transitions with action cards or from within settings,
  • Support for random or computed durations or adjustments using simple math expressions,
  • All timers, stopwatches and transitions are persistent across Homey restarts,
  • Target multiple timers, stopwatches and transitions at once using wildcards in supported cards.

Simple math expressions

The start, resume and adjust action cards have built-in support for simple math expressions. This allows for random or computed timer and stopwatch durations, including calculations based on token values.

For example:

ceil(99.5) / 5
pick(1, 3, 5, 9) * 2
random(10, 30)
abs(-10)

In addition to basic math expressions, the following functions are supported:

  • abs(x) - calculate the absolute value of a number,
  • ceil(x) - rounds a number up to the next whole number,
  • floor(x) - rounds a number down to the previous whole number,
  • round(x) - rounds a number towards the nearest whole number,
  • random(min, max) - a random number larger or equal to min and smaller than max,
  • min(x, y) - the lowest number from the supplied list,
  • max(x, y) - the largest number from the supplied list,
  • pick(x, y[, n]) - pick a random value from the supplied list.

HomeyScript

In addition to the available flow cards, timers and stopwatches can also be controlled using HomeyScript. For example, this script will stop all running timers:

let app = await Homey.apps.getApp({id:'nl.fellownet.chronograph'});
app.apiGet('/timers').then(result => {
	let timers = JSON.parse(result);
	timers.forEach(timer => {
		app.apiDelete('/timers/' + timer.id);
	});
});
  • GET /timers - retrieve a list of all active timers,
  • GET /timers/:id - retrieve a single timer,
  • PUT /timers/:id - pause or resume a timer,
  • DELETE /timers/:id - stops a timer.
  • GET /stopwatches - retrieve a list of all active timers,
  • GET /stopwatches/:id - retrieve a single timer,
  • PUT /stopwatches/:id - pause or resume a timer,
  • DELETE /stopwatches/:id - stops a timer.
  • GET /transitions - retrieve a list of all active transitions,
  • GET /transitions/:id - retrieve a single transition,
  • PUT /transitions/:id - pause or resume a transition,
  • DELETE /transitions/:id - stops a transition.

Contributing

To submit a bug report or feature request, please create an issue at GitHub.

If you'd like to contribute code to this project, please read the CONTRIBUTING.md document.

Support

If you like this project, perhaps you can support us by making a donation?

  • Paypal: Donate
  • Bitcoin: 3KU2PbVyB1cVh7n6uNuNYbhuZopC9GP2hp

Credits

Application image by Agê Barros on Unsplash.

Changelog

v1.1.2

  • Fixed a timer display bug.
  • Additional capabilities for monitoring.

v1.1.1

  • Ability to delay the execution of flows.
  • Additional tokens for transition cards.
  • Simplified monitoring of timers, stopwatches and transitions.

v1.1.0

  • Support for the new Homey App Store.
  • Prevent stale chronographs after restart.

v1.0.8

  • Added the ability to use wildcards in various action and trigger cards.

v1.0.7

  • Added pause trigger cards.

v1.0.6

  • Added transitions to gradually change a value over time.
  • Support for simple math expressions in timer, stopwatch and transition durations.

v1.0.3

  • German translation, thanks to Copiis.

v1.0.2

  • Timers and stopwatches are now persistent across application restarts and Homey reboots.
  • Pause and resume timers and stopwatches from flow cards.
  • Fine-tuning of the settings page.
  • Pause and resume timers and stopwatches from settings.
  • Support for timers longer than 24.855 days.
  • Unit testing.

v1.0.1

  • Added settings screen for overview and stop actions.
  • Updated several flow descriptions.
  • Fixed a missing import bug.
  • Added stop trigger cards and duration tokens.

v1.0.0

  • First public release.

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.