Announcement

Collapse
No announcement yet.

Determining which device triggered an event

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

    Determining which device triggered an event

    I have an audio matrix which controls the audio in each room/zone of my building. Each room/zone is set up as it's own device.

    I have written a script which controls the audio matrix and turns a zone on or off. The script is written in a way so that multiple zones can all use the same script (sub) and the correct zone is turned on/off.

    Currently, each Device/Zone has a one-to-one match with it's own event which then passes the correct parameters to the script so it knows which zone to control.

    I also have the same for a zone's volume control. In total, I have three events per zone (power on/off, vol up, vol down).

    Doing this is OK when there are just a couple of zones. Right now I only have 5 zones which means 15 total events. However, I am about to increase my number of zones significantly (50+) which would mean at least 150 events. That will be extremely tedious to create and maintain.

    Main Question: Is there a way to simplify all of this and not need separate events per device/zone? Rather than passing a Device ID (or other similar identification) via an event parameter, is there any way for a script or event to figure out which device triggered the event? That way, I could just have 3 events (power, vol up, vol down) and based upon which device triggered these events, the script would know which zone to control.

    I guess an alternate would be to skip events and trigger the script directly from the device. Is that even possible? Is that what RegisterStatusChangeCB does?
    Last edited by ramshaklez; August 14, 2016, 07:41 PM.

    #2
    Does this thread help?
    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


      #3
      I managed to get it to work using hs.RegisterStatusChangeCB

      Comment

      Working...
      X