Dimmer Light Rules / Command Help

Well, given a dimmer item bound to http, this should be very easy…

Dimmer myDimmer "My http Dimmer is [%d %%]" {http=">[*:POST:http://www.domain.org/home/lights/23871/?status=%2$s&type=text] <[http://www.domain.org/weather/openhabcity/daily:60000:REGEX(.*?<title>(.*?)</title>.*)]"}

(Item definition from documentation)

Now to change the value, either use a slider in Basic UI or something similar, with “real” sliders, or use INCREASE/DECREASE commands and a rule to set the value:

rule "My http dimmer"
when
    Item myDimmer received command
then
   if (receivedCommand == DECREASE) {
        myDimmer.sendCommand((myDimmer.state as DecimalType) - 5)
}
    else if (receivedCommand == INCREASE) {
        myDimmer.sendCommand((myDimmer.state as DecimalType) + 5)
}
end
1 Like