From b676d6d3e6fa41fbaaabec310540995712c1d450 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Sat, 22 Nov 2014 12:11:08 +0100 Subject: [PATCH] Add the weekdays condition --- lib/hued/rule.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/hued/rule.rb b/lib/hued/rule.rb index b050e82..5c5b51d 100644 --- a/lib/hued/rule.rb +++ b/lib/hued/rule.rb @@ -114,6 +114,9 @@ module Hued Time.now <= Chronic.parse(cond_value) when "found host" system("ping -W3 -c1 -q #{cond_value} > /dev/null 2>&1") + when "weekday", "weekdays" + weekdays = cond_value.split(/,\s*/).map(&:downcase) + weekdays.include? Time.now.strftime("%a").downcase end else @log.warn "Unknown condition type/form #{cond.inspect}"