Page 1 sur 2
Snapshot caméra dans un même mail ?
Publié : 15 janv. 2019, 10:30
par titis14
Bonjour,
J'ai ajouté mes 6 caméras sur Domoticz, et dans un événement blocky je veux recevoir un snapshot de celles-ci mais c'est un mail par caméra soit 6 mails, et t'il possible de les regrouper pour avoir les 6 captures dans un seul mail ?
Merci
Re: Snapshot caméra dan un même mail ?
Publié : 15 janv. 2019, 12:06
par cyberbob
C'est vrais que ce serais pratique
De base non, ce n'est pas possible : 1 photo par cam et par mail
Maintenant, il y a surement moyen de le faire en script Lua, si quelqu'un a une idée, merci.
Re: Snapshot caméra dans un même mail ?
Publié : 15 janv. 2019, 20:29
par titis14
Oui si quelqu'un à une base

car perso les scripts je suis pas très bon en codage.
Merci
Re: Snapshot caméra dans un même mail ?
Publié : 15 janv. 2019, 20:45
par Neutrino
titis14 a écrit : 15 janv. 2019, 20:29
Oui si quelqu'un à une base

car perso les scripts je suis pas très bon en codage.
Merci
Le script DZvents suivant envoie un mail avec la liste des PIRs et 3 photos en PJ récupérées sur MotionEye.
Code : Tout sélectionner
return {
active = true,
on = {
devices =
{'Alarme'},
},
execute = function(domoticz,alarme)
if alarme.state == 'On' then
domoticz.log("Activation de l'alarme", LOG_INFO)
pirs = ""
domoticz.devices().forEach(function(device)
if (string.find(device.name,"PIR") or string.find(device.name,"REED")) then
pirs = pirs .. device.name.." "..device.state..", \n"
end
end)
domoticz.log("Etat pir "..pirs, LOG_INFO)
os.execute('wget -O "/var/tmp/cam1.jpg" http://192.168.15.1:8765/picture/1/current/')
os.execute('wget -O "/var/tmp/cam2.jpg" http://192.168.15.1:8765/picture/2/current/')
os.execute('wget -O "/var/tmp/cam3.jpg" http://192.168.15.1:8765/picture/3/current/')
os.execute('(echo '..pirs..' && uuencode /var/tmp/cam1.jpg cam1.jpg && uuencode /var/tmp/cam2.jpg cam2.jpg && uuencode /var/tmp/cam3.jpg cam3.jpg )| mail -s "ALARME" "monadresse@caramail.com" &')
else
domoticz.log("Désactivation de l'alarme", LOG_INFO)
end
end
}
Pensez à installer uuencode pour que ça marche.
Si ça peut vous aider

Re: Snapshot caméra dans un même mail ?
Publié : 16 janv. 2019, 10:21
par titis14
Merci, je vais regarder ça, on a maintenant une base.
Re: Snapshot caméra dans un même mail ?
Publié : 28 janv. 2019, 10:02
par titis14
Bonjour,
Je me suis remis sur ça, j'ai bien mis le script et activé mon Device Alarme, dans les logs tout à l'air bon, mais je n'ai pas reçu le mail avec les photos.
J'ai bien installer uuencode qui s’installe par sharutils.
Voici les logs et script si vous avez une idée merci.
Code : Tout sélectionner
2019-01-28 09:50:29.190 OpenZWave: Domoticz has send a Switch command! NodeID: 2 (0x02)
2019-01-28 09:50:29.197 (OpenZwave) Light/Switch (Alarme)
2019-01-28 09:50:29.190 Status: User: sebr initiated a switch command (125/Alarme/On)
2019-01-28 09:50:29.259 Status: dzVents: Info: Handling events for: "Alarme", value: "On"
2019-01-28 09:50:29.259 Status: dzVents: Info: ------ Start internal script: Alarme_cam: Device: "Alarme (OpenZwave)", Index: 125
2019-01-28 09:50:29.259 Status: dzVents: Info: Activation de l'alarme
2019-01-28 09:50:29.271 Status: dzVents: Info: Etat pir
2019-01-28 09:50:31.449 Status: dzVents: Info: ------ Finished Alarme_cam
2019-01-28 09:50:41.049 OpenZWave: Domoticz has send a Switch command! NodeID: 2 (0x02)
2019-01-28 09:50:41.056 (OpenZwave) Light/Switch (Alarme)
2019-01-28 09:50:41.048 Status: User: sebr initiated a switch command (125/Alarme/Off)
2019-01-28 09:50:41.119 Status: dzVents: Info: Handling events for: "Alarme", value: "Off"
2019-01-28 09:50:41.119 Status: dzVents: Info: ------ Start internal script: Alarme_cam: Device: "Alarme (OpenZwave)", Index: 125
2019-01-28 09:50:41.119 Status: dzVents: Info: Désactivation de l'alarme
2019-01-28 09:50:41.119 Status: dzVents: Info: ------ Finished Alarme_cam
return {
active = true,
on = {
devices =
{'Alarme'},
},
execute = function(domoticz,alarme)
if alarme.state == 'On' then
domoticz.log("Activation de l'alarme", LOG_INFO)
pirs = ""
domoticz.devices().forEach(function(device)
if (string.find(device.name,"PIR") or string.find(device.name,"REED")) then
pirs = pirs .. device.name.." "..device.state..", \n"
end
end)
domoticz.log("Etat pir "..pirs, LOG_INFO)
os.execute('wget -O "/var/tmp/cam1.jpg"
http://192.168.1.24:80/jpg/image.jpg')
os.execute('wget -O "/var/tmp/cam2.jpg"
http://192.168.1.25:80/jpg/image.jpg')
os.execute('(echo '..pirs..' && uuencode /var/tmp/cam1.jpg cam1.jpg && uuencode /var/tmp/cam2.jpg cam2.jpg )| mail -s "ALARME" "
mail@outlook.com" &')
else
domoticz.log("Désactivation de l'alarme", LOG_INFO)
end
end
}
Re: Snapshot caméra dans un même mail ?
Publié : 28 janv. 2019, 10:21
par Neutrino
Re: Snapshot caméra dans un même mail ?
Publié : 28 janv. 2019, 14:10
par titis14
Merci à toi je vais tester cela.
Re: Snapshot caméra dans un même mail ?
Publié : 28 janv. 2019, 14:19
par titis14
Le fichier de config à changé, je ne peux pas entrer les identifiants pour l'authentification.
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=ssl0.ovh.net:465
# Where will the mail seem to come from?
#rewriteDomain=
# The full hostname
hostname=debian
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
#FromLineOverride=YES
Si je veux installe mailx apparement il faut choisir entre 3 paquets
user@debian:~$ sudo apt-get install mailx
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Package mailx is a virtual package provided by:
mailutils 1:2.99.98-2
heirloom-mailx 12.5-4
bsd-mailx 8.1.2-0.20141216cvs-2
You should explicitly select one to install.
Re: Snapshot caméra dans un même mail ?
Publié : 28 janv. 2019, 15:35
par titis14
C'est bon j'ai réussi, j'ai ajouté les infos à la main.
Quand je reçois le mail l'expéditeur c'est "root" on peux changer ça ?
j'ai regardé dans les fichiers de config on peux autoriser le changement, du coup dans le script j'ai trouvé ceux-ci pour ajouter from
5. Specify From name and address
To specify a "FROM" name and address, use the "-r" option. The name should be followed by the address wrapped in "<>".
$ echo "This is message body" | mail -s "This is Subject" -r "Harry<
harry@gmail.com>"
someone@example.com
Mais quand j'ajoute l'option -r ça ne fonctionne plus.
Merci