Announcement

Collapse
No announcement yet.

Dome Siren Script

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

    Dome Siren Script

    I've created devices and a script to help set the parameters for a Dome Siren (https://www.aartech.ca/dome-dms01). The devices represent the parameters and values available for it. The parameters can be found in the manual (https://s3.amazonaws.com/shopify-cus...d%20Manual.pdf), but there are some errors in it and there are two additional parameters available to control the LEDs (Parameter 8 for Siren and Parameter 9 for Chime with a value of 0 for off and 1 for on). I manually created the devices based on what was in the manual and from info found elsewhere. See below for a screenshot of the devices. I grouped them using Jon00's grouping utility. There's one device for each parameter, along with the root device. The Status Graphics tab for each device then has entries for each of the possible parameter values for that parameter using the same values. You can add icons for the different values, but that is not needed.

    Click image for larger version  Name:	Capture11.PNG Views:	1 Size:	113.3 KB ID:	1294700

    Here's an example of the device that toggles it between siren and chime mode. It has two values (1 and 2) that correspond to what is shown for parameter 7 in the manual (page 14). The rest of the devices are shown in this post: https://forums.homeseer.com/forum/de...54#post1329654

    Click image for larger version  Name:	Capture3.PNG Views:	1 Size:	64.9 KB ID:	1291560

    To trigger the chime/siren, first set the devices to the values you want and then trigger the script. Pass the z-wave Node ID to the script. The script then sets the z-wave parameters for the chime/siren and then activates it. The reference IDs for the devices that control the siren must be set in an ini file called "domesirenchime.ini" that must be stored in the Settings folder.

    Click image for larger version  Name:	Capture.PNG Views:	1 Size:	42.5 KB ID:	1294781

    Below is the script, save it into your scripts folder as "domesiren.vb" or whatever name you want to give it.

    Code:
    'Version 1.1 - Moved hard-coded devices to an INI file
    
    Sub Main(ByVal NodeIDStr As String)
        Dim NodeID As Integer = CInt(NodeIDStr)
        Dim Debug As Boolean = False
        Dim logName As String = "Dome Siren Control"
        Dim Mode As Integer = hs.DeviceValue(CInt(hs.GetINISetting(NodeIDStr, "SirenChimeToggle", "", "domesirenchime.ini")))
        Dim HomeID As String = hs.GetINISetting(NodeIDStr, "HomeID", "", "domesirenchime.ini")
        Dim DomeSirenID As Integer = CInt(hs.GetINISetting(NodeIDStr, "SirenChimeControl", "", "domesirenchime.ini"))
    
        Dim ModeParam As Integer = 7
    
        Dim Duration As Integer
        Dim DurationParam As Integer
        Dim LED As Integer
        Dim LEDParam As Integer
        Dim Sound As Integer
        Dim SoundParam As Integer
        Dim Volume As Integer
        Dim VolumeParam As Integer
    
        If Mode = 1 Then 'Siren Mode
            Duration = hs.DeviceValue(CInt(hs.GetINISetting(NodeIDStr, "SirenDuration", "", "domesirenchime.ini")))
            LED = hs.DeviceValue(CInt(hs.GetINISetting(NodeIDStr, "SirenLED", "", "domesirenchime.ini")))
            Sound = hs.DeviceValue(CInt(hs.GetINISetting(NodeIDStr, "SirenSound", "", "domesirenchime.ini")))
            Volume = hs.DeviceValue(CInt(hs.GetINISetting(NodeIDStr, "SirenVolume", "", "domesirenchime.ini")))
            DurationParam = 2
            LEDParam = 8
            SoundParam = 5
            VolumeParam = 1
        Else 'Chime Mode
            Duration = hs.DeviceValue(CInt(hs.GetINISetting(NodeIDStr, "ChimeDuration", "", "domesirenchime.ini")))
            LED = hs.DeviceValue(CInt(hs.GetINISetting(NodeIDStr, "ChimeLED", "", "domesirenchime.ini")))
            Sound = hs.DeviceValue(CInt(hs.GetINISetting(NodeIDStr, "ChimeSound", "", "domesirenchime.ini")))
            Volume = hs.DeviceValue(CInt(hs.GetINISetting(NodeIDStr, "ChimeVolume", "", "domesirenchime.ini")))
            DurationParam = 3
            LEDParam = 9
            SoundParam = 6
            VolumeParam = 4
        End If
    
        If Debug Then
            hs.WriteLog(logName, "Duration Param " & CStr(DurationParam))
            hs.WriteLog(logName, "Duration " & Duration)
            hs.WriteLog(logName, "LED Param " & CStr(LEDParam))
            hs.WriteLog(logName, "LED " & LED)
            hs.WriteLog(logName, "Sound Param " & CStr(SoundParam))
            hs.WriteLog(logName, "Sound " & Sound)
            hs.WriteLog(logName, "Volume Param " & CStr(VolumeParam))
            hs.WriteLog(logName, "Volume " & Volume)
        End If
    
        Try
            Dim ConfigResult As Integer = 0
            ConfigResult = ZWaveParam(ModeParam,Mode,HomeID,NodeID)
            If ConfigResult = 1 Then
                ConfigResult = ZWaveParam(DurationParam,Duration,HomeID,NodeID)
                ConfigResult = ZWaveParam(LEDParam,LED,HomeID,NodeID)
                ConfigResult = ZWaveParam(SoundParam,Sound,HomeID,NodeID)
                ConfigResult = ZWaveParam(VolumeParam,Volume,HomeID,NodeID)
            Else
                hs.writelog(logName,"Unable to change the parameters for Node " & NodeID)
            End If
            hs.CAPIControlHandler(hs.CAPIGetSingleControl(DomeSirenID,True ,"on",False,True))
    
        Catch ex As Exception
            hs.WriteLog(logName, "Exception " & ex.ToString)
        End Try
    End Sub
    
    Function ZWaveParam(ParamNumber As Integer, ParamValue As Integer, HomeID As String, NodeID As Integer) As Integer
        Dim logName As String = "Z-Wave Config Set"
        Dim Debug As Boolean = False
        Dim ConfigResult As Integer = 0
        Dim ConfigResultVal() As String = {" is Unknown"," is Successful"," has been Queued"," has Failed"}
    
        Try
            ConfigResult = hs.PluginFunction("Z-Wave", "", "Configuration_Set", New Object(){HomeID, Convert.ToByte(NodeID), Convert.ToByte(ParamNumber), Convert.ToByte(1), Convert.ToInt32(ParamValue)})
            If Debug Then hs.WriteLog(logName, "Result of Parameter " & ParamNumber & " change to " & ParamValue & " on Node " & NodeID & ConfigResultVal(ConfigResult))
        Catch ex As Exception
            hs.writelog(logName, "Error:  " & ex.Message.ToString)
        End Try
    
        Return ConfigResult
    
    End Function
    Here's a sample of an INI file. Create a file in the settings folder called domesirenchime.ini with a section for each siren that you have. The section heading is the z-wave Node ID for the siren. See below for an explanation of the other parameters. Note that the script does not do a lot of error checking so if you enter the wrong values, you may get strange results.
    Code:
    [123]
    HomeID=00002200
    SirenChimeControl=8090
    SirenChimeToggle=8092
    SirenDuration=8097
    SirenLED=8102
    SirenSound=8103
    SirenVolume=8096
    ChimeDuration=8099
    ChimeLED=8093
    ChimeSound=8095
    ChimeVolume=8101
    [124]
    HomeID=00002200
    SirenChimeControl=9090
    SirenChimeToggle=9092
    SirenDuration=9097
    SirenLED=9102
    SirenSound=9103
    SirenVolume=9096
    ChimeDuration=9099
    ChimeLED=9093
    ChimeSound=9095
    ChimeVolume=9101
    HomeID=Home ID for your z-wave controller that controls the siren. It can be found in the controller Management page of the z-wave plugin or in the z-wave.ini file
    SirenChimeControl=Device Reference ID of the device that turns the Siren on/off
    SirenChimeToggle=Device Reference ID of the manually created device that sets it to chime or siren mode
    SirenDuration=Device Reference ID of the manually created device that sets the siren duration
    SirenLED=Device Reference ID of the manually created device that sets whether the LED is on or off in siren mode
    SirenSound=Device Reference ID of the manually created device that sets the siren mode sound
    SirenVolume=Device Reference ID of the manually created device that sets the siren volume
    ChimeDuration=Device Reference ID of the manually created device that sets the chime duration
    ChimeLED=Device Reference ID of the manually created device that sets whether the LED is on or off in chime mode
    ChimeSound=Device Reference ID of the manually created device that sets the chime mode sound
    ChimeVolume=Device Reference ID of the manually created device that sets the chime volume
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    #2
    This is great! I've used the Dome Siren for an alert for stuff, but this should make integrating it into events really easy. Thanks, Sparkman.

    Comment


      #3
      Originally posted by gregoryx View Post
      This is great! I've used the Dome Siren for an alert for stuff, but this should make integrating it into events really easy. Thanks, Sparkman.
      You're welcome. Let me know if you run into any issues with it.
      HS 4.2.8.0: 2134 Devices 1252 Events
      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

      Comment


        #4
        Originally posted by sparkman View Post
        I've created devices and a script to help set the parameters for a Dome Siren (https://www.aartech.ca/dome-dms01). The devices represent the parameters and values available for it. The parameters can be found in the manual (https://s3.amazonaws.com/shopify-cus...d%20Manual.pdf), but there are some errors in it and there are two additional parameters available to control the LEDs (Parameter 8 for Siren and Parameter 9 for Chime with a value of 0 for off and 1 for on). I manually created the devices based on what was in the manual and from info found elsewhere. See below for a screenshot of the devices. I grouped them using Jon00's grouping utility. There's one device for each parameter, along with the root device. The Status Graphics tab for each device then has entries for each of the possible parameter values for that parameter using the same values. You can add icons for the different values, but that is not needed. If you need a screen shot of the Status Graphics tab for a specific device, let me know and I will post it.

        If anyone has the name of the tune that is Sound 6, let me know. It sounds very familiar, but can't think of the name.


        Here's an example of the device that toggles it between siren and chime mode. It has two values (1 and 2) that correspond to what is shown for parameter 7 in the manual (page 14).

        Click image for larger version

