-
-
Save BenediktNiehues/712138deab15aa695a2c to your computer and use it in GitHub Desktop.
Module Templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//following is a ModuleTemplate to combine two conditions | |
{ | |
"id": "MotionOn_And_Brightness", | |
"name": "Motion and Brightness", | |
"tags": ["Brightness", "Motion", "ON"], | |
"description": "Checks if a motion state is ON and the brightness is less than X.", | |
"input" : [ | |
{ | |
"name": "motionItem", | |
"type": "String", | |
"label": "Motion Item", | |
"description": "Name of motion detector item", | |
"required": true | |
}, | |
{ | |
"name":"brightnessItem", | |
"type": "String", | |
"label": "Brightness Item", | |
"description": "Name of the brightness item", | |
"required": true | |
}, | |
{ | |
"name":"brightnessThreshold", | |
"type": "number", | |
"label": "Brightness Threshold", | |
"description": "Maximal brightness", | |
"required": true | |
} | |
], | |
//configuration of Modules (must all be of type Condition) | |
"modules" : [ | |
{ | |
"id" : "brightnessLess1", | |
"type": "Compare", | |
"config": { | |
"operator": "<", | |
"left:": "$brightnessItem", | |
"right": "$brightness" | |
} | |
}, | |
{ | |
"id" : "motionOn1", | |
"type" : "Compare", | |
"config" : { | |
"operator" : "=", | |
"left": "$motionItem", | |
"right": "ON" | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"thenTemplate":{ | |
"id":"LightOnAndColor", | |
"description":"switches on a light and sets its color", | |
"config":[ | |
{ | |
"name":"colorItem", | |
"type":"String", | |
"label":"ColorItem", | |
"description":"Name of the colorItme", | |
"required":true | |
}, | |
{ | |
"name":"color", | |
"type":"String", | |
"label":"Color", | |
"description":"Color in HSB", | |
"required":true | |
} | |
], | |
"modules" : [ | |
{ | |
"type": "SendCommand", | |
"config": { | |
"item": "$colorItem", | |
"command": "ON" | |
} | |
}, | |
{ | |
"type": "SendCommand", | |
"config": { | |
"item": "$colorItem", | |
"command": "$color" | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"triggerTemplate":{ | |
"id": "MotionDetection", | |
"description": "Activates a rule if a motion was detected.", | |
"config" : [ | |
{ | |
"name":"motionItem", | |
"type": "item", | |
"label": "Motion Item", | |
"description": "Name of motion detector item", | |
"required": true | |
} | |
], | |
"modules": [ | |
{ | |
"type": "ItemUpdateEvent", | |
"config": { | |
"item": "$motionItem" | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment