Openhab,make a light to flash

It depends on how long you want the light to be on and how many flashes you want them to flash.

If just one short flash then:

    MyLight.sendCommand(HSBType::RED)
    Thread::sleep(1000) // nothing longer
    MyLight.sendCommand(OFF)

If you want the light to stay on for longer than one second you need to get more complicated:

    MyLight.sendCommand(HSBType::RED)
    createTimer(now.plusSeconds(5), [| MyLight.sendCommand(OFF)])

If you want to flash repeatedly for a long time see Loop rule (in OH2) which lets you flash Morse Code.

2 Likes