Creating a schedule event (AS time/date action)

Posted on
Wed Sep 18, 2019 8:16 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Creating a schedule event (AS time/date action)

In AS, I created a schedule event with this bit of awkward code:

if ("16:00:00" > offTime or offTime ≥ "22:00:00") then
enable time date action "fYrdLtsOFF"
set the time trigger type of time date action "fYrdLtsOFF" to absolute
set the date trigger type of time date action "fYrdLtsOFF" to everyDay
set the absolute trigger time of time date action "fYrdLtsOFF" to date offTime
end if

On the Indigo Object Model page, there is a line for "schedule', and an indication that it is not yet implemented. Is this what I need?

Posted on
Wed Sep 18, 2019 8:53 pm
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Creating a schedule event (AS time/date action)

Sometimes, you're going to be better off starting from scratch instead of porting old AS code.

So please explain the purpose of this code fragment and maybe we can come up with a better/easier way to do it.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Sep 19, 2019 8:53 am
jay (support) offline
Site Admin
User avatar
Posts: 18216
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Creating a schedule event (AS time/date action)

FlyingDiver wrote:
Sometimes, you're going to be better off starting from scratch instead of porting old AS code.

So please explain the purpose of this code fragment and maybe we can come up with a better/easier way to do it.


+1. It's very likely that a brand new approach to the problem itself is going to result in a better solution. Describe it as fully/completely/in detail as you can, and we can help you come up with the best solution.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Sep 19, 2019 7:47 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Creating a schedule event (AS time/date action)

I'm sure there's a better way. No pride here.
My goal: when an IR sensor notices a person on my front path AND it's dark, I turn the lights to 100%. 3 minutes later, I dim the lights,; if it's after 10pm, 2 minutes later, I turn the lights off.
Maybe this is more clear:

Trigger - when daylight becomes = false,
front path lights set to 50%
if person is detected AND daylight = false
set VarTime to Time
Turn lights to 100%
At VarTime + 3 min
Set lights to 50%
At VarTime + 5 min > 2200
Turn lights off

To be honest, I'm screwing around here. If this is a big deal, no problem to drop it - only slightly disappointing. So far, I've replaced lots of lines in this script with very few Python lines - this is the last issue. Looking forward to debugging it, and taking what I've learned onto the next script.
Thanks for your time and help.
Bob

Posted on
Thu Sep 19, 2019 7:57 pm
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Creating a schedule event (AS time/date action)

Create a timer device, set to three minutes. This is for turning the light back on.

Trigger on isDaylight variable going off, turn lights to 50%.

Create a standard trigger on the IR sensor. Use a condition on the trigger to only execute if isDaylight is false. Set the action to turn the light to 100% and also start the timer.

When the timer goes off, set the light to 50%.

I would just use a normal schedule event to turn the lights off at 10pm. And also cancel the timer if it's running. It's possible doing it that way will make the delay less than 2 minutes, but do you really care?

No scripting needed.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Sep 19, 2019 9:05 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Creating a schedule event (AS time/date action)

Definitely easier.
However, I don't know what a timer device is. Probably somewhere on the Indigo Wiki?

Posted on
Fri Sep 20, 2019 12:15 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Creating a schedule event (AS time/date action)

“Timers & Pesters” is a built in plugin, just needs enabling (I think) on Indigo client > plugins menu > Timers & pesters > Enable.


Sent from my iPhone using Tapatalk Pro

Posted on
Fri Sep 20, 2019 9:37 am
jay (support) offline
Site Admin
User avatar
Posts: 18216
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Creating a schedule event (AS time/date action)

SMUSEBY wrote:
However, I don't know what a timer device is. Probably somewhere on the Indigo Wiki?


This might be a good time for you to spend a little time perusing the Indigo 7 documentation. Indigo has changed a lot since you first started using it and if you haven't spent any time with the docs there is likely a lot that you don't yet know about (like the Timers & Pesters plugin).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Sep 20, 2019 8:49 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Creating a schedule event (AS time/date action)

OK. Sounds like a good suggestion.
Still disappointed that I can't create a time/date action in python - I'm so close to making a very tight python replacement to the rambling AS. Am I correct that the python/indigo time/date command is not (yet?) an available?

Posted on
Sat Sep 21, 2019 1:47 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Creating a schedule event (AS time/date action)

SMUSEBY wrote:
OK. Sounds like a good suggestion.
Still disappointed that I can't create a time/date action in python - I'm so close to making a very tight python replacement to the rambling AS. Am I correct that the python/indigo time/date command is not (yet?) an available?

Eh?

I’m not sure what you’re referring to but my clock plugin uses time/date in Python all day long, literally/no pun intended.


Sent from my iPhone using Tapatalk Pro

Posted on
Sat Sep 21, 2019 10:50 am
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: Creating a schedule event (AS time/date action)

Indigo doesn't yet have APIs / internal models for its object Schedules or Actions. Definitely high on my ToDo list though, but unlikely to make it into 7.4.

Image

Posted on
Sat Sep 21, 2019 10:54 am
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Creating a schedule event (AS time/date action)

matt (support) wrote:
Indigo doesn't yet have APIs / internal models for its object Schedules or Actions. Definitely high on my ToDo list though, but unlikely to make it into 7.4.


I was just looking at the Timers and Pesters plugin. I expect you could do most of what the OP wants by manipulating a Timer device via scripts.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Sep 21, 2019 11:22 am
jay (support) offline
Site Admin
User avatar
Posts: 18216
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Creating a schedule event (AS time/date action)

FlyingDiver wrote:
I was just looking at the Timers and Pesters plugin. I expect you could do most of what the OP wants by manipulating a Timer device via scripts.


Given his written description above, it seems quite likely he wouldn't need any scripts at all (as your reply says). Mainly, though, I think when you have a system based on Indigo 4's capabilities (I believe that's when @SMUSEBY did most of the work on his system), it's likely time to really investigate Indigo 7.3 and it's capabilities, along with the large number of 3rd party plugins. There is a TON of functionality now available through UI (built-in or plugin) that wasn't available in Indigo 4, so it's quite possible that he wouldn't need any scripts at all (thus avoiding any associated Python learning curve). Just my 2¢...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Sep 21, 2019 11:23 am
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Creating a schedule event (AS time/date action)

jay (support) wrote:
There is a TON of functionality now available through UI (built-in or plugin) that wasn't available in Indigo 4, so it's quite possible that he wouldn't need any scripts at all (thus avoiding any associated Python learning curve). Just my 2¢...


Oh, I agree. But he seems determined to use a script....

;)

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Sep 21, 2019 2:20 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Creating a schedule event (AS time/date action)

I suppose I finally "am determined to learn" - having had my butt kicked for over a year for using AS's and not knowing anything about Python. I spent two days trying to figure out how to translate one script to Python - and now I'm learning that I've been running down the wrong alley.
Not complaining here - easier is better. But, it is a different 'mindset' - thinking about a program vs using built-in Indigo functions. Old dog & new tricks...

Who is online

Users browsing this forum: No registered users and 3 guests