Home Elements Boards Recipes

Light Toggle with timer

This recipe implements a light switch that keeps light on for a specific time before switching off automatically.

(lightimerflow.png) ???

The configuration combines an digitalin, a timer, a switch and a digitalout element.

{
  "digitalin": {
    "up": {
      "pin": "D6",
      "description": "up button signal",
      "invert": "true",
      "pullup": "true",
      "onLow": "switch/light?toggle=1,timer/done?start=1"
    }
  },

  "timer": {
    "done": {
      "loglevel": "0",
      "description": "reset after timeout",
      "pulseTime": "00:05:00",
      "onOff": "switch/light?value=0"
    }
  }, 

  "switch": {
    "light": {
      "description": "Control light level",
      "value": 0,
      "onValue": "digitalout/light?value=$v"
    }
  },

  "digitalout": {
    "light": {
      "pin": "D0",
      "invert": "true",
      "value": "0",
      "description": "Light output on port D0 = GPIO16"
    }
  }
}

More functionality

By adding a button element in-between the digital input and the timer more functions can be supported:

Tags

Recipe