Rule to change two switches at once with 3 combinations

Hi,

with help here in the forum i got working my vistapool control via tasmota with neopool and mqtt etc…
but now i have a littel problem to get working a rule which should change to states at once:

this are the 2 things for the filtration pump:

Type string : NPMode 			[stateTopic="stat/neopool_D7CDB8/NPFiltrationMode", transformationPattern = "JSONPATH:$.NPFiltrationMode", commandTopic ="cmnd/neopool_D7CDB8/NPFiltrationMode", 0="MANUAL", 1="AUTO", 2="HEATING", 3="SMART", 4="INTELLIGENT", 13="BACKWASH",refresh=60]

Type string : NPFilter 			[stateTopic="stat/neopool_D7CDB8/NPFiltration", transformationPattern = "JSONPATH:$.NPFiltration", commandTopic ="cmnd/neopool_D7CDB8/NPFiltration", 0="Aus", 1="Ein",refresh=60]

My problem no is:
When i want to turn on the filtration pump manually first i have to change the NPMode from “AUTO” to “MANUAL”, because normally its “AUTO” to do to fitlration everyday in a certain timeplan which is configured.
Afte rhaving changed to “MANUAL” i have to turn on NPFilter to “Ein”.
And for stopping the other way.
So i tried this:

items

tring NeoPoolMode 		"Mode [%s]"  							(gPool)	 { channel="mqtt:topic:neopool_D7CDB8:NPMode"}
String NeoPoolFilter	"Filtration [%s]"  						(gPool)	 { channel="mqtt:topic:neopool_D7CDB8:NPFilter"}
Number PoolPumpe 		"PoolPumpe ist [MAP(3statespoolpump.map):%s]"	 (gPool)

3statespoolpump.map:

0=ON
1=OFF
2=OFF-AUTO

and the rules now i am lost:

rule "Poolpumpe Ein/Aus/Off-Auto"
when
    Item Poolpumpe changed
then
    switch ((Poolpumpe.state as Number).intValue) {
           case 0 : {NeoPoolMode.sendCommand(0)
				NeoPoolFilter.sendCommand(1)}
        case 1 : {NeoPoolMode.sendCommand(0)
				NeoPoolFilter.sendCommand(0)}
        case 2 : {NeoPoolMode.sendCommand(1)
				NeoPoolFilter.sendCommand(0)}
    }
end

the idea is the 3 states:
0:manually on
1:turn off and leave auto mode off.
2: turn off and turn auto mode on

i am lost with the syntax or whatever…

got this error in openhab.log:

Item 'Poolpumpe' needed for rule 'neopool-1' is missing. Trigger '0' will not work.

Any ideas?

Your Item is named PoolPumpe, but in the rule you are using Poolpumpe instead. :slight_smile:

stupid error… thanks Udo!
but still not working! I think i dont trigger the rule…