Name:	Capture3.PNG
Views:	3121
Size:	64.9 KB
ID:	1291560


        To trigger the chime/siren, first set the devices to the values you want and then trigger the script. The script does not need any parameters passed to it, but there are hard-coded entries in it for the device references for each of the devices. The script then sets the z-wave parameters for the chime/siren and then activates it.


        Below is the script, save it into your scripts folder as "domesiren.vb" or whatever name you want to give it. Note that since it has hard-coded entries for the specific node, if you have multiple Dome Siren's, you would need to create multiple copies of the script each with a different name. The bolded entries in the script need to be modified based on the z-wave node # for the siren, the HomeID found in the Z-Wave plugin's Controller Management page, and the reference IDs for the devices you create.

        Code:
        Dim HomeID As String = "[B]0000000[/B]" '[B]Home ID as found in the z-wave plugin [/B]
        Dim NodeID As Integer = [B]123 'z-wave node ID # for the Dome Siren[/B]
        Dim DomeSirenID As Integer = [B]8090 'reference id of the device that triggers the siren[/B]
        
        Sub Main(ByVal Parms As String)
        Dim Debug As Boolean = False
        Dim logName As String = "Dome Siren Control"
        Dim Mode As Integer = hs.DeviceValue([B]8092[/B]) 'change for specific reference id for the siren/chime toggle device
        Dim ModeParam As Integer = 7
        
        Dim Duration As Integer
        Dim DurationParam As Integer
        Dim LED As Integer
        Dim LEDParam As Integer
        Dim Sound As Integer
        Dim SoundParam As Integer
        Dim Volume As Integer
        Dim VolumeParam As Integer
        
        If Mode = 1 Then 'Siren Mode
        Duration = hs.DeviceValue([B]8097[/B]) 'change for specific reference id
        LED = hs.DeviceValue([B]8102[/B]) 'change for specific reference id
        Sound = hs.DeviceValue([B]8103[/B]) 'change for specific reference id
        Volume = hs.DeviceValue([B]8096[/B]) 'change for specific reference id
        DurationParam = 2
        LEDParam = 8
        SoundParam = 5
        VolumeParam = 1
        Else 'Chime Mode
        Duration = hs.DeviceValue([B]8099[/B]) 'change for specific reference id
        LED = hs.DeviceValue([B]8093[/B]) 'change for specific reference id
        Sound = hs.DeviceValue([B]8095[/B]) 'change for specific reference id
        Volume = hs.DeviceValue([B]8101[/B]) 'change for specific reference id
        DurationParam = 3
        LEDParam = 9
        SoundParam = 6
        VolumeParam = 4
        End If
        
        If Debug Then
        hs.WriteLog(logName, "Duration Param " & CStr(DurationParam))
        hs.WriteLog(logName, "Duration " & Duration)
        hs.WriteLog(logName, "LED Param " & CStr(LEDParam))
        hs.WriteLog(logName, "LED " & LED)
        hs.WriteLog(logName, "Sound Param " & CStr(SoundParam))
        hs.WriteLog(logName, "Sound " & Sound)
        hs.WriteLog(logName, "Volume Param " & CStr(VolumeParam))
        hs.WriteLog(logName, "Volume " & Volume)
        End If
        
        Try
        Dim ConfigResult As Integer = 0
        ConfigResult = ZWaveParam(ModeParam,Mode)
        If ConfigResult = 1 Then
        ConfigResult = ZWaveParam(DurationParam,Duration)
        ConfigResult = ZWaveParam(LEDParam,LED)
        ConfigResult = ZWaveParam(SoundParam,Sound)
        ConfigResult = ZWaveParam(VolumeParam,Volume)
        Else
        hs.writelog(logName,"Unable to change the parameters for Node " & NodeID)
        End If
        
        hs.CAPIControlHandler(hs.CAPIGetSingleControl(DomeSirenID,True ,"on",False,True))
        
        Catch ex As Exception
        hs.WriteLog(logName, "Exception " & ex.ToString)
        End Try
        End Sub
        
        Function ZWaveParam(ParamNumber As Integer, ParamValue As Integer) As Integer
        Dim logName As String = "Z-Wave Config Set"
        Dim Debug As Boolean = False
        Dim ConfigResult As Integer = 0
        Dim ConfigResultVal() As String = {" is Unknown"," is Successful"," has been Queued"," has Failed"}
        
        Try
        ConfigResult = hs.PluginFunction("Z-Wave", "", "Configuration_Set", New Object(){HomeID, Convert.ToByte(NodeID), Convert.ToByte(ParamNumber), Convert.ToByte(1), Convert.ToInt32(ParamValue)})
        If Debug Then hs.WriteLog(logName, "Result of Parameter " & ParamNumber & " change to " & ParamValue & " on Node " & NodeID & ConfigResultVal(ConfigResult))
        Catch ex As Exception
        hs.writelog(logName, "Error: " & ex.Message.ToString)
        End Try
        
        Return ConfigResult
        
        End Function
        This looks interesting Sparkman. I have a Dome but just use it for a remote siren alert in my wood shop. I didn't realize it has chime. LED, and tunes features for a variety of unique events until I caught your post and read your Dome Siren advanced manual link above. I am pretty sure I follow you above manually creating all the devices and updating your script with my device reference ID's.

        I will report back with my progress. Thanks for your continued contributions!

        Will

        Comment


          #5
          Works great, very cool, thanks!

          Comment


            #6
            Originally posted by will40 View Post
            Works great, very cool, thanks!
            Great, glad it is working for you!
            HS 4.2.8.0: 2134 Devices 1252 Events
            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

            Comment


              #7
              Asking for a small favor from a helpful person;

              Could someone post the script that Sparkman so generously provided as a file and not as the raw code.
              Not sure why, but I'm having a heck of a time exporting the code to save to a VB file.
              Thank you ahead of time!
              Dan-O
              HomeSeer contributor since summer 1999, yes 1999!

              Comment


                #8
                Dan-o see attached domesiren.zip

                Comment


                  #9
                  @will40 - Thanks!

                  sparkman - I just ordered a Dome siren so I will see if I can figure out what sound 6 is when it shows up.
                  Dan-O
                  HomeSeer contributor since summer 1999, yes 1999!

                  Comment


                    #10
                    Originally posted by Dan-O View Post
                    @will40 - Thanks!

                    sparkman - I just ordered a Dome siren so I will see if I can figure out what sound 6 is when it shows up.
                    Lol, thanks. The tune is very familiar, but no one here has been able to confirm what it is.
                    HS 4.2.8.0: 2134 Devices 1252 Events
                    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                    Comment


                      #11
                      I knew it was something by Mozart...just had to listen to about 15 minutes of his piano concerto's...15 brutal minutes

                      The mystery is over...Sound 6 is...Mozart's Rondo alla Turco (Turkish March)

                      Comment


                        #12
                        Originally posted by will40 View Post
                        I knew it was something by Mozart...just had to listen to about 15 minutes of his piano concerto's...15 brutal minutes

                        The mystery is over...Sound 6 is...Mozart's Rondo alla Turco (Turkish March)
                        Lol, thanks Will!
                        HS 4.2.8.0: 2134 Devices 1252 Events
                        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                        Comment


                          #13
                          I've updated the script and description in the first post. This version has moved the hard-coded reference IDs to an INI file so that the script can be used with multiple sirens.
                          HS 4.2.8.0: 2134 Devices 1252 Events
                          Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                          Comment


                            #14
                            So, the siren showed up today and I zipped home for a minute to fiddle. The Dome Siren only created 3 new devices, is that correct?
                            I see where you said to manually create the other devices in your first post.
                            When I create the new devices, is that where I will find the device ID in the Advanced Tab of the new device? (To be entered into the ini file)

                            I only had a few minutes to mess around with it over my lunch break. This will probably make more sense to me when I have the Siren in my hand and can do more testing and device management tonight.
                            Thank you for the assistance.
                            Dan-O
                            HomeSeer contributor since summer 1999, yes 1999!

                            Comment


                              #15
                              Originally posted by Dan-O View Post
                              So, the siren showed up today and I zipped home for a minute to fiddle. The Dome Siren only created 3 new devices, is that correct?
                              I see where you said to manually create the other devices in your first post.
                              When I create the new devices, is that where I will find the device ID in the Advanced Tab of the new device? (To be entered into the ini file)

                              I only had a few minutes to mess around with it over my lunch break. This will probably make more sense to me when I have the Siren in my hand and can do more testing and device management tonight.
                              Thank you for the assistance.
                              Yes, three devices are what the actual device creates and the other ones need to be created manually (although I'm thinking about making a script to create those). Yes, the reference ID is on the Advanced tab, although you can also show them in a column in the Device Management screen. There's an option in setup to turn that on.
                              HS 4.2.8.0: 2134 Devices 1252 Events
                              Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                              Comment

                              Working...
                              X