Announcement
Collapse
No announcement yet.
Sending emails with content only one time.
Collapse
X
-
Thanks Jon. That is the problem I am having.
My IP Cam produces the snapshot in it's webserver with that link. It appears I will need a way to save that image to disk in order to email it.
I will look into your image builder.
Thanks.
Leave a comment:
-
You will need to send the jpg as an attachment.
It looks like the address you are using is not actually the image file itself. Load the jpg page in IE and then right-click on the image itself and select properties. Take a note of the URL.
If this image is on your network, it's fairly easy. There is a fifth parameter to hs.sendemail which is the absolute path to the file you wish to attach.
You just need to add this to the script i.e. add:
Dim FileAttach As String = "<path and name of image file>"
and the hs.sendemail becomes:
hs.SendEmail(MTo,MFrom,MSubject,MMessage,FileAttach)
You can also use my image utility on my site to grab the image from the URL. You just need to save the image somewhere and adjust the path for the file attachment accordingly.
Leave a comment:
-
Hi Jon,
I used portions of your above code for something similar I am trying to do.
I have a motion sensor trigger my house cam to take a jpg snapshot and assign it to a device F3. I can view the image just fine.
I am trying to create an event to email the snapshot but all I get in email body is HTML.
10.17.0.4:81/snapshot.htm.jpg is the link I assign to device F3
Is there anyway for me to attach to email as a jpg?
Thanks,
Will
Leave a comment:
-
Script and plugin writers can add as many buttons as they like to a virtual device but they will not appear necessarily in the drop down menu.
Your best bet would be to ask for help in the RFXCOM forum as it is a plugin issue. The script I provided will only send you one email if the failure message stays the same.
Leave a comment:
-
Yep
And i have an idea, after trigerring the event, i'd like it to clear ... : just to receive 1 mail and that's all.
But has you can see : there is a button to clear the message, but in the action, it'is impossible to have this button, it's normal ?
Really strange, and at final i don't know how to clear the message.
Any idea ?
it's strange, i'm the first to have this kind of problems ?
Leave a comment:
-
Thanks a lot Jon00
It works great ...
I create a second one for the sensor display too !
Tested with actual words "messages" and put Failure back.
Happy
Leave a comment:
-
Try the attached script. Copy it and name it something like alarmfail.vb and place it in your scripts directory.
Create a recurring event every 1-5 minutes (or whatever you want) to run the script.
Change the email details to suit. It will only send the email once each time the failure message appears.
It should work but depends if the device details can be extracted correctly using the devicestring method.
PHP Code:Imports System.Text
Imports System.Text.RegularExpressions
Sub Main(ByVal Parms as Object)
hs.CreateVar("APMessages")
Dim MyDevice As String
Dim MTo As String = "MailTo@123.com"
Dim MFrom As String = "MailFrom@456.com"
Dim MSubject As String = "Alarm Panel Failure"
MyDevice = stripHTML(hs.devicestring("[3"))
Dim MMessage As String = "Homeseer Alert" & vbcrlf & vbcrlf & MyDevice
If Instr(1,MyDevice,"failure",1) > 0 and hs.GetVar("APMessages") <> MyDevice then
hs.SaveVar("APMessages",MyDevice)
hs.SendEmail(MTo,MFrom,MSubject,MMessage)
end if
End Sub
Function stripHTML(byVal MyDevice)
Dim re As New RegEx( "<(.|\n)+?>" )
stripHTML = re.Replace( MyDevice,"")
End Function
Leave a comment:
-
I have ultralog running ...
And it's easy to check if there was a "failure" word in it.
The problem is i don't found any failure message only for one thing, but nothing linked with the alarm display od device communication failure ...
It's for that i'm trying to check directly the device ALARM DISPLAY and sending the sending the message with your script ...
i haven't better idea.
Leave a comment:
-
Originally posted by nslmanu View PostThanks a lot, i'm actually testing it ... but i have seen a problem :
I can't trigger these devices because : they don't exist in the trigger devices list.
the only things i have are State and status. Nothing else.
I don't know how to check them ...
Have you got an idea or i miss something in your mail ?
Thanks a lot for all.
Regards
Manu
The idea I had was to pull the device string out, examine it for the word 'failure' and then do whatever you require it to (send an email). It also then emails you with a copy of the device string. It seems to work when I tried it.
I'm afraid RFXCOM is something I know little about so I may not be understanding what you are trying to do...
Leave a comment:
-
Thanks a lot, i'm actually testing it ... but i have seen a problem :
I can't trigger these devices because : they don't exist in the trigger devices list.
the only things i have are State and status. Nothing else.
I don't know how to check them ...
Have you got an idea or i miss something in your mail ?
Thanks a lot for all.
Regards
Manu
Leave a comment:
-
I think i've understood you correctly, you want HS to send an email when that failure mode is detected and then nothing further?
Sub Main()
dim dtext
dim eaddress
dim mail
eaddress = "your.email@email.com"
mail = "HomeSeer has detected the following failure: "
dtext = hs.devicestring("Z18")
hs.writelog "Test", dtext
if instr(lcase(dtext),"failure") > 0 then
hs.writelog "Test", "Failure Detected"
hs.sendemail eaddress, "", "HomeSeer Email", mail & dtext
end if
End Sub
To make this trigger only once may need a bit more code, what does the device string say when it is not suffering with a communications failure? You could disable the event when it detects failure so the event does not retrigger, then perhaps run a second script just before this one that then re-enables the event. Or could store a value in an ini file to say it had already been triggered. Someone may be able to answer an easier way to do it inside a script however...
Leave a comment:
-
Sending emails with content only one time.
Hello,
In fact i don't really from where i need to begin with what i'd like to do :
Sometimes, i've got a communication failure with one of my sensor ...
And i'd like to receive a mail with the content of the message and only one time.
On the screeenshot, i'd like to receive the message in a mail sended just when the message arrived.
Do you think it's difficult to include the message in the mail ? because i don't really know how to do it.
Thanks a lot for any help
Have a nice day
ManuLast edited by nslmanu; October 8, 2009, 05:08 AM.Tags: None
Leave a comment: