No announcement yet.

Email Attachment - Device Status Contains File Path

  • Filter
  • Time
  • Show
Clear All
new posts

    Email Attachment - Device Status Contains File Path

    I am trying to email an attachment that has its path stored in the device status of device 522. On the attachment line I can enter the file path below and the email will send. The path changes each time the device is updated so I am trying to use a replacement variable. I have tried $$DSR:522: $$DSC:522: and $$DSA:522: but these do not result in an attachment being sent. I can return the path in the script commands tool using hs.CapiGetStatus(522).Status and hs.replacevariables("$$DSR:522:") but these do not work in the attachment line. Thanks in advance for your help.


    Click image for larger version

Name:	Capture.JPG
Views:	81
Size:	19.3 KB
ID:	1441587

    Have you considered using the script that is using hs.CapiGetStatus to copy the file to a fixed name and location? Understand that this is not preferred but it is a viable work around.


      Thanks for the suggestion. That should work but I have not found any examples of using Capi to copy a file to a new location and rename it. Do you have any examples?


        Here is an example

        Imports System.IO
        Sub Main(ByVal parms As Object) ' Copy one file to a new location.
        Dim dvStatus as String
        dvStatus = hs.CapiGetStatus(1234).Status
        File.Copy(dvStatus, "C:\HS4\temp.jpg", True) 'the True means overwrite if the file exists
        Catch ex as Exception
          hs.WriteLog("CopyFile", ex.Message)
          Exit Sub
        End Try
        hs.WriteLog("CopyFile", "e-mail file copied to static location")
        End Sub
        Hope this helps you


          Thank you very much!! I spent 3 hours trying to come up with a way to get the file emailed. In my event I had it run this script and entered the static path c\HS4\temp.jpg for the attachment and the file is sent.

          With this project I am processing alert images from Blue Iris that are being served to a local AI called DeepStack. The middle ware that serves the images to DeepStack is On-Guard. On-Guard relays the objects identified via MQTT. I use the mcsMQTT plugin for the MQTT broker. Based on conditions in HomeSeer I trigger other events, send email, trigger Blue Iris to record the event or ignore the object and do nothing.