Open Nebula83 opened 6 years ago
Makes a lot of sense to me. Hope we find a volunteer to implement it!
Sir, I'd like to implement it and I'm going through the project.
Great, let us know, if you have any questions!
Sir, After using receivedTrigger, what happens if the rule is 'Harmony Radio Starting' ? Thank you.
Before receivedTrigger
is implemented, receivedEvent
can be used as a alternative.
receivedEvent
is full event as string. Example: harmonyhub:hub:Woonkamer:activityStarting triggered TV_Kijken
rule "Harmony TV starting"
when
Channel "harmonyhub:hub:Woonkamer:activityStarting" triggered
then
switch receivedEvent.toString.split(' ').get(2).toString {
case 'TV_Kijken' : // Handle actions for 'TV_Kijken'
case 'Radio_Luisteren' : // Handle actions for 'Radio_Luisteren'
}
end
It should also possible to directly use receivedEvent.event
(and receivedEvent.channel
)
The documentation talks about receivedEvent.getEvent()
:
rule "Start wake up light on sunrise"
when
Channel "astro:sun:home:rise#event" triggered
then
switch(receivedEvent.getEvent()) {
case "START": {
Light.sendCommand(ON)
}
}
end
When a rule is trigged due to an Item that received a command, it is possible to get the value of that command via the
receivedCommand
variable for that rule.When a channel is used to trigger a rule, the event that triggered the rule cannot be obtained from within the rule. This means that when a rule should be applied to any value sent to a trigger channel, multiple rules need to be created to achieve this:
Proposed is an
receivedTrigger
analogue toreceivedCommand
that would simlyfy the above to: