«
Rule languages supports states processing
type | name | label | state |
---|---|---|---|
Switch | Switch1 | Switch Number One | OFF |
Switch | Switch2 | Switch Number Two | OFF |
states = store_states Switch1, Switch2
Switch1 << ON
after(5.seconds) { states.restore }
store_states Switch1, Switch2 do
Switch1 << ON
sleep 5
end
Switch1.update <state>
sleep 0.5
logger.info "All items have a valid state: #{state? Switch1, Switch2}"
state | result | |
---|---|---|
ON | true | |
UNDEF | false | |
NULL | false |
Switch1.update <state>
sleep 0.5
rule 'state check' do
on_start
only_if { state? Switch1, Switch2 }
run { logger.info "All items have a valid state: true" }
otherwise { logger.info "All items have a valid state: false" }
end
state | result | |
---|---|---|
ON | true | |
UNDEF | false | |
NULL | false |
id | thing_uid | label | config | status |
---|---|---|---|---|
home | astro:sun | Astro Sun Data | {"geolocation":"0,0"} | <state> |
type | name |
---|---|
Number | Sun_Elevation |
item | channel |
---|---|
Sun_Elevation | astro:sun:home:position#elevation |
Sun_Elevation.update 0
sleep 0.2
logger.info "Sun_Elevation is valid? #{state? Sun_Elevation, things: true}"
state | result | |
---|---|---|
enable | true | |
disable | false |