Announcement

Collapse
No announcement yet.

Sending an Email or Text of a Snapshot

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

    #46
    Ok no problem. I thought I was going crazy either running the event or clicking the snap picture button on the web page and it wasn't updating to the correct date/time stamp every time. Thanks for your assistance.

    Regards,
    Steve

    Comment


      #47
      So it's been a couple of days since and I just updated to 1.0.23 and still having problems with taking a snapshot and sending a picture.

      I just want to let you know about the snapshot issue I am still having with my event. For some reason when the front door camera detects motion, It will take a snapshot and then send an email. The result is:
      3/24/2023 9:51:43 AM
      Script
      Attach
      /usr/local/HomeSeer/html/Ring/snapshots/01-01-1969_00-00-00__16046093_.jpg

      Which will be a blank picture. Also on the device page there is no picture just an icon. Once in a while it will send the picture with the correct time/date, but more not.


      Any ideas?​

      Here are my events and scripts: Click image for larger version

Name:	1Untitled.png
Views:	149
Size:	100.9 KB
ID:	1600209
      Click image for larger version

Name:	2Untitled.png
Views:	108
Size:	77.0 KB
ID:	1600210

      Click image for larger version

Name:	2aUntitled.png
Views:	110
Size:	79.5 KB
ID:	1600211Click image for larger version

Name:	3Untitled.png
Views:	110
Size:	104.3 KB
ID:	1600212

      Hope this helps. I just turned on debugging mode and I will PM the log.

      Thanks,
      Steve

      Comment


        #48
        Originally posted by skozin View Post
        So it's been a couple of days since and I just updated to 1.0.23 and still having problems with taking a snapshot and sending a picture.

        I just want to let you know about the snapshot issue I am still having with my event. For some reason when the front door camera detects motion, It will take a snapshot and then send an email. The result is:
        3/24/2023 9:51:43 AM
        Script
        Attach
        /usr/local/HomeSeer/html/Ring/snapshots/01-01-1969_00-00-00__16046093_.jpg

        Which will be a blank picture. Also on the device page there is no picture just an icon. Once in a while it will send the picture with the correct time/date, but more not.


        Any ideas?​

        Here are my events and scripts: Click image for larger version

Name:	1Untitled.png
Views:	149
Size:	100.9 KB
ID:	1600209
        Click image for larger version

Name:	2Untitled.png
Views:	108
Size:	77.0 KB
ID:	1600210

        Click image for larger version

Name:	2aUntitled.png
Views:	110
Size:	79.5 KB
ID:	1600211Click image for larger version

Name:	3Untitled.png
Views:	110
Size:	104.3 KB
ID:	1600212

        Hope this helps. I just turned on debugging mode and I will PM the log.

        Thanks,
        Steve
        As I wrote before, you cannot use the motion state to trigger this event, the snapshot availability doesn't happen at the same time as when the motion event is received, it lags because the PI needs to retrieve that snapshot.

        Therefore you need to simplify this event.
        Trigger: when snapshot feature string changes
        ONLY action: send email or run your script. None of the taking of snapshots or waiting, the snapshot is available that's why the feature status was changed and you can safely email it.

        I'm still seeing very inconsistent behavior with these cameras but that doesn't invalidate what I wrote above. If you see that the camera does not generate a snapshot at all, I don't think adding actions to "take a snapshot when motion" will solve that as the PI already does that, but you can try that.
        That means you could have an independent event that triggers when motion with ONLY action to take a snapshot. The two events cannot be linked, they occur separate in time and have different triggers.

        Now to make it more muddy, say you only want to email snapshots when there is motion and NOT when you manually trigger taking a snapshot, in that case you can add a condition to the first described event and it would become:
        Trigger when the snapshot feature changes value AND (note this is a condition NOT a trigger) motion feature state <> no-motion Then send email.

        Clear as mud?

        Comment


          #49
          Definitely mud!!!

          So say I try your 1st trigger:

          Trigger: when snapshot feature string changes
          ONLY action: send email or run your script. None of the taking of snapshots or waiting, the snapshot is available that's why the feature status was changed and you can safely email it.​ Click image for larger version

Name:	Untitled.png
Views:	125
Size:	83.2 KB
ID:	1600224

          But the problem is the value of the string never changes it is always at 1000. Am I using the correct Device? Because it is not working. Click image for larger version

