I created a rule when I get home then the blinds open
My question is how can it be done that after a certain hour the lights will turn on and not at a specific time
Thanks in advance
Start by posting your rule and showing us what you’ve tried.
At a high level, when the rule triggers, check to see what time it is and if it’s the right time run, otherwise return.
this is the rule:
rule "raz at home"
when
Item razAtHome changed to ON
then
if (sapirAtHome.state==OFF)
shelly_shelly25_roller_68c63afb13b6_roller_rollerpos.sendCommand(100)
shelly_shelly25_roller_483fda4ce5bb_roller_rollerpos.sendCommand(100)
shelly_shelly25_roller_10521cf9964f_roller_rollerpos.sendCommand(100)
shelly_shelly25_roller_68c63af93058_roller_rollerpos.sendCommand(71)
shelly_shelly25_roller_68c63afb0e45_roller_rollerpos.sendCommand(53)
shelly_shelly25_roller_68c63afb1a9c_roller_rollerpos.sendCommand(100)
shelly_shelly1_f4cfa27683a2_relay_output.sendCommand(ON)
end
And I want when I arrive after 6pm then the light will turn on:
shelly_shelly1_f4cfa27683a2_relay_output.sendCommand(ON)
Perhaps add an if statement like this…
if (now.getHourOfDay() >= 18)
{
shelly_shelly1_f4cfa27683a2_relay_output.sendCommand(ON)
}
Mike
Why not work for me?
the item razAtHome not change to OFF when i try this rule:
(for test i have fake GPS app on my android)
rule "raz at home"
when
Item razAtHome changed to ON
then
if (sapirAtHome.state==OFF)
shelly_shelly25_roller_68c63afb13b6_roller_rollerpos.sendCommand(100)
shelly_shelly25_roller_483fda4ce5bb_roller_rollerpos.sendCommand(100)
shelly_shelly25_roller_10521cf9964f_roller_rollerpos.sendCommand(100)
shelly_shelly25_roller_68c63af93058_roller_rollerpos.sendCommand(71)
shelly_shelly25_roller_68c63afb0e45_roller_rollerpos.sendCommand(53)
shelly_shelly25_roller_68c63afb1a9c_roller_rollerpos.sendCommand(100)
if (now.getHourOfDay() >= 18)
{
shelly_shelly1_f4cfa27683a2_relay_output.sendCommand(ON)
}
end
I think you need some extra curly brackets:
rule "raz at home"
when
Item razAtHome changed to ON
then
if (sapirAtHome.state==OFF){
shelly_shelly25_roller_68c63afb13b6_roller_rollerpos.sendCommand(100)
shelly_shelly25_roller_483fda4ce5bb_roller_rollerpos.sendCommand(100)
shelly_shelly25_roller_10521cf9964f_roller_rollerpos.sendCommand(100)
shelly_shelly25_roller_68c63af93058_roller_rollerpos.sendCommand(71)
shelly_shelly25_roller_68c63afb0e45_roller_rollerpos.sendCommand(53)
shelly_shelly25_roller_68c63afb1a9c_roller_rollerpos.sendCommand(100)
if (now.getHourOfDay() >= 18) {
shelly_shelly1_f4cfa27683a2_relay_output.sendCommand(ON)
}
}
end
Your rule would start when the item razAtHome
changes to ON, in the rule there is no code that would switch this item to OFF.
thanks, it work
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.