The e-mail is triggered as soon as someone rings the doorbell and nobody’s home.
With the image included, I can immediately see who was at the door, which also works on phones, etc.
Usually, I then delete these e-mails quickly. So this is not a storage application.
The e-mail is triggered as soon as someone rings the doorbell and nobody’s
home.
yes I got that.
With the image included, I can immediately see who was at the door, which
also works on phones, etc.
I don’t understand why dropbox could not work with phones, I get dropbox
sync all the time with my phone too.
Usually, I then delete these e-mails quickly. So this is not a storage
application.
i’ll rephrase, e-mail is not optimized for sending files
yes it’ used a lot to send files,I do think it’s pretty bad at it…
The reason most peel do this, is that we don’t know what the software is
the other parties are supporting, in this case you are in control of both
sides (as it’s both you)
The code for Udo works fine when I use one Foscam camera. I would like to attach pictures from 2 cameras into a mail. I tried to modified the code, but it only send the picture from the first camera. What is wrong?
The rule seems to allways be executed twice (two mails/notification are sent), about 1 minute apart. How can this be?
rule "DoorBell"
when
Item DEVICEBell3_Switch changed from OFF to ON
then
{
var FrontDoorCam = "FrontDoor"+ now.toString ("HH-mm_dd-MM-yyyy") +".jpg"
var FrontDoorCam2 = "FrontDoor2"+ now.toString ("HH-mm_dd-MM-yyyy") +".jpg"
var doorbellmessage = "Det ringde på dörren kl. "+ now.toString ("HH:mm dd-MM-yyyy") // +"\nMvH Patrik"
sendBroadcastNotification(doorbellmessage)
executeCommandLine("wget http://192.168.2.10:88/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=YYYY&pwd=XXXX -O /tmp/" +FrontDoorCam)
Thread::sleep(8000)
executeCommandLine("wget http://192.168.2.11:88/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=YYYY&pwd=XXXX -O /tmp/" +FrontDoorCam2)
Thread::sleep(8000)
sendMail("hotmail@hotmail.com", "Någon Ringer på Dörren", doorbellmessage, "file:///tmp/" +FrontDoorCam, "file:///tmp/" +FrontDoorCam2)
Thread::sleep(60000)
DEVICEBell3_Switch.sendCommand(OFF)
}
end
end
I managed to get this working for my hikvision camera, but without the ending ,5 in the executeCommandLine
The next step is to delete old images (older then x days)
@patrikpatrik2
to send to attachments you need to put the locations of the images to an UrlList
val List attachmentUrlList = newArrayList(
“file:///tmp/” + FrontDoorCam,
“file:///tmp/” + FrontDoorCam2)
and don’t forget to add import java.util.List at the beginning of your rule
edit:
hmm strange, it’s not deteling anything, even with "rm /tmp/FrontDoor*.jpg"
I suppose a access right issue, but I tried already with giving all files 777 permissions, and it’s still not ok. All jpg’s have openhab-user as owner
when I run my command from a ssh session (openhabian user), it’s working fine.
If I understand well, everything is runned by the openhab user ?
When I log on to the terminal, I’m openhabian user. I tried to switch to openhab user with su - openhab, but I receive an authentication error.
[11:34:54] openhabian@openHABianPi:/tmp$ id -G -n openhab
openhab tty dialout gpio
[11:35:15] openhabian@openHABianPi:/tmp$ id -G -n openhabian
openhabian adm tty dialout cdrom sudo audio video plugdev games users input netdev spi i2c gpio openhab
When executing my full command from openhabian user
Question - does this work through Hikvision NVR’s or are you all referencing the cameras IP address direct? I have all 4 of my hikvision cameras connected direct to the NVR, the other NVR port has the IP for camera management to login too. I can’t reference the cameras IP’s directly as the NVR doesn’t act as a router.
Managed to get this to work with a Hikvision NVR, simply go into the admin GUI, then Configuration, Network, Advanced Settings, Other. Then tick ‘Enable Virtual Host’. Go back to Configuration, System, Camera Management, and there is a “Connect” column for each camera - it effectively NAT’s the NVR LAN mgmt IP with a specific port through to each IP camera, so now I can access each of my cameras via the NVR, by specifying:
jwiseman
(Mr. Wiseman (OH 4.3.0 Snapshot on Pi4))
33
Here’s what is working for me . . .
rule “Front Door Camera Sees Motion”
when
Item HIKFrontDoorMotion changed
then
if (HIKFrontDoorMotion.state == ON) {
logWarn("HIK Motion", "** HIK Front Door Motion Detected **")
val string FrontDoorCam = "FrontDoor"+ now.toString ("HH-mm_dd-MM-yyyy") +".jpg"
Thread::sleep(4000) // 4 second wait
executeCommandLine("wget http://xxx:xxx@192.168.0.11:81/ISAPI/Streaming/channels/101/picture -O /tmp/" +FrontDoorCam)
Thread::sleep(8000) // give OH time to download picture
// send an email
var toemailfrontmotion = "xxxxxx@gmail.com"
var subjectemailfrontmotion = "OpenHAB - HIK Motion Detected at Front Door"
var bodyemailfrontmotion = "OpenHAB - HIK Motion Detected at Front Door."
val URLfrontmotion = "file:///tmp/" + FrontDoorCam
sendMail(toemailfrontmotion, subjectemailfrontmotion, bodyemailfrontmotion, URLfrontmotion)
Thread::sleep(2000) // 2 second wait
toemailfrontmotion = ""
subjectemailfrontmotion = ""
bodyemailfrontmotion = ""
executeCommandLine("rm /tmp/FrontDoor*.jpg") // delete image file
Thread::sleep(240000) // 4 min wait for motion to clear so no excessive emails
}
I updated today to the release version of 2.5
And then I get a warning on this code
Validation issues found in configuration model ‘camera.rules’, using it anyway:
List is a raw type. References to generic type List should be parameterized