Announcement

Collapse
No announcement yet.

Sending an Email or Text of a Snapshot

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

  • will40
    replied
    if there is still a question of your file path try replacing the Attach variable with

    Code:
    Attach = hs.GetAppPath & "/html" & RingImage
    Yes, post your script code. Someone will chime in with the correct syntax. The email script above is a very simple script. It should work.

    Leave a comment:


  • dcorsus
    replied
    Originally posted by skozin View Post
    No I get an error message:



    3/19/2023 11:15:54 AM
    HomeSeer
    Error
    Compiling script (1)FrontDoorSnapshot.vb: 'End' statement not valid.

    3/19/2023 11:15:54 AM
    HomeSeer
    Error
    Compiling script (1)FrontDoorSnapshot.vb: 'End Sub' expected.


    Looks like a typo somewhere. Suggest you always post the source code and the error combined so other can help spot them.
    I see an &now() , not sure but shouldn't there be a space like & now(). Suspect the error might be a typo somewhere else in your script, perhaps a " forgotten

    Leave a comment:


  • skozin
    replied
    No I get an error message:



    3/19/2023 11:15:54 AM
    HomeSeer
    Error
    Compiling script (1)FrontDoorSnapshot.vb: 'End' statement not valid.

    3/19/2023 11:15:54 AM
    HomeSeer
    Error
    Compiling script (1)FrontDoorSnapshot.vb: 'End Sub' expected.


    Leave a comment:


  • will40
    replied
    have you tried the script placing the current RING image as the "Attach" variable above to determine if the script is all wrong for Linux? Sorry I can't help if its a Linux thing.

    Attach = "/usr/local/HomeSeer/html/ring/snapshots/snapshot_123456_03-19-2023_09-17-18.jpg"

    This way you can determine if your device 480 has the correct Linux format for the string?

    Leave a comment:


  • dcorsus
    replied
    Originally posted by will40 View Post
    yup I got ya. Its would be one of those 'will work for some but not all' methods. Probably best to leave as is then?
    Might make it an settable option, but the more I think about it, maybe the full path is a smidge better. If you would have to use it in some type of script anyway and therefore you can easily transform one into the other.

    Originally posted by will40 View Post
    Another solution to the script above, if its an issue depending on the user's OS, would be to cobble up a script during the RING motion event to copy the RING image captured to another folder, email the only file in that folder, then delete it and empty that folder afterwards for the next image. I do this with my security camera videos and it works.
    So the trick here is to use either:
    - Environment.CurrentDirectory
    or
    - hs.GetAppPath

    Secondly Windows uses backslashes (\) whereas Linux uses forward slashes (/) in their pathname. Linux does NOT accept backslashes but Windows doesn't care so build your pathname using forward slashes (/). ALSO Linux file names are case sensitive so make sure you respect those.

    So use the above functions in your .vb script to form the right "attach" path.​

    Leave a comment:


  • skozin
    replied
    Originally posted by will40 View Post
    I am not a Linux platform guy but maybe try the following script a different way. Remember the plug in's device status (string) 460 contains the remainder of the string after html. ex: (\ring\snapshots\snapshot_123456_03-19-2023_09-17-18.jpg)

    Code:
    Sub Main(Parm As Object)
    
    Dim RingImage
    Dim EmailFrom
    Dim EmailTo
    Dim Subject
    Dim Body
    Dim Attach
    
    RingImage = hs.devicestring (460)
    
    EmailFrom = "xxxxx@comcast.net"
    EmailTo = "xxxxxx@gmail.com"
    Subject = "Ring Image"
    Body = "This is RING Motion Image taken on " &now()
    Attach = "\usr\local\HomeSeer\html" & RingImage
    
    hs.SendEmail(EmailFrom,EmailTo,"","",Subject,Body,Attach)
    
    End Sub​
    No that doesn't seem to work. I think in Linux the \ has to be the other way, I tried changing them, but it still doesn't work.

    Also, when I use the following in the message area of the email or text:

    http://xxxxx.ddns.net:6161$$DTR:460:

    The link shows up but it will display the previous string not the current snapshot.

    What would be ideal is to just show the snapshot that was just taken in the text.

    Any ideas or suggestions?

    Leave a comment:


  • will40
    replied
    Originally posted by dcorsus View Post

    The first and foremost important hurdle is that a webserver (HS in this case), can only serve content from a specific root path, this is a protection against hacking. So for HS it is <hs root>/html and all its subdirectories. So if the intent of the string value of the snapshot feature is to do a webserver retrieval it should be formed as a relative URI with either HTTP://<ip address>:<ip port>/path or file:/// etc or it is a full path on your disk, in which case it would be c:\xxx\xxx\xxx but that cannot be served via a webserver in this format AND (baring some VPN into your PC or shared directories (big no-no)) that file cannot be retrieved from another host.

    And therein lies the conundrum of what to put in the string value of the Snapshot feature.
    yup I got ya. Its would be one of those 'will work for some but not all' methods. Probably best to leave as is then?

    Another solution to the script above, if its an issue depending on the user's OS, would be to cobble up a script during the RING motion event to copy the RING image captured to another folder, email the only file in that folder, then delete it and empty that folder afterwards for the next image. I do this with my security camera videos and it works.

    Leave a comment:


  • will40
    replied
    I am not a Linux platform guy but maybe try the following script a different way. Remember the plug in's device status (string) 460 contains the remainder of the string after html. ex: (\ring\snapshots\snapshot_123456_03-19-2023_09-17-18.jpg)

    Code:
    Sub Main(Parm As Object)
    
    Dim RingImage
    Dim EmailFrom
    Dim EmailTo
    Dim Subject
    Dim Body
    Dim Attach
    
    RingImage = hs.devicestring (460)
    
    EmailFrom = "xxxxx@comcast.net"
    EmailTo = "xxxxxx@gmail.com"
    Subject = "Ring Image"
    Body = "This is RING Motion Image taken on " &now()
    Attach = "\usr\local\HomeSeer\html" & RingImage
    
    hs.SendEmail(EmailFrom,EmailTo,"","",Subject,Body,Attach)
    
    End Sub​

    Leave a comment:


  • skozin
    replied
    Originally posted by will40 View Post
    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​

    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.



    I am using Linux for HS4 so the location of the snapshot is at: /usr/local/HomeSeer/html/Ring

    I tried inserting that where you have C:\Program Files (x86)\HomeSeer HS4\html and can't seem to put it there.​

    Leave a comment:


  • skozin
    replied
    Originally posted by dcorsus View Post

    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

    I tried that but I am using Linux and tried instead of C:\Program Files (x86)\HomeSeer HS4\html$$DTR:460:

    I used /usr/local/HomeSeer/html/Ring/$$DTR:460:

    and it doesn't work. Any suggestions?

    Leave a comment:


  • dcorsus
    replied
    Originally posted by will40 View Post
    that's a good idea. Would the full http path device string (status) be a hyperlink to click and open the image full size in another window?
    The first and foremost important hurdle is that a webserver (HS in this case), can only serve content from a specific root path, this is a protection against hacking. So for HS it is <hs root>/html and all its subdirectories. So if the intent of the string value of the snapshot feature is to do a webserver retrieval it should be formed as a relative URI with either HTTP://<ip address>:<ip port>/path or file:/// etc or it is a full path on your disk, in which case it would be c:\xxx\xxx\xxx but that cannot be served via a webserver in this format AND (baring some VPN into your PC or shared directories (big no-no)) that file cannot be retrieved from another host.

    And therein lies the conundrum of what to put in the string value of the Snapshot feature.

    Leave a comment:


  • will40
    replied
    that's a good idea. Would the full http path device string (status) be a hyperlink to click and open the image full size in another window?

    Leave a comment:


  • dcorsus
    replied
    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?

    Leave a comment:


  • dcorsus
    replied
    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

    Leave a comment:


  • will40
    replied
    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.

    Leave a comment:

Working...
X