Announcement

Collapse
No announcement yet.

Sending an Email or Text of a Snapshot

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

    Sending an Email or Text of a Snapshot

    Hello:

    I just started playing with the plugin and as of now it seems great. One question. Say I want to send an email or text of the snapshot taken based on motion. Each time the snapshot is taken it creates a new file name (Ex: /Ring/snapshots/snapshot_16046093_03-18-2023_17-11-01.jpg) How would I add the latest snapshot as an attachment? The date and time changes all the time. FYI, I am very weak at programming.

    The picture below works but I manually put the date and time in. Is there an easier way?

    Edit: The pic is wrong. I forgot to put in http://192.168.2.XX:XXXX before the Ring/Snapshots...

    Thanks in advance.

    Steve Click image for larger version  Name:	Untitled.png Views:	0 Size:	81.4 KB ID:	1599041

    #2
    Use $$DTR:ref:​ (see https://help.homeseer.com/help/HS3/s...ent_variables1) to use the string value of the device, so it will always be correct. Depending on whether you plan to retrieve the image through HTTP (then the path is correct) or as a file (then you need to add the <gs root>/html prefix (but you can only do this on the local PC).

    Comment


      #3
      Dcorsus:

      Thanks for the quick reply. I am using A HSPI Linux device, can that still be done?

      Well after testing it won't send a picture to the text message at all. Can someone show me how to attach that file when motion is detected?

      Thanks

      Comment


        #4
        Originally posted by skozin View Post
        Well after testing it won't send a picture to the text message at all. Can someone show me how to attach that file when motion is detected?

        Thanks
        There is always the chance that substitution variables are not supported as "an attachment value", but that would be a HS question. Make sure you syntax is correct and you are using the right reference of the correct feature (not the device!)

        Comment


          #5
          So where would the $$DTR:ref go? I am a little confused.

          Comment


            #6
            You have to find the reference value of the feature and use that in conjunction with the $$DTR:xxxx: wrapper, where you now have the fixed name of the attachment in your event. Please read up using the link I posed on replacement variables and do search this forum for other posts that may answer the questions you have.

            Comment


              #7
              you can save this script.vb and run it from your event if your image path is the same

              Code:
              Sub Main(Parm As Object)
              
              Dim RingImage
              RingImage = hs.devicestring (xxxx)'where x is your HS RING Snapshot device ref#
              
              hs.SendEmail("yourto@email","yourfrom@email","","","your subject","This is RING Motion Image taken on " &now(),"C:\Program Files (x86)\HomeSeer HS4\html" & RingImage)
              
              End Sub​

              Comment


                #8
                Thanks for the script, but I am getting an error message:





                3/18/2023 6:18:05 PM
                Thread Pool Worker
                Error
                Running script: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: startIndex-> at System.String.IndexOf (System.String value, System.Int32 startIndex, System.Int32 count, System.StringComparison comparisonType) [0x0001b] in :0 at System.String.IndexOf (System.String value, System.Int32 startIndex, System.StringComparison comparisonType) [0x00009] in :0 at System.String.IndexOf (System.String value, System.Int32 startIndex) [0x00000] in :0 at HSCore.Trigger.TriggerRunScript (System.String scr, System.Boolean single_instance, System.Int32 phone_line, System.String host, System.Boolean wait_here, System.String CalledFrom, System.String UName, System.Int32 URights, System.String passedfunc, System.Object passedparam, System.Int32 evref, System.Boolean DoSetEvent) [0x00422] in :0


                ​​

                Comment


                  #9
                  Originally posted by skozin View Post
                  Thanks for the script, but I am getting an error message:





                  3/18/2023 6:18:05 PM
                  Thread Pool Worker
                  Error
                  Running script: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: startIndex-> at System.String.IndexOf (System.String value, System.Int32 startIndex, System.Int32 count, System.StringComparison comparisonType) [0x0001b] in :0 at System.String.IndexOf (System.String value, System.Int32 startIndex, System.StringComparison comparisonType) [0x00009] in :0 at System.String.IndexOf (System.String value, System.Int32 startIndex) [0x00000] in :0 at HSCore.Trigger.TriggerRunScript (System.String scr, System.Boolean single_instance, System.Int32 phone_line, System.String host, System.Boolean wait_here, System.String CalledFrom, System.String UName, System.Int32 URights, System.String passedfunc, System.Object passedparam, System.Int32 evref, System.Boolean DoSetEvent) [0x00422] in :0


                  ​​
                  suggest you post picture of your event and content of your script. What is the feature reference number of the ring device that holds the snapshot feature string?

                  Comment


                    #10
                    I am running a manual event Click image for larger version  Name:	Untitled.png Views:	0 Size:	87.6 KB ID:	1599064
                    my script is:

                    Sub Main(Parm As Object)

                    Dim RingImage
                    RingImage = hs.devicestring (460)'where x is your HS RING Snapshot device ref#

                    hs.SendEmail("xxxxxx@comcast.net","xxxxx@gmail.com","","", "your subject","This is RING Motion Image taken on " &now(),"C:\Program Files (x86)\HomeSeer HS4\html" & RingImage)

                    End Sub​

                    460 is the Device reference #.

                    Dcorsus:

                    I tried your method and it ends up giving me a link on my message to click and then it will open the snapshot. What I am trying to get is just the snapshot showing up and not clicking the link.

                    Thanks

                    Comment


                      #11
                      Originally posted by skozin View Post
                      I am running a manual event Click image for larger version Name:	Untitled.png Views:	0 Size:	87.6 KB ID:	1599064
                      my script is:

                      Sub Main(Parm As Object)

                      Dim RingImage
                      RingImage = hs.devicestring (460)'where x is your HS RING Snapshot device ref#

                      hs.SendEmail("xxxxxx@comcast.net","xxxxx@gmail.com","","", "your subject","This is RING Motion Image taken on " &now(),"C:\Program Files (x86)\HomeSeer HS4\html" & RingImage)

                      End Sub​

                      460 is the Device reference #.

                      Dcorsus:

                      I tried your method and it ends up giving me a link on my message to click and then it will open the snapshot. What I am trying to get is just the snapshot showing up and not clicking the link.

                      Thanks
                      What is the file name of your script, more importantly, what is the extension? It should be FrontDoor.vb (or so I believe)

                      Comment


                        #12
                        Well I found out the error message was from not saving the script as .vb. Now testing the script again. Going out, will let you know later.

                        Thanks,
                        Steve

                        Comment


                          #13
                          script works for me (Windows 10) and your copy looks ok and sounds like you got the correct device string.

                          I just tried using the device string as a replacement variable for the email attachment and cant get it to work for me everyway I try.

                          Comment


                            #14
                            Originally posted by skozin View Post
                            I tried your method and it ends up giving me a link on my message to click and then it will open the snapshot. What I am trying to get is just the snapshot showing up and not clicking the link.
                            I see, if you don't want to (continue) to go the script route , perhaps you can try (in the attachment section)

                            C:\Program Files (x86)\HomeSeer HS4\html$$DTR:460:

                            edit: not sure this will work, but worth suggesting/trying

                            Comment


                              #15
                              Just FYI, but I'm contemplating a change to have the feature string hold the full path, instead of the relative (webserver) path. The image would still be based on a relative (http) path so it should still work properly in an HST screen that uses the "image" to update an object on an HST Screen.
                              Thoughts?

                              Comment

                              Working...
                              X