Dynamically showing Items

My idea is:

Frame item=sRefreshON label="Manual or automatic" {
		Switch item=manualAuto label="Auto/manual" mappings=[auto="AUTO", manual="MANUAL"]		
	}

When I use AUTO so Automated rules will be apply. I know to do this way.
When I use MANUAL so I want to display two additional items.

First item with time of Manual time setting (2h,4h,6h etc), after this time set automatically AUTO mode.
Second item with switching fan speed.

Use the visibility tag on the sitemap to only show the desired elements when manualAuto is a certain value.

For example:

Switch item=manualAuto label="Auto/Manual" mappings=["auto"="AUTO", "manual"="MANUAL"]
Switch item=manualTime label="Manual Time" mappings=[2="2h",4="4h",6="6h"] visibility=[manualAuto=="manual"]
Switch item=fanSpeed label="Fan Speed"  mappings=["low"="LOW", "medium"="MEDIUM", "high"="HIGH"] visibility=[manualAuto=="manual"]

You need a rule to switch manualAuto back to “auto” after manualTime or fanSpeed is updated.

rule "Reset manualAuto"
when
    Item manualTime received command or
    Item fanSpeed received command
then
    Thread::sleep(5000) // wait a few seconds before changing to give user a chance to set both parameters
    manualAuto.sendCommand("auto")
end

NOTE: Assumes that manualAuto, manualTime, and fanSpeed are all String Items.

3 Likes

Thanks for fast answer, everything works.

One more question. If I have rule like this:

rule "Reset manualAuto"
when
    Item manTime received update 
then
    if (manTime.state == "hour") {
    Thread::sleep(5000) // wait a few seconds before changing to give user a chance to set both parameters
    manAuto.sendCommand("auto")
    }
    else if {
    (manTime.state == "two")
    Thread::sleep(10000) // wait a few seconds before changing to give user a chance to set both parameters
    manAuto.sendCommand("auto")
    }
    else if { 
    (manTime.state == "four")
    Thread::sleep(50000)
    manAuto.sendCommand("auto")
    }
end

The first two are okay but third no sleep, send command immediately

I believe you made a mistake in the else if statements. The condition should be placed before the opening curly brace. For example:

else if (manTime.state == "two") {

Br, Chris.