{
"id" : " rule1" ,
"name" : " Automated Corridor lights"
"tags" : [" presence" , " light" ],
"description" : " Switches a lamp on motion detection." ,
"active" : true ,
"on" : [
{
"id" : " trigger1" ,
"type" : " ItemUpdateEvent" ,
"config" : {
"item" : " Corridor_MotionDetector"
},
"if" : [
{
"type" : " Compare" ,
"config" : {
"operator" : " ==" ,
"left:" : " $event.status" ,
"right" : " ON"
}
}
]
},
{
"id" : " trigger2" ,
"type" : " ItemUpdateEvent" ,
"config" : {
"item" : " Corridor_Brightness"
}
}
],
"if" : [
{
"id" : " condition1" ,
"type" : " Compare" ,
"config" : {
"operator" : " <" ,
"left:" : " items.Corridor_Brightness" ,
"right" : " 30"
}
}
],
"then" : [
{
"id" : " action1" ,
"type" : " SendCommand" ,
"config" : {
"item" : " Corridor_Light" ,
"command" : " ON"
}
}
]
}
{
"id" : " MotionSwitch" ,
"description" : " Switches a lamp on motion detection." ,
"config" : {
"name" : {
"type" : " string" ,
"label" : " Name" ,
"description" : " Name of the rule." ,
"required" : true
},
"tags" : {
"type" : " string[]" ,
"label" : " Tags" ,
"description" : " Tags of the rule." ,
"required" : false
},
"active" : {
"type" : " boolean" ,
"label" : " Active" ,
"description" : " Defines, if the rule is enabled. Default value is true." ,
"required" : false ,
"default" : true
},
"motionItem" : {
"type" : " item" ,
"label" : " Motion Item" ,
"description" : " Name of motion detector item" ,
"required" : true
},
"brightnessItem" : {
"type" : " item" ,
"label" : " Brightness Item" ,
"description" : " Name of the brightness item" ,
"required" : true
},
"brightnessThreshold" : {
"type" : " number" ,
"label" : " Brightness Threshold" ,
"description" : " Maximal brightness for which light should be turned on" ,
"required" : true
},
"lightItem" : {
"type" : " item" ,
"label" : " Light Item" ,
"description" : " Name of the item to switch." ,
"required" : true
}
},
"on" : [
{
"type" : " ItemUpdateEvent" ,
"config" : {
"item" : " $motionItem"
},
"if" : [
{
"type" : " Compare" ,
"config" : {
"operator" : " ==" ,
"left:" : " $event.status" ,
"right" : " ON"
}
}
]
},
{
"type" : " ItemUpdateEvent" ,
"config" : {
"item" : " $motionItem"
}
}
],
"if" : [
{
"type" : " Compare" ,
"config" : {
"operator" : " <" ,
"left:" : " items.$brightnessItem" ,
"right" : " $brightnessThreshold"
}
}
],
"then" : [
{
"type" : " SendCommand" ,
"config" : {
"item" : " $lightItem" ,
"command" : " ON"
}
}
]
}
Rule Instantiation through Template
{
"templateId" : " MotionSwitch" ,
"config" : {
"id" : " rule1" ,
"name" : " Automated Corridor lights" ,
"tags" : [" presence" , " light" ],
"active" : true ,
"motionItem" : " Corridor_MotionDetector" ,
"brightnessItem" : " Corridor_Brightness" ,
"brightnessThreshold" : " 30" ,
"lightItem" : " Corridor_Light"
}
}