Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

atrovato/gladys-timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gladys-timer

Scripts to add some timer logics to Gladys.

API

All defined functions are promises and can be used as :

gladys.modules.timer.deviceTimer({ ... params })
  .then(() => ... something else ...) 
  .catch(() => ... something more ...); 

Device Timer

This function allows you to check when a value of a device if reached, and changes temporary the value of another device.

gladys.modules.timer.deviceTimer({ ... params });

With 'params' is an object as :

Property Description Example
timeout Time to check device state in milliseconds 2000 (for 2s)
provider Description of the input device { deviceTypeId: 1, activeValue: 1, operator: '=' }
consumer Description of the output device { deviceTypeId: 2, activeValue: 1, inactiveValue : 0 }

provider.operator can be one of : <=, <, =, >, >=, and is not mandatory (default is =).

Example : when the presence sensor (id=1) detects activity, the light (id=2) should be ON only for 2 minutes after last activity

gladys.modules.timer.deviceTimer({
  // time, duration 
  timeout: 120000,
  // device to activate timer
  provider: {
    deviceTypeId: 1, // presence sensor ID
    activeValue: 1 // presence value for activity
  },
  // device to manage
  consumer: {
    deviceTypeId: 2, // light ID
    activeValue: 1, // switch light ON
    inactiveValue: 0 // switch light OFF
  }
 });

About

Add some timer functionnalities for Gladys devices

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published