Announcement

Collapse
No announcement yet.

Looking for some help with Button Press Event

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Looking for some help with Button Press Event

    So I have finished most of my code for my Niles GXR2 External App, and I have most everything working except the button press events in the homeseer web interface.
    As below, I have generated device buttons via code, and they populate on the web interface. The issue I am having is with the callback in code to fire the ButtonPressEX, or ButtonPress events. My project is rather large, so I don't think posting the entire thing is appropriate.



    I have:
    PublicReadOnlyProperty SupportsHS2() AsBoolean
    Get
    ReturnTrue
    EndGet
    EndProperty

    Public
    ReadOnlyProperty SupportsExtendedButtons() AsBoolean
    Get
    ReturnFalse
    EndGet
    EndProperty

    PublicSub ButtonPressEx(ByRef button_name AsString, ByRef dv AsObject)
    MessageBox.Show("Pressed") 'just for an event to raise
    EndSub

    I have the HSEvents sub working fine, and have parsed the 5 different event types out, but I have been racking my brain for a week trying to make the web interface button press trigger in code.

    Here is my new device code (I have if statements determining if the device is needed or not)

    Dim NewDV
    NewDV = hs.NewDeviceEx(zone1.ZNName)
    NewDV.dc = 1 'placeholder value
    NewDV.hc =
    "N"
    NewDV.dev_type_string = "GXR2"
    NewDV.misc = "&h4000"
    NewDV.misc = "&h8000"
    NewDV.misc = "&h2000"
    NewDV.Interface = "GXR2"
    NewDV.Location = "GXR2"
    NewDV.location2 = "Source"
    NewDV.status_support = "TRUE"
    'NewDV.buttons = "GXR2" & Chr(2) & "On" & Chr(1) & "GXR2" & Chr(2) & "Off"
    hs.SetDeviceValue("N1", "99")
    hs.SetDeviceString(
    "N1", "Source")
    hs.DeviceButtonAdd(
    "N1", "GXR2", slot1.SLName) 'HD Radio
    hs.DeviceButtonAdd(
    "N1", "GXR2", slot2.SLName) 'Sirius
    hs.DeviceButtonAdd(
    "N1", "GXR2", slot3.SLName) 'IM-NET
    hs.DeviceButtonAdd("N1", "GXR2", slot4.SLName) 'Sonos1
    hs.DeviceButtonAdd(
    "N1", "GXR2", slot5.SLName) 'Sonos2
    hs.DeviceButtonAdd(
    "N1", "GXR2", slot6.SLName) 'iPod
    next




    Any help or insight would be greatly appreciated, I'm quite stuck, and can't find any information that seems to work. My homeseer trial is ending today, so i'll probably have to test on a new machine before I decide to take the HS plunge and convince my old lady to spend the cash. I'd consider myself a fairly novice coder, so I could very easily be trying to describe something incorrectly as well :\



    #2
    Originally posted by SN95Josh View Post


    Public
    ReadOnlyProperty SupportsExtendedButtons() AsBoolean
    Get
    ReturnFalse
    EndGet
    EndProperty

    You return false on SupportsExtendedButtons, so I assume you have coded up the "ButtonPress" procedure and not the ButtonPressEx, right?

    Also code up the SetIO and SetIOEx procedures ...

    Dirk

    Comment


      #3
      I have modified code to all match SupportsExtendedButtons being true (most already was)

      PublicSub ButtonPressEx(ByRef button_name AsString, ByRef dv AsObject)
      MessageBox.Show("Pressed")
      EndSub

      PublicSub SetIOEx(ByVal dv AsObject, ByVal housecode AsString, ByVal devicecode AsString, ByVal command AsShort, ByVal brightness AsShort, ByVal data1 AsShort, ByVal data2 AsShort, ByVal voice_command AsString, host AsString)

      MessageBox.Show("Test")
      EndSub

      The code never fires even if I put breakpoints in. Is there a registered callback i'm missing similar to HSEvent?

      Comment


        #4
        Originally posted by SN95Josh View Post
        I have modified code to all match SupportsExtendedButtons being true (most already was)

        PublicSub ButtonPressEx(ByRef button_name AsString, ByRef dv AsObject)
        MessageBox.Show("Pressed")
        EndSub

        PublicSub SetIOEx(ByVal dv AsObject, ByVal housecode AsString, ByVal devicecode AsString, ByVal command AsShort, ByVal brightness AsShort, ByVal data1 AsShort, ByVal data2 AsShort, ByVal voice_command AsString, host AsString)

        MessageBox.Show("Test")
        EndSub

        The code never fires even if I put breakpoints in. Is there a registered callback i'm missing similar to HSEvent?
        If you look at the HS SDK documentation, it refers to different call backs depending on how you created your devices (especially the interface and misc properties). By the way, the interface property should mach identically to the value you return in the "Name" callback (case sensitive!). I also seem to remember that when I return only CA_Music in the "Capabilities" call back, things wouldn't work so I return CA_IO+CA_MUSIC. I quickly looked at my code, I also set the IOType to IOTYPE_CONTROL on the device properties.

        Hope this helps

        Dirk

        Comment


          #5
          Niles GRX2

          I have written a mac server over the past couple of years that bi-drectionally communicates information, triggers, schedules iPad requests between my 2 Niles GXR2 units and the Indigo Home Automation software.

          We are looking to add the ISY 994i appliance and am curious whether you completed this project and whether your code might be available.

          Thanks
          Doug

          Comment

          Working...
          X