Name:	11Untitled.png
Views:	110
Size:	106.1 KB
ID:	1600225

          Comment


            #50
            skozin

            Almost , this is how your event should look like

            Attached Files

            Comment


              #51
              Ok I tried that and I walked up to my front door and the text gets sent but no picture and in my log the timestamp is 1/1/1969. So I went to the device page and clicked take snapshot to update the string. That string shows 5:19pm. Then I went to my front door and walked in front of the camera at 5:21pm and it sent me the picture that I manually took @ 5:19pm so it is not updating the string with the correct image. How do I know. The picture @ 5:19pm had nobody in the image, @5:21pm I am in the image according to my Ring app. Also, I just looked in the snapshots folder and the file is 17-19-25 not 17-21-00.

              Comment


                #52
                Well you are fighting multiple issues. Leave the event as you had it changed per my recommendation. I just posted v26, install that and try again.
                The issues will hopefully, mostly be fixed, but during my testing, I had one case where it took 20 seconds for the snapshot to be available for download, that means borderline fail (10 retries with 2 seconds in between).

                NC-Lou I made a minor change to recognize a car cam. Not sure it will work but recommend you upgrade to v26 and report back.

                Comment


                  #53
                  Sorry Dirk, updated to 1.0.0.26 and still the same. Went outside @ 9:06:49pm and the event ran but still showed the previous timestamp: Ring/snapshots/03-24-2023_21-05-16_motion_16046093_7214299516780206093.jpg . It was the wrong snapshot. The file in the Ring/snapshots folder is still 3-24-2023_21-05-16, so it is not updating to the latest snapshot.

                  Hope that helps

                  Comment


                    #54
                    Originally posted by skozin View Post

                    Hope that helps
                    Not really, logs do help


                    Comment


                      #55
                      In case anyone is interested still, I got this working (e-mail alerts for motion with the snapshot attached). Used will40's script as a starting point with some minor tweaks to allow for parameters. So it looks like this:

                      Code:
                      ' send e-mail with snapshot attachment for a Ring camera motion event
                      '
                      ' parameters: device ID of the camera's snapshot feature and the name of the camera
                      ' ex. 921,dining room
                      
                      Sub Main(ByVal Parms as String)
                      
                      Dim logName = "JCR script testing" ' set log type for HS log
                      
                      ' script parameters
                      Dim ParmArray() as String
                      ParmArray = Parms.tostring.split(",")
                      Dim devID as Double = CDbl(ParmArray(0)) ' ID of the camera's snapshot device (for filename)
                      Dim devName as String = ParmArray(1) ' camera name (to use in e-mail)
                      Dim RingImage = hs.devicestring (devID) ' path to the snapshot
                      
                      ' e-mail variables
                      Dim EmailFrom = "<from address>"
                      Dim EmailTo = "<to address>"
                      Dim Subject = "[Ring] Motion detected - " & devName
                      Dim Body = "Motion was detected by the " & devName & " Ring camera at " & now()
                      Dim Attach = hs.GetAppPath & "/html/" & RingImage
                      
                      hs.writelog(logName," ID: " & devID & " / Name: " & devName & " / Path: " & Attach)
                      hs.SendEmail(EmailTo, EmailFrom, "", "", Subject, Body, Attach)
                      
                      End Sub
                      ​
                      Notice in the original script, I believe the EmailTo and EmailFrom parameters in hs.SendEmail were reversed (I used this as a reference). Then, my simple test event looks like this. The key was to use "had it value set or changed." I used just "changed" initially and it wasn't working then I noticed dcorsus sample event above and switched to that trigger and it started working.

                      Click image for larger version

Name:	image.png
Views:	166
Size:	56.7 KB
ID:	1613005

                      The first parameter is the device ID of the camera's snapshot feature and the second is the name of the camera to use in the e-mail alert. The resulting e-mail has the snapshot attached:

                      ​​Click image for larger version

Name:	image.png
Views:	86
Size:	68.3 KB
ID:	1613006
                      Next step is to only send the notification when the alarm is in a certain state (i.e., armed away) and also see if I can replicate this in an HSBuddy push notification.

                      Comment


                        #56
                        nice job windracer works for me!

                        Comment


                          #57
                          Originally posted by windracer View Post
                          In case anyone is interested still, I got this working (e-mail alerts for motion with the snapshot attached). Used will40's script as a starting point with some minor tweaks to allow for parameters.

                          Next step is to only send the notification when the alarm is in a certain state (i.e., armed away) and also see if I can replicate this in an HSBuddy push notification.
                          Continuing to refine this, now that HSBuddy supports Ring cameras, I can send a push notification with snapshot when motion occurs in a certain alarm state. This event below is sending an e-mail and the push notification, but I may turn off the e-mail part once I do more testing.

                          Click image for larger version

Name:	image.png
Views:	94
Size:	98.3 KB
ID:	1621295
                          HSBuddy push notification on my watch:

                          Click image for larger version

Name:	image.png
Views:	56
Size:	49.4 KB
ID:	1621296

                          Very cool.

                          Comment

                          Working...
                          X