PDA

View Full Version : Looking for more conditionals



indyjason79
May 18th, 2009, 02:32 AM
I'm trying to create a voice announcement to tell me to take the trash out when a motion sensor is activated. I've got everything setup except I'm wanting a condition based on what day it is. What's with the lack of conditionals in Girder anyway? I have 3 conditionals to use and that's it.

This is what I'm looking for:

-Announcements
--Trash Night
---Speak
---Group Broadcast:Living Room\Motion Sensor:ON
---Conditional (If today is Monday)

Ron
May 18th, 2009, 10:25 AM
You don't necessarily need conditional nodes. Simply use a bit of Lua to do the processing and you can do all that as well.

Aaron
May 18th, 2009, 01:01 PM
I agree with indyjason79...

There needs to be less reliance on custom LUA to do simple If/Then conditionals - and schedules/timers are not easy or intuitive.

Heck, there is a calendar component built-in to .NET and C classes... why not use it?

There needs to be an easy way to have conditionals for items like...

Day/Time/Month/Year (specific and reoccurring)
Sunrise / Sunset (+ or - times)
Device / Scene state

harleydude
May 18th, 2009, 05:42 PM
This is not a conditional however it should work for your needs.

Paste this into a Script Action and assign the motion sensor event to it.

local dow = {
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
'Sunday',
}

local dt = date:now()
if dow[dt.DayOfWeek] == 'Monday' then
Voice:Speak('Today is Monday')
end

I will look into adding to the Time of Day conditional for some extra stuff.