[xmppclient] Update examples rules for OH3 usage (#9643)

- Rename parameter 1 of "getActions" from "xmpp" to "xmppclient".
- Remove "getEvent()" as "receivedEvent" automatically contains the String since OH3.
This commit is contained in:
s0-er-eN 2021-01-06 21:46:25 +01:00 committed by GitHub
parent 911cd01e17
commit 7edcdef865
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -53,7 +53,7 @@ when
Item Xi_Leak changed Item Xi_Leak changed
then then
if(Xi_Leak.state == ON) { if(Xi_Leak.state == ON) {
val actions = getActions("xmpp","xmppclient:xmppBridge:xmpp") val actions = getActions("xmppclient","xmppclient:xmppBridge:xmpp")
actions.publishXMPP("pavel@example.com","Warning! Leak detected!") actions.publishXMPP("pavel@example.com","Warning! Leak detected!")
} }
end end
@ -66,7 +66,7 @@ rule "Turn off all lights without separator"
when when
Channel "xmppclient:xmppBridge:xmpp:xmpp_command" triggered Channel "xmppclient:xmppBridge:xmpp:xmpp_command" triggered
then then
var actionName = receivedEvent.getEvent() var actionName = receivedEvent
if(actionName.toLowerCase() == "turn off lights") { if(actionName.toLowerCase() == "turn off lights") {
Group_Light_Home_All.sendCommand(OFF) Group_Light_Home_All.sendCommand(OFF)
} }
@ -76,11 +76,11 @@ rule "Turn off all lights with separator and reply"
when when
Channel "xmppclient:xmppBridge:xmpp:xmpp_command" triggered Channel "xmppclient:xmppBridge:xmpp:xmpp_command" triggered
then then
var actionName = receivedEvent.getEvent().split("##") var actionName = receivedEvent.split("##")
if(actionName.get(1).toLowerCase() == "turn off lights") { if(actionName.get(1).toLowerCase() == "turn off lights") {
Group_Light_Home_All.sendCommand(OFF) Group_Light_Home_All.sendCommand(OFF)
val actions = getActions("xmpp","xmppclient:xmppBridge:xmpp") val actions = getActions("xmppclient","xmppclient:xmppBridge:xmpp")
actions.publishXMPP(actionName.get(0),"All lights was turned off") actions.publishXMPP(actionName.get(0),"All lights was turned off")
} }
end end