Announcement

Collapse
No announcement yet.

Sending an Email or Text of a Snapshot

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

  • dcorsus
    replied
    It would be change its value and it would be the only trigger not 3 triggers . I’m not at home but I thought is is called “has its value changes”, therefore it will only trigger when there is a different snapshot. See why it make sure that each new snapshot has a unique name, so it can be used to trigger an event

    Leave a comment:


  • skozin
    replied
    Is this is what you are saying?

    Click image for larger version  Name:	Untitled.png Views:	0 Size:	106.7 KB ID:	1599536

    Because if so I get nonstop texts sent. Sorry I am a little confused.

    Thanks for working with me.

    Leave a comment:


  • dcorsus
    replied
    Originally posted by skozin View Post

    What do you mean by "tee of your event"?

    Are you saying to create a virtual device for that?
    Nope use that as the trigger instead of using the motion state

    Leave a comment:


  • skozin
    replied
    Originally posted by dcorsus View Post
    There is a delay between the event being received and the video and snapshot to be available. My advice is to tee of your event when the snapshot feature changes value (any value that is). That is the best trigger to know a new snapshot was "posted".
    What do you mean by "tee of your event"?

    Are you saying to create a virtual device for that?

    Leave a comment:


  • dcorsus
    replied
    There is a delay between the event being received and the video and snapshot to be available. My advice is to tee of your event when the snapshot feature changes value (any value that is). That is the best trigger to know a new snapshot was "posted".

    Leave a comment:


  • skozin
    replied
    Ok, thanks for the quick response. Now back to the previous topic. Something doesn't seem right. I made an event that will take a snapshot when there is motion detected or the doorbell rings. It will run the script, however, it shows the previous picture not the current snapshot. In my log I have this location:

    3/20/2023 5:40:17 PM
    Script
    Attach
    /usr/local/HomeSeer/html/Ring/snapshots/snapshot_16046093_03-20-2023_17-39-02.jpg​

    the timestamp on the file should be 17:40:17PM

    What am I doing wrong?

    Click image for larger version

Name:	Untitled.png
Views:	128
Size:	96.7 KB
ID:	1599519
    Click image for larger version

