Skip to content

Instantly share code, notes, and snippets.

@pauly7300
pauly7300 / gist:1015fc4cb6fa0fa007011362bcc3b9b5
Created December 21, 2018 05:34
alexa turn light on for X minutes then turn off.
[
{
"id": "4757e9d9.e3b448",
"type": "alexa-local",
"z": "e4a40a49.615548",
"devicename": "Office fan",
"inputtrigger": false,
"x": 658,
"y": 526,
"wires": [
@pauly7300
pauly7300 / gist:dc6041b7432a70a3145a7d132c49ce5a
Created December 21, 2018 05:21
alexa local light parser
if (typeof msg.on !== 'undefined') {
var cmd = (msg.on ? "on" : "off");
var brightness = -1;
// logic for brightness
if (msg.on) {
if (msg.bri > 0) {
brightness = msg.bri;
var t = 0;
t = Math.floor(brightness * 2.55);
if (t == 254) { t = 255; }
- id: '************'
alias: Christmas tree
trigger:
- entity_id: switch.sonoff8
from: 'off'
platform: state
to: 'on'
condition: []
action:
- data: