Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To: Modify Scheduled Events from the IV
#1
This is how to setup a screen in the IV like the following, so you can modify timings from the front-end.

i'm going to wait until Dean approves this thread, then use the first 3 replies to walk through each step, otherwise this first post will be ludicriously long.

NO ONE PLEASE REPLY UNTIL I FINISH THE HOW-TO.

---------------------------------------------------------
Warning: This is NOT for the faint of heart, especially modifying "Weekly Basis" events.

[Image: overlay_timers_irrigation.JPG]


This guide presumes you actually *have* a scheduled event setup, and want to use the IV to modify it. I'll use a "Weekly Basis" event for purposes of this guide since that's all I have.

There's 3 basic steps:
1) Setup all the widgets, making sure to name them.
2) Setup 3 different template-level actions:
2a) Z1StartParse - If need be, create global variables. Read the current state of the event and update all appropriate UI widgets.
2b) Z1StartCreateMask - Create the mask that we'll use to write the time field
2c) Z1StartWrite - Update the event

3) Copy one of the actions into the onload of your template.

Given the complexity, plus my laziness, i'll allocate one post to each step.

And away we go...
------------------------------------
Devices I can't stand and wish I could replace: SmartThings, Hue, Concerto, VRUSB
My vlogs: https://www.youtube.com/c/IVBsHomeAutomation
Reply
#2
Step 1: Setup all the widgets, making sure to name them.

If you're doing lighting or irrigation, the odds are that you have 2 scheduled events - one to turn on, one to turn off.

Add the following buttons, making sure to name them in the 'Basic' tab with reasonable names:

For your START event (ie, irrigation start time):
A) Variable check box for on/off.
B) 2 Variable Text widgets, one to show hour, one to show minutes
C) 2 command buttons for up & down hour, 2 command buttons for up & down time
D) 7 Static Check Box widgets, one for each day.

[Image: triggered-event-iv.JPG]

A) Variable Check Boxes:
use this logic to pause/unpause the events, and re-run the action that will parse & write the UI widgets:
Code:
[OnTrueClick]
   EventSrv::PauseSchEv(BDA5ADBAC2B0FDEB-CF98C50732E3..., True)
   IntfViewer::RunTmplAction(Z1StartParse)
[OnFalseClick]
   EventSrv::PauseSchEv(BDA5ADBAC2B0FDEB-CF98C50732E3..., False)
   IntfViewer::RunTmplAction(Z1StartParse)

B) Variable Text Widgets:
Affiliate them with these fields: GVar:vZ1StartHour and GVar:vZ1StartMin

C) For the command buttons, use this logic:

Code:
[OnClick]
   GlobalVars::Add(GVar:vZ1StartHour, 1)
   IntfViewer::RunTmplAction(WriteZ1Start)

D) Static Text Widgets
Give them a name, then use this logic. They'll basically update themselves, then run the create mask action. The create mask action calls the Write action.

This one is from my Z1Stop-Wed field.
Code:
[OnTrueClick]
   Z1Stop-Wed::SetState(False)
   IntfViewer::RunTmplAction(Z1StopCreateMask)

[OnFalseClick]
   Z1Stop-Wed::SetState(True)
   IntfViewer::RunTmplAction(Z1StopCreateMask)
------------------------------------
Devices I can't stand and wish I could replace: SmartThings, Hue, Concerto, VRUSB
My vlogs: https://www.youtube.com/c/IVBsHomeAutomation
Reply
#3
Step 2: Setup 3 different template-level actions

As mentioned above, we're going to have 3 different actions:
Z1StartParse - If need be, create global variables. Read the current state of the event and update all appropriate UI widgets.
Z1StartCreateMask - Create the mask that we'll use to write the time field
Z1StartWrite - Update the event

Z1StartParse
There's way too many steps in the action to walk through them in detail here, but basically:
1) Create the global variables if they don't exist:
GVar:Z1StartState (Boolean)
GVar:vZ1StartFirst (Int)
GVar:vZ1StartHour (Int)
GVar:vZ1StartMin (Int)

2) Do a GetSchEvInfo, and populate GVar:Z1StartTime, GVar:Z1StartMask, GVar:Z1StartState

3) Use GetNthToken to parse out %(GVar:Z1StartTime) into GVar:vZ1StartFirst, GVar:vZ1StartHour, GVar:vZ1StartMin

4) Do a bunch of GetSubString's against GVar:Z1StartMask, and set each day widget to true/false based on the mask position.

Z1StartCreateMask
1) Build up GVar:Z1StartMask (the mask we'll write) in preparation for writing. Read the widgets, sunday->Saturday, and append a 0 or 1 based on if it's true or false
2) Call Z1StartWrite

Z1StartWrite

1) Create a local variable LVar:LocZ1StartTime, and append %(GVar:vZ1StartFirst), %(GVar:vZ1StartHour), %(GVar:vZ1StartMin). THERE IS A SPACE IN FRONT OF EACH ONE, so it's not one mushed together field
2) Do a SetSchEv, using %(LVar:LocZ1StartTime) and %(GVar:Z1StartMask) as parameters.
------------------------------------
Devices I can't stand and wish I could replace: SmartThings, Hue, Concerto, VRUSB
My vlogs: https://www.youtube.com/c/IVBsHomeAutomation
Reply
#4
Step 3) Copy one of the actions into the onload of your template

Copy the Z1 Start Parse action into the OnLoad of your template. You should be good to go!
------------------------------------
Devices I can't stand and wish I could replace: SmartThings, Hue, Concerto, VRUSB
My vlogs: https://www.youtube.com/c/IVBsHomeAutomation
Reply
#5
ok, wrote up the cliff notes version. There's a decent amount of complexity, not remotely possible to write up in a forum post, so a video tutorial/webinar is certainly needed. Rather than mindlessly create one, i'll just cover this during one of the webinars, and clip that portion out for a recording.

Hopefully this thread allows some of the more seasoned folks to kinda sorta follow along before that video is done.
------------------------------------
Devices I can't stand and wish I could replace: SmartThings, Hue, Concerto, VRUSB
My vlogs: https://www.youtube.com/c/IVBsHomeAutomation
Reply
#6
Is everything you're pointing to in your screenshot really a variable checkbox widget?
Reply
#7
crap. I uploaded the wrong image. I'll fix that tonight.

The widge type is right in the description above it, just not the image.
------------------------------------
Devices I can't stand and wish I could replace: SmartThings, Hue, Concerto, VRUSB
My vlogs: https://www.youtube.com/c/IVBsHomeAutomation
Reply
#8
IVB,

I am just setting up my Rain8net and want to incorporate this into it.
In Step 1 B) you state to have Text Widgets for Hour and Time -- Should that be for Hour and Minutes?

Are your templates available for download. I dont see them in with your other template sets.

(Edited for grammar)
Thanks
George M
Reply
#9
George M Wrote:IVB,

I am just setting up my Rain8net and want to incorporate this into it.
In Step 1 B) you state to have Text Widgets for Hour and Time -- Should that be for Hour and Minutes?

Are your templates available for download. I dont see them in with your other template sets.

(Edited for grammar)

ooops, yes, hours & mins. I'll export the templates tonight and upload them.
------------------------------------
Devices I can't stand and wish I could replace: SmartThings, Hue, Concerto, VRUSB
My vlogs: https://www.youtube.com/c/IVBsHomeAutomation
Reply
#10
Great, I'll look for it.
Thanks
George M
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)