Binary math in a openhab2 rule

I have a homeseer HS-WD200 https://homeseer.com/wp-content/uploads/2018/02/HS-WD200-Manual-4.pdf

I am trying to use Blink in Status mode which is described as

Note: this decimal value is derived from a hex code
calculation based on the following:
Bit 0 = led 1, Bit 1 = led 2, Bit 2 = led 3, Bit 3 = led 4,
Bit 4 = led 5, Bit 5 = led 6, Bit 6 = led 7
IE: value of 1 = first LED, 64 = led 7

I have two motion sensors that detect if the two garage doors are open. In a rule I would like to be able to read the current state of the Blink in Status and turn on LED7 if Door 1 is open and LED6 if Door 2 is open.

so far I have

I would like to be able to convert tv_led_blink_status.state to something i can do bit math on to set the just bit 5 or bit6 depending on which do has been open.

I thought i could do something like
int state = 32;
int door1 = 32;
int door2 = 64;
int newstate = state | door2
so i would have a value of 96 that I can use in tv_led_blink_status.sendCommand, but int newstate = state | door2 give me an error.

Anything thoughts on how to do this?

Thanks

a few minutes after posting i found [Solved] Binary Operations in Rules which points to https://groups.google.com/forum/#!topic/openhab/z4cYibhnoHc

With that pointer can do

``````    var Integer state = (tv_led_blink_status.state as DecimalType).intValue

For reference here is what I have so far. I am using switches instead of motion sensors for testing.

** Items

``````Dimmer light_tv_dimmer "TV light" (GF,gfLights) [ "Lighting" ] {channel="zwave:device:9d6ae427:node20:switch_dimmer"}
Switch light_tv_switch "TV light switch"  (GF,gfLights,gSunset,g1am) [ "Lighting" ] {channel="zwave:device:9d6ae427:node20:switch_dimmer"}

Number tv_mode "TV Mode" {channel="zwave:device:9d6ae427:node20:config_decimal_param13"}
Number tv_led1 "TV LED 1" {channel="zwave:device:9d6ae427:node20:config_decimal_param21"}
Number tv_led2 "TV LED 2" {channel="zwave:device:9d6ae427:node20:config_decimal_param22"}
Number tv_led3 "TV LED 3" {channel="zwave:device:9d6ae427:node20:config_decimal_param23"}
Number tv_led4 "TV LED 4" {channel="zwave:device:9d6ae427:node20:config_decimal_param24"}
Number tv_led5 "TV LED 5" {channel="zwave:device:9d6ae427:node20:config_decimal_param25"}
Number tv_led6 "TV LED 6" {channel="zwave:device:9d6ae427:node20:config_decimal_param26"}
Number tv_led7 "TV LED 7" {channel="zwave:device:9d6ae427:node20:config_decimal_param27"}
``````

**RULES

``````rule "G1Open"
when
Item light_living_room_switch changed to ON
then
tv_mode.sendCommand(1)
tv_led7.sendCommand(1)
var Integer state = (tv_led_blink_status.state as DecimalType).intValue
end

rule "G1Closed"
when
Item light_living_room_switch changed to OFF
then
var Integer state = (tv_led_blink_status.state as DecimalType).intValue
tv_mode.sendCommand(0)
}
tv_led7.sendCommand(0)
end

rule "G2Open"
when
Item light_door_switch changed to ON
then
tv_mode.sendCommand(1)
tv_led6.sendCommand(2)
var Integer state = (tv_led_blink_status.state as DecimalType).intValue
end

rule "G2Closed"
when
Item light_door_switch changed to OFF
then