No announcement yet.

Script using EventClass

  • Filter
  • Time
  • Show
Clear All
new posts

    Script using EventClass


    I am playing with scripts (vb.Net) to control stuff in HS2. I am a newbie in vb.Net so please be patient with me. I made several scripts so far, but these are pretty much simple scripts.
    Because I see now several scripts starting to do the same thing for a different (motion) device I am trying to combine these to one script now and get stuck on how to get access to the EventClass object of HS. But I seem to miss the reference to this object. At least that is what the error tells me.
    Basically this is what my script is so far, the red statement is what generates the error. And sorry for the dutch words here and there

     Imports System.Net
    Imports System.IO
    Sub Main(ByVal parm As Object)
    	' Dit script zal mettertijd alle motion scripts gaan vervangen nu: testversie
    	Dim Code, EventCause, Device
    	Dim DarkEnable, Night, CreateEvent, Aan As Boolean
    	Dim EventRef As Long
    	Dim Ev As Object
    	Dim dv As Object
    	DarkEnable = False
    	Night = False
    	CreateEvent = False
    	Aan = False
    	EventCause = hs.GetLastEvent()
    	EventRef = hs.GetEventRefByName(EventCause)
    	ev = hs.GetEvent(EventRef)
    For Each dv In ev.ev_devices 'er is slechts één voor een trigger op motion
    		Device = get_device_name(dv.devid)
    	Code = hs.GetDeviceCode(Device)
    	If hs.DeviceValueByname("Melders Daytime") = 2 Then
    		Night = True ' if motion is detected switch on that area during night
    	End If
    	If hs.DeviceValueByName("Licht of donker") = 1 Or _
    		hs.DeviceValueByName("Melders Badkamer Dark") = 0 Then 'licht badkamer staat aan het zal dus wel donker zijn....
    		Dark = True
    	End If
    Who can tell me what I can do here to move on with the script?

    Thanks for any help


    * Later discovery * Oops, it should not have been posted in this forum I think. Sorry for that! Can someone delete this thread, or tell me how to do that?
    Last edited by w.vuyk; October 14, 2005, 05:33 AM. Reason: Wrong forum
    -- Wim

    Plugins:RFXCOM, HSTouch Server, Squeezebox, BLGData, Restart, Jon00's Perfmon and Network monitor, WeatherXML, BLBackup, TenScripting, BC4, Pushover, PHLocation, JowiHue, Zwave, Sonos
    650 devices ---- 336 events ----- 40 scripts