Code: Alles auswählen
sendCommand(GF_Office_Light, INCREASE )
VG
Stefan
Code: Alles auswählen
sendCommand(GF_Office_Light, INCREASE )
Code: Alles auswählen
var Timer tdimmer = null
rule "HSB Brightness heller"
when
Channel "mqtt:topic:broker:gf_office_switch:office_switch_trigger" triggered
then
if (tdimmer !== null) tdimmer.cancel()
if (receivedEvent == "button_3_hold") {
tdimmer = createTimer(now, [ |
var HSBType currentState
currentState = GF_Office_Light.state as HSBType
var DecimalType new_H = currentState.hue
var PercentType new_S = currentState.saturation
var PercentType new_B = new PercentType(currentState.brightness + 2)
if( new_B > 100)
new_B = new PercentType(100)
var HSBType newState = new HSBType(new_H,new_S,new_B)
sendCommand(GF_Office_Light,newState.toString)
if(new_B < 100)
tdimmer.reschedule(now.plusNanos(200000000))
])
} else if (receivedEvent == "button_3_release") {
if(tdimmer !== null) tdimmer.cancel
}
end
rule "HSB Brightness dunkler"
when
Channel "mqtt:topic:broker:gf_office_switch:office_switch_trigger" triggered
then
if (tdimmer !== null) tdimmer.cancel()
if (receivedEvent == "button_4_hold") {
tdimmer = createTimer(now, [ |
var HSBType currentState
currentState = GF_Office_Light.state as HSBType
var DecimalType new_H = currentState.hue
var PercentType new_S = currentState.saturation
var PercentType new_B = new PercentType(currentState.brightness - 2)
if( new_B < 20)
new_B = new PercentType(0)
var HSBType newState = new HSBType(new_H,new_S,new_B)
sendCommand(GF_Office_Light,newState.toString)
if(new_B > 19)
tdimmer.reschedule(now.plusNanos(200000000))
])
} else if (receivedEvent == "button_4_release") {
if(tdimmer !== null) tdimmer.cancel
}
end
Code: Alles auswählen
when
Channel "mqtt:topic:broker:gf_office_switch:office_switch_trigger" triggered
then
if (tdimmer !== null) tdimmer.cancel()
switch(receivedEvent) {
case "button_3_hold" : {
tdimmer = createTimer(now, [ |
var HSBType currentState
currentState = GF_Office_Light.state as HSBType
var DecimalType new_H = currentState.hue
var PercentType new_S = currentState.saturation
var PercentType new_B = new PercentType(currentState.brightness + 2)
if( new_B > 100)
new_B = new PercentType(100)
var HSBType newState = new HSBType(new_H,new_S,new_B)
sendCommand(GF_Office_Light,newState.toString)
if(new_B < 100)
tdimmer.reschedule(now.plusNanos(200000000))
])
}
case "button_3_release" : {
if(tdimmer !== null) tdimmer.cancel
}
case "button_4_hold" : {
tdimmer = createTimer(now, [ |
var HSBType currentState
currentState = GF_Office_Light.state as HSBType
var DecimalType new_H = currentState.hue
var PercentType new_S = currentState.saturation
var PercentType new_B = new PercentType(currentState.brightness - 2)
if( new_B < 20)
new_B = new PercentType(0)
var HSBType newState = new HSBType(new_H,new_S,new_B)
sendCommand(GF_Office_Light,newState.toString)
if(new_B > 19)
tdimmer.reschedule(now.plusNanos(200000000))
])
}
case "button_4_release" : {
if(tdimmer !== null) tdimmer.cancel
}
}
end
Code: Alles auswählen
now.plusMillis(200)