]> git.basschouten.com Git - openhab-addons.git/commitdiff
[mihome] Update README.md (#11926)
authorRadOle <96960905+RadOle@users.noreply.github.com>
Thu, 10 Mar 2022 20:24:32 +0000 (21:24 +0100)
committerGitHub <noreply@github.com>
Thu, 10 Mar 2022 20:24:32 +0000 (21:24 +0100)
Following https://www.openhab.org/docs/configuration/rules-dsl.html#rule-examples
one can find receivedEvent is now implicitly available in every rule that has a channel-based trigger

bundles/org.openhab.binding.mihome/README.md

index 25d10a7cb564b26aa928b056683003b026dc6f0a..5a7e01f15e65be0c0cc712925d5a26e5d363d0cc 100644 (file)
@@ -246,8 +246,8 @@ rule "Mijia & Aqara Wireless Switch"
 when
     Channel "mihome:sensor_switch:<GwID>:<ID>:button" triggered
 then
-    var actionName = receivedEvent.getEvent()
-    switch(actionName) {
+    
+    switch(receivedEvent) {
         case "SHORT_PRESSED": {
             <ACTION>
         }
@@ -267,8 +267,7 @@ rule "Mijia & Aqara Cube Controller"
 when
     Channel 'mihome:sensor_cube:<GwID>:<ID>:action' triggered
 then
-    var actionName = receivedEvent.getEvent()
-    switch(actionName) {
+    switch(receivedEvent) {
         case "MOVE": {
             <ACTION>
         }
@@ -303,8 +302,7 @@ rule "Aqara Smart Motion Sensor"
 when
     Channel 'mihome:sensor_vibration:<GwID>:<ID>:action' triggered
 then
-    var actionName = receivedEvent.getEvent()
-    switch(actionName) {
+    switch(receivedEvent) {
         case "VIBRATE": {
             <ACTION>
         }