Ahh. I've read it wrong too. It is a recurring 4 week trigger he wants....
Announcement
Collapse
No announcement yet.
Event to run every 4th Thursday
Collapse
X
-
Would this work for you?
Code:Sub Main(ByVal Parm As Object) Dim ReminderDate As New Date(2017, 4, 27) Dim CompareDate As Date = Now.Date If DateDiff("d", ReminderDate, compareDate) Mod 28 = 0 Then hs.TriggerEvent("MyEvent") End If End Sub
Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
Scripts = Various
Comment
-
Originally posted by enigmatheatre View PostWould this work for you?
Code:Sub Main(ByVal Parm As Object) Dim ReminderDate As New Date(2017, 4, 27) Dim CompareDate As Date = Now.Date If DateDiff("d", ReminderDate, compareDate) Mod 28 = 0 Then hs.TriggerEvent("MyEvent") End If End Sub
When I launch the following script, my event does run so I know the path is right. Am I missing some prerequisite setup needed for this script to run? Thanks!
Sub Main(ByVal Parm As Object)
hs.TriggerEvent("Timed Events RecyclingDay")
End Sub
Comment
-
Originally posted by jamesk View PostCan I just simply paste this into a .vb and save to the scripts folder? When I run the script with the New Date set to 2017, 4, 16 (as a test) and launch manually, the script runs but it does not start my event.
When I launch the following script, my event does run so I know the path is right. Am I missing some prerequisite setup needed for this script to run? Thanks!
Sub Main(ByVal Parm As Object)
hs.TriggerEvent("Timed Events RecyclingDay")
End SubHS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon
Comment
-
Originally posted by jamesk View PostCan I just simply paste this into a .vb and save to the scripts folder? When I run the script with the New Date set to 2017, 4, 16 (as a test) and launch manually, the script runs but it does not start my event.
Cheers
AlHS 4.2.8.0: 2134 Devices 1252 Events
Z-Wave 3.0.10.0: 133 Nodes on one Z-Net
Comment
-
Len
HomeSeer Version: HS3 Pro Edition 3.0.0.435
Linux version: Linux homeseer Ubuntu 16.04 x86_64
Number of Devices: 633
Number of Events: 773
Enabled Plug-Ins
2.0.54.0: BLBackup
2.0.40.0: BLLAN
3.0.0.48: EasyTrigger
30.0.0.36: RFXCOM
3.0.6.2: SDJ-Health
3.0.0.87: weatherXML
3.0.1.190: Z-Wave
Comment
-
You can calculate the number of the week with:
w= DatePart("ww", Now())
Then, for triggering an event every 4 weeks, starting week #4
if (DatePart("ww", Now())) Mod 4 =1
If week 4 is not suitable for the first week you can use w-1 or w-2 etc.
PHP Code:'Triggering an event every4th sunday:
Dim DOW As Integer = DateTime.Today.DayOfWeek
Dim w As Integer = (DatePart("ww", Now())) Mod 4
If w-4 = 1 and DOW =4 Then
hs.TriggerEvent("MyEvent")
end if
Visit zee e-maison : http://www.e-maison.com
Comment
-
Or another way with no overhead.
Add the following script to be run by "MyEvent"
Set "MyEvent" to run next Thursday by a normal 'If Time/Date is.....' trigger.
Now when the script runs next Thursday, it will set a new Time/Date trigger for the event in 28 days time.
Code:Sub Main(ByVal Parm As Object) Dim dt As Date = DateTime.Parse(DateTime.Today.AddDays(28) & " 08:00 AM") Dim dvRef As Integer = hs.GetEventRefByName("MyEvent") hs.EventSetTimeTrigger(dvRef, dt) hs.SaveEventsDevices() hs.EnableEvent ("MyEvent") End Sub
Comment
-
This thread is an effective example of how diverse methods can be used to solve a problem in HS. I'm enjoying the creativity and am impressed by the innovative thinking. I hope there are still more suggestions to come.Mike____________________________________________________________ __________________
HS3 Pro Edition 3.0.0.548, NUC i3
HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti
Comment
-
Originally posted by Uncle Michael View PostThis thread is an effective example of how diverse methods can be used to solve a problem in HS. I'm enjoying the creativity and am impressed by the innovative thinking. I hope there are still more suggestions to come.
Manually turn the device on on your first recycle day and it will be on again 4 weeks later on the same day. It will repeat indefinitely. If your recycle day changes to Wednesday, turn the device on that morning and it will be every 4th Wednesday.HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon
Comment
Comment