Zahlenwert invertieren
Verfasst: 15. Jul 2023 19:03
Hallo Leute, ich brauche eure Hilfe,
gibt es eine einfache Methode in opeHAB zahlen zu invertieren.
Ich habe einen Regensensor der einen Analogenwert von 1024 anzeigt ich hätte aber gerne das er 0 anzeigt wenn kein Regen ist und bei Regen dann ansteigt also 1024 -> 0, 1023->1, 1022->2, 1021->3, 1020->4 usw.
Ich habe mal eine Rule erstellt für eine Rollo da musste ich auch den Wert invertieren 100->0, 90->10 usw.
In 10er Schritten geht das ja noch aber bei 1er Schritten dauert das ja ewig
Gibt es da eine komfortablere Möglichkeit mit einer Rule oder ähnlichem ??
Danke im voraus
gibt es eine einfache Methode in opeHAB zahlen zu invertieren.
Ich habe einen Regensensor der einen Analogenwert von 1024 anzeigt ich hätte aber gerne das er 0 anzeigt wenn kein Regen ist und bei Regen dann ansteigt also 1024 -> 0, 1023->1, 1022->2, 1021->3, 1020->4 usw.
Ich habe mal eine Rule erstellt für eine Rollo da musste ich auch den Wert invertieren 100->0, 90->10 usw.
Code: Alles auswählen
rule "Wohnrollo rechts invert"
when
Item WohnrolloRechtsStart received update
then
if(WohnrolloRechts.state == 0 ){
WohnrolloRechtsBrunt.sendCommand(100)
}
if(WohnrolloRechts.state == 10 ){
WohnrolloRechtsBrunt.sendCommand(90)
}
if(WohnrolloRechts.state == 20 ){
WohnrolloRechtsBrunt.sendCommand(80)
}
if(WohnrolloRechts.state == 30 ){
WohnrolloRechtsBrunt.sendCommand(70)
}
if(WohnrolloRechts.state == 40 ){
WohnrolloRechtsBrunt.sendCommand(60)
}
if(WohnrolloRechts.state == 50 ){
WohnrolloRechtsBrunt.sendCommand(50)
}
if(WohnrolloRechts.state == 60 ){
WohnrolloRechtsBrunt.sendCommand(40)
}
if(WohnrolloRechts.state == 70 ){
WohnrolloRechtsBrunt.sendCommand(30)
}
if(WohnrolloRechts.state == 80 ){
WohnrolloRechtsBrunt.sendCommand(20)
}
if(WohnrolloRechts.state == 90 ){
WohnrolloRechtsBrunt.sendCommand(10)
}
if(WohnrolloRechts.state == 100 ){
WohnrolloRechtsBrunt.sendCommand(0)
}
end
Gibt es da eine komfortablere Möglichkeit mit einer Rule oder ähnlichem ??
Danke im voraus