«
Rule languages supports channels
id | thing_uid | label | config | status |
---|---|---|---|---|
home | astro:sun | Astro Sun Data | {"geolocation":"0,0"} | enable |
rule 'Execute rule when channel is triggered' do
<trigger>
run { logger.info("Channel triggered") }
end
trigger | channel | |
---|---|---|
channel 'astro:sun:home:rise#event' | astro:sun:home:rise#event | |
channel 'rise#event', thing: 'astro:sun:home' | astro:sun:home:rise#event | |
channel 'rise#event', thing: things['astro:sun:home'] | astro:sun:home:rise#event | |
channel 'rise#event', thing: things['astro:sun:home'].uid | astro:sun:home:rise#event | |
channel 'rise#event', thing: [things['astro:sun:home']] | astro:sun:home:rise#event | |
channel 'rise#event', thing: [things['astro:sun:home'].uid] | astro:sun:home:rise#event | |
channel things['astro:sun:home'].channels['rise#event'] | astro:sun:home:rise#event | |
channel things['astro:sun:home'].channels['rise#event'].uid | astro:sun:home:rise#event | |
channel [things['astro:sun:home'].channels['rise#event']] | astro:sun:home:rise#event | |
channel [things['astro:sun:home'].channels['rise#event'].uid] | astro:sun:home:rise#event |
rule 'Rule provides access to channel trigger events in run block' do
channel 'astro:sun:home:rise#event', triggered: 'START'
run { |trigger| logger.info("Channel(#{trigger.channel}) triggered event: #{trigger.event}") }
end
rule 'Rules support multiple channels' do
<trigger>
run { logger.info("Channel triggered") }
end
trigger | channel | |
---|---|---|
channel ['rise#event','set#event'], thing: 'astro:sun:home' | astro:sun:home:rise#event | |
channel ['rise#event','set#event'], thing: 'astro:sun:home' | astro:sun:home:set#event |
rule 'Rules support multiple channels and triggers' do
<trigger>
run { logger.info("Channel triggered") }
end
trigger | channel | event | |
---|---|---|---|
channel ['rise#event','set#event'], thing: 'astro:sun:home', triggered: ['START', 'STOP'] | astro:sun:home:rise#event | START | |
channel ['rise#event','set#event'], thing: 'astro:sun:home', triggered: ['START', 'STOP'] | astro:sun:home:set#event | START | |
channel ['rise#event','set#event'], thing: 'astro:sun:home', triggered: ['START', 'STOP'] | astro:sun:home:rise#event | STOP | |
channel ['rise#event','set#event'], thing: 'astro:sun:home', triggered: ['START', 'STOP'] | astro:sun:home:set#event | STOP |