Hi all openhab and WLED gurus,
I have a front door bell node that flashes a WLED preset when pressed.
I want to extract the current brightness and effect from the xml string wled publishes to MQTT.
<ac>106</ac>
and <fx>34</fx>
values are needed.
How can I extract and save these 2 values before changing to the preset in order to return WLED to its previous state automatically ?
The truncated xml string and my current rule,which turns WLED off after the preset has run , are below.
<?xml version="1.0" ?><vs><ac>106</ac><ns>1</ns><nr>1</nr><nl>0</nl><nf>1</nf><fx>34</fx></vs>
rule "Front Gate Bell Pressed"
when
Item Front_Gate_State received update
then
if(Front_Gate_State.state == "ring") {
sendCommand(wled_giantled, "PL=1") // Select Preset 1 - Red Blink
}
else
{
if(WledTimer !== null) {
WledTimer.cancel
WledTimer = null
}
if(Front_Gate_State.state == "noring"){
WledTimer = createTimer(now.plusSeconds(20)) [|
if(Front_Gate_State.state == "noring") {
sendCommand(wled_giantled, "T=0") // Turn off - want to return to previous state here
}
]
}
}
end
Running OH 2.4 and MQTT 1
Tia