Name:	1Untitled.png
Views:	88
Size:	100.6 KB
ID:	1599520

    Leave a comment:


  • dcorsus
    replied
    Originally posted by skozin View Post
    Changing the topic a little. Since you are getting pictures and possibly video, I use Blue Iris 5 software and can't get the video from my Ring doorbell camera. How are you able to get it and is it possible to get it on Blue Iris by using an ip address or rtsp?
    Without being 100% sure, here is what I think is the problem:

    1. Ring cameras do no support the standard camera interfaces, they interface ONLY with the ring-server. So any video access, whether stored or real-time actually streams from their server.
    2. To retrieve or setup a live-stream (I think SIP is used), the client application needs to be authenticated with the ring-server and an accessToken needs to be shared (and refreshed) in any and all communication with the ring server. So .... unless blueIris makes some extension to their SW package to support the Ring camera/api, I doubt it can be made to work. That's also the reason I cannot just publish a URI in a feature, so you could directly retrieve it from the ring server, you would need all the HTTP authentication headers to be present for it to work. a Curl command would do it but that is useless for most people, not to mention that the token is only valid for an hour so that Curl info would be stake quickly.

    There are some authors (for homeassistant/hubitat) that have figured out how to set up a live-stream, but that is some serious advance stuff and low on my list, perhaps never

    Leave a comment:


  • skozin
    replied
    Changing the topic a little. Since you are getting pictures and possibly video, I use Blue Iris 5 software and can't get the video from my Ring doorbell camera. How are you able to get it and is it possible to get it on Blue Iris by using an ip address or rtsp?

    Leave a comment:


  • skozin
    replied
    Oh I see. That would definitely be an issue. Also, I am using the HSPI box which would not be fast enough to do all of that. Definitely not like a PC with no speed and not much space or memory!

    Leave a comment:


  • dcorsus
    replied
    Originally posted by skozin View Post
    Will your plugin be able to do this with video clips? For example, if there was motion at the door, Ring will record the video.
    This is actually a really good question, I hadn't given it any thought.
    There are a few challenges I see:

    1. I would have to add a video feature
    2. This would mean that you automatically download the video to the HS PC (this already exists in the PI), which takes a bit ... after ... the video is available. The latter takes another at least 60 seconds. This means that the feature would change a minute and a half after the event.
    3. Looking at my setup, the videos are in the 10 to 20Mbyte size range, so most email systems will not allow such a big attachment.


    Thoughts?

    Leave a comment:


  • skozin
    replied
    Thanks dcorsus. That is what I was looking for!!! I was having the hardest time trying to get it to work this way and couldn't figure out how to send the picture.

    Will your plugin be able to do this with video clips? For example, if there was motion at the door, Ring will record the video.

    Leave a comment:


  • dcorsus
    replied
    Originally posted by skozin View Post
    Because I don't know scripting well and I don't know how to use stringvalue in a script.
    Well you are doing good so far. If you can do it the hard way, doing it the easy way should be easier
    This line should do it (assuming 460 is the feature reference for the snapshot feature


    Attach = hs.GetAppPath & "/html/" & hs.devicestring (460)

    Leave a comment:


  • skozin
    replied
    Because I don't know scripting well and I don't know how to use stringvalue in a script.

    Leave a comment:


  • dcorsus
    replied
    Originally posted by skozin View Post
    Thanks to Jon00 and Will40, I think I have it now. What needed to be done is to create 2 scripts: One is the following:
    (This is for Linux, Windows chang the "/" to "")

    Script 1

    Imports System.IO


    Sub Main(ByVal Parm As Object)
    Dim FN As String = ""
    Dim FD As String = ""
    Dim NFN As String = ""
    Dim NFD As Date
    Dim Directory As String = hs.GetAppPath & "/html/Ring/snapshots"

    FN = Dir(Directory & "/*.jpg")
    Do While FN <> ""
    FD = FileDateTime(Directory & "/" & FN)
    If FD > NFD Then
    NFN = FN
    NFD = FD
    End If
    FN = Dir
    Loop
    My.Computer.FileSystem.CopyFile(Directory & "/" & NFN, Directory & "/latest.jpg", overwrite:=True)

    End Sub​


    Then create the email script:

    Script 2

    Sub Main(ByVal Parm As Object)
    Dim RingImage As String = ""
    Dim EmailFrom As String = ""
    Dim EmailTo As String = ""
    Dim Subject As String = ""
    Dim Body As String = ""
    Dim Attach As String = ""


    EmailTo = "xxxx@tmomail.net"
    EmailFrom = "xxxx@comcast.net"
    Subject = "Ring Image"
    Body = "Taken on " &now()
    Attach = hs.GetAppPath & "/html/Ring/snapshots/latest.jpg"
    hs.writelog("Attach",Attach)

    hs.SendEmail(EmailTo, EmailFrom, "", "", Subject, Body, Attach)

    End Sub

    The 1st script will copy the new image over to the name "latest.jpg". Then I can run the 2nd script to then send the email with the attachment. This can be done on one event using a 5 second delay:

    Event Picture Taken and Send Text
    Action Event 1 (Picture Taken)
    Run 1st script (Imports System IO)
    wait 5 seconds
    Event Send Text Message with Picture
    Run 2nd script (Script #2)

    Hope this helps.​
    Happy to see you figured it out but why a script to copy/rename a file and not use the feature.stringValue and avoid having 2 scripts?

    Leave a comment:


  • skozin
    replied
    Thanks to Jon00 and Will40, I think I have it now. What needed to be done is to create 2 scripts: One is the following:
    (This is for Linux, Windows chang the "/" to "")

    Script 1

    Imports System.IO


    Sub Main(ByVal Parm As Object)
    Dim FN As String = ""
    Dim FD As String = ""
    Dim NFN As String = ""
    Dim NFD As Date
    Dim Directory As String = hs.GetAppPath & "/html/Ring/snapshots"

    FN = Dir(Directory & "/*.jpg")
    Do While FN <> ""
    FD = FileDateTime(Directory & "/" & FN)
    If FD > NFD Then
    NFN = FN
    NFD = FD
    End If
    FN = Dir
    Loop
    My.Computer.FileSystem.CopyFile(Directory & "/" & NFN, Directory & "/latest.jpg", overwrite:=True)

    End Sub​


    Then create the email script:

    Script 2

    Sub Main(ByVal Parm As Object)
    Dim RingImage As String = ""
    Dim EmailFrom As String = ""
    Dim EmailTo As String = ""
    Dim Subject As String = ""
    Dim Body As String = ""
    Dim Attach As String = ""


    EmailTo = "xxxx@tmomail.net"
    EmailFrom = "xxxx@comcast.net"
    Subject = "Ring Image"
    Body = "Taken on " &now()
    Attach = hs.GetAppPath & "/html/Ring/snapshots/latest.jpg"
    hs.writelog("Attach",Attach)

    hs.SendEmail(EmailTo, EmailFrom, "", "", Subject, Body, Attach)

    End Sub

    The 1st script will copy the new image over to the name "latest.jpg". Then I can run the 2nd script to then send the email with the attachment. This can be done on one event using a 5 second delay:

    Event Picture Taken and Send Text
    Action Event 1 (Picture Taken)
    Run 1st script (Imports System IO)
    wait 5 seconds
    Event Send Text Message with Picture
    Run 2nd script (Script #2)

    Hope this helps.​

    Leave a comment:

Working...
X