Feedback on my rules to power on and off devices in a specific order

Ruledriven item updates not always reflected on sitemap.

I will start with a small introduction. Recently i picked up home automation
as hobby. After trying multiple solutions I decided that OpenHAB would be
my solution because I enjoy tinkering around with stuff and it offers me a lot
of learning possibilities like MQTT and KNX bindings.

Now I was able to setup OpenHAB 2.0 with bindings for the RFXCOM and Aeon labs
Z-Wave stick. My first project in OpenHAB will be automation of the power on and
off sequences for a rack with AV equipment.

The rack contains four devices which need to be powered on and off in a specific
order. Basically I need to power on the amps last and I want to use a sparkfun motorized slider to set the volume slider.
My current poc looks like this:

Relevant files
.
|-- OpenHAB2
    |-- conf
       |-- sitemaps
       |   `-- example.sitemap
       |-- items
       |   |-- LIGHTS.items
       |   `-- AUDIO.items
       `-- rules
           `-- AUDIO.rules

sitemap.example

sitemap example label="Basement"
    {
        Frame label="LIGHTS" {
            Switch item=SW_KLD
            }
        Frame label="Audio" {
            Switch item=Audiorack
            Slider item=Master
            Group item=GR_AUDIO label="test"
            }
    }

AUDIO.items

Switch	Audiorack "Audiorack"              <light>    	{ Command }
Dimmer  Master    "Master volume [%s %%]"  <light>	{ Command}

Group GR_AUDIO
Switch	Mixer	"Mixer"          <light>         (GR_AUDIO)	{ Command }
Switch	Crossover "xover"        <light>         (GR_AUDIO)	{ Command }
Switch	TOPAMP	"Top-amp"        <light>         (GR_AUDIO)	{ Command }
Switch	SUBAMP	"Sub-amp"        <light>         (GR_AUDIO)	{ Command }

I realize that light might not be the optimal category for the audio equipment, but it worked for my POC goals.

AUDIO.rules

// Rules for Audioequipment

rule "AudiorackPWRon"
when
      Item Audiorack changed from OFF to ON
then
    Master.state = new PercentType(0)
    Thread::sleep(250)
    if Master.state == (0) then
        Thread::sleep(1000)          
        sendCommand(Mixer, ON)
        Thread::sleep(1000)
        sendCommand(Crossover, ON)
        Thread::sleep(1000)
        sendCommand(TOPAMP, ON)
        Thread::sleep(1000)
        sendCommand(SUBAMP, ON)
end

rule "AudiorackPWRoff"
when
    Item Audiorack changed from ON to OFF
then
    Master.state = new PercentType(0)
    Thread::sleep(250)
    if Master.state == (0) then
    Thread::sleep(1000)
    sendCommand(TOPAMP, OFF)
    Thread::sleep(1000)
    sendCommand(SUBAMP, OFF)
    Thread::sleep(2500)
    sendCommand(Crossover, OFF)
    Thread::sleep(3500)
    sendCommand(Mixer, OFF)
end

These rules feels very inefficient to me but I don’t have enough programming
or scripting knowledge to think of a more elegant solution, so feedback is welcome.

The main issue I’ve been having is that when I set the main switch the updates are not always reflected
in the basic UI (my sitemap), I need to refresh before the UI reflects the changes.
Could this be caused by inefficient rules or the lack of persistence?

At the moment there’s a Fibaro RGBW controllers dimmer function linked to the master volume control slider and the led strip is always powered off when I switch the main switch so the rules are processed.

The system was also having issues with items defined in files like audio.items not showing up in the paperUI so I couldn’t link it but it appears to be solved after recreating the files with another editor. However I seem to recal a topic or document about the way items and things defined through config files or the paper ui are processed and stored, does someone have any idea what document or topic this might have been?