Seite 25 von 29

Re: Lösung: Klingel erzeugt Bild von Foscam und sendet per M

Verfasst: 18.10.2016, 09:01
von ichdertyp
Hallo liebe Helfer,

ich habe ein Problem bei den Einstellungen der Mail-Benachrichtigung bei "Klingel".
Lustigerweise hat es zwischendurch geklappt, da kam die Mail aber mit einiger verzögerung bei mir an. Die Snapshot Datei im tmp Ordner hat aber nur 135 kb. Als ich dann unterwegs freudig auf meine 1. Nachricht eines Klinglers wartete kam zwar die nebenher programmierte Pushnachricht, eine Mail kam aber leider nicht :(

Meine Cam ist eine Hikvision, daher die komische URL..

Das Skript:

Code: Alles auswählen

dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State("cd /usr/local/addons/sendCamShot/ && tclsh sendCamShot.tcl");


Das tcl:

Code: Alles auswählen

package require base64

set SNAPSHOT_URL "http://benutzer:passwort@192.168.xxxxx:80/Streaming/Channels/1/picture"
set EMAIL_SUBJECT "Es hat geklingelt"
set EMAIL_BODY "Diese Person hat geklingelt:"
set SEND_TO "meine adresse"
set SEND_FROM "sende-adresse"
set SMTP_HOST „host“
set SMTP_USER "benutzer"
set SMTP_PASSWD "passwort"
set SMTP_DOMAIN "sende-adresse nach dem @"


# DEFINE EMAIL TEMPLATE
set tmpl "To: $SEND_TO
From: $SEND_FROM
Subject: $EMAIL_SUBJECT
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=\"=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk\"

--=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 8bit

$EMAIL_BODY

--=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk
Content-Type: application/octet-stream; name=\"photo.jpg\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=\"photo.jpg\"

{IMGDATA}
--=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk--"
                                    
                                                             
# DOWNLOAD THE SNAPSHOT                                      
exec wget -q -O /tmp/snapshot.jpg $SNAPSHOT_URL                                                        
                                                             
# READ SNAPSHOT INTO VARIABLE & BASE64 ENCODE                                                          
set fp [open "/tmp/snapshot.jpg" r]                                                                    
fconfigure $fp -translation binary                                                                     
set imgdata [read $fp]                                                                                 
set encodeddata [::base64::encode $imgdata]                     
close $fp                                                    
                                                                
# REPLACE IMG DATA WITH REAL IMAGE DATA                
regsub -all "{IMGDATA}" $tmpl $encodeddata tmpl              
                                                                
# WRITE READY EMAIL TO A TMP FILE                            
set fp [open "/tmp/ready.eml" w]                                
puts $fp $tmpl                                                  
close $fp                                                    
                                                       
set config "                                                    
defaults                                               
tls on                                                          
tls_certcheck off                                               
logfile /var/log/email.log                                      
account provider                                                
host $SMTP_HOST                                
from $SEND_FROM                                
domain $SMTP_DOMAIN                            
auth login                                     
user $SMTP_USER
password $SMTP_PASSWD                                           
account default: provider                                    
"                                                               
                                                                
set fp [open "/tmp/msmtp.conf" w]                            
puts $fp $config                                       
close $fp                                                       
                                                       
exec chmod 0600 /tmp/msmtp.conf                                 
                                                                
# SEND EMAIL USING MSMTP                                        
exec cat /tmp/ready.eml | msmtp -C /tmp/msmtp.conf $SEND_TO     
                                               
# CLEAN UP                                     
exec rm -f /tmp/msmtp.conf                                 
exec rm -f /tmp/ready.eml                      
exec rm -f /tmp/snapshot.jpg


kann mir jemand helfen? Danke im Voraus :)

IchDerTyp

Re: Lösung: Klingel erzeugt Bild von Foscam und sendet per M

Verfasst: 18.10.2016, 10:31
von alchy
Mit deiner Erlaubnis lösche ich dann deine Frage im falschen Thread, und antworte dir hier mit einem Link auf eine Frage, die du dort gestellt hattest.
ichdertyp hat geschrieben: Nun zur tcl: wo finde ich die Kommandozeile? In Filezilla kann ich keine finden :?
Lies mal >> H I E R <<

Alchy

Re: Lösung: Klingel erzeugt Bild von Foscam und sendet per M

Verfasst: 18.10.2016, 21:10
von ichdertyp
Hey Alchy,

nach einiger Suche und rumprobieren habe ich es nun glaube ich geschafft 8)
Danke für den Schubsen, wieder was gelernt :idea:

Code: Alles auswählen

root@192.168.xxx.xx's password: 
# cd:
-sh: cd:: not found
# cd /usr/local/addons/sendCamShot/
# tclsh sendCamShot.tcl
msmtp: cannot locate host „xyz“: Name or service not known
msmtp: could not send mail (account default from /tmp/msmtp.conf)
    while executing
"exec cat /tmp/ready.eml | msmtp -C /tmp/msmtp.conf $SEND_TO     "
    (file "sendCamShot.tcl" line 76)
# cd /usr/local/addons/sendCamShot/
# tclsh sendCamShot.tcl
msmtp: cannot locate host „smtp.uvw.com“: Name or service not known
msmtp: could not send mail (account default from /tmp/msmtp.conf)
    while executing
"exec cat /tmp/ready.eml | msmtp -C /tmp/msmtp.conf $SEND_TO     "
    (file "sendCamShot.tcl" line 76)
# 
Ich habe - nachdem ich dachte die Fehlermeldung kapiert zu haben - alle mir bekannten und funktionierenden Versionen des smtp-Servers ausprobiert... mmh

hab ich was übersehen?

Re: Lösung: Klingel erzeugt Bild von Foscam und sendet per M

Verfasst: 18.10.2016, 21:44
von alchy
Als erstes würde ich mal die Zeile

Code: Alles auswählen

set SMTP_HOST „host“
ändern

in

Code: Alles auswählen

set SMTP_HOST "host"
Und du darfst ruhig ein paar Daten drin lassen, wenn du sie hier postest.
Es reicht doch wohl völlig, wenn du deinen mail Account aus'x't
ala z.B. XXX@gmx.de und das Passwort z.B.
Dann könnte man vielleicht auch Rückschlüsse auf spezielle Probleme der Provider ziehen. :wink:

Alchy

Re: Lösung: Klingel erzeugt Bild von Foscam und sendet per M

Verfasst: 18.10.2016, 21:48
von ichdertyp
Das war's... Danke!

Lag wohl am falschen Editor?

Alchy = Guter Mann!

Re: Lösung: Klingel erzeugt Bild von Foscam und sendet per M

Verfasst: 18.10.2016, 21:52
von alchy
ichdertyp hat geschrieben: Das war's... Danke!
Lag wohl am falschen Editor?
w.z.b.w - :mrgreen: keine Ahnung wie du das da reingekriegt hast.
Sieht man mal wie wichtig es ist, wenn die User Fehlermeldungen posten.
O.K hätte ich auch vorher sehen können, aber dann hättest du ja nichts gelernt. :wink:
ichdertyp hat geschrieben:Alchy = Guter Mann!
Na das sehen aber andere gaaaaanz anders. :roll:

Danke für die Rückmeldung.

Alchy

Re: Lösung: Klingel erzeugt Bild von Foscam und sendet per M

Verfasst: 08.11.2016, 08:45
von Martin_BY
Hallo zusammen!

Kann in das Script eine Verzögerung eingebaut werden? Wenn ich 2 Bilder der gleichen Kamera im Abstand von x Sekunden haben möchte, wäre das hilfreich.
Wer kann mir mit dem entsprechenden Befehl helfen?

Danke!

Plötzlich Fehler bei email Versand ???

Verfasst: 15.11.2016, 14:52
von ralalla
Ich lasse mir mit einem Programm bei Bewegung ein Bild der Webcam als email zusenden.

Das ganze hat bis vor kurzem funktioniert.
Nun bekomme ich folgende Fehlermeldung im email Log:

Code: Alles auswählen

Nov 15 14:38:18 host=smtp.strato.de tls=on auth=on user=xxx@xxx.de from=xxx@xxx.de recipients=xxx@xxx.de errormsg='cannot connect to smtp.strato.de, port 25: Network is unreachable' exitcode=EX_TEMPFAIL
Das hier ist der Scriptbefehl der mit einer kleinen Verzögerung nach einer Bewegung ausgeführt wird:

Code: Alles auswählen

dom.GetObject("CUxD.CUX2801001:2.CMD_EXEC").State("cd /usr/local/addons/sendCamShot/ && tclsh sendCamShot.tcl");
in der o.g Datei steht folgender Inhalt:

Code: Alles auswählen

package require base64

set SNAPSHOT_URL "http://192.168.178.200/addons/cuxd/index.ccc?file=%2ftmp%2fsnapshots%2fCUX9104006%2fCUX9104006_000.jpg"
set EMAIL_SUBJECT "Bewegung Haustür"
set EMAIL_BODY "siehe Anhang"
set SEND_TO "xxx@xxx.de"
set SEND_FROM "xxx@xxx.de"
set SMTP_HOST "smtp.strato.de"
set SMTP_USER "xxx@xxx.de"
set SMTP_PASSWD "xxx"
set SMTP_DOMAIN "smtp.strato.de"


# DEFINE EMAIL TEMPLATE
set tmpl "To: $SEND_TO
From: $SEND_FROM
Subject: $EMAIL_SUBJECT
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=\"=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk\"

--=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 8bit

$EMAIL_BODY

--=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk
Content-Type: application/octet-stream; name=\"photo.jpg\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=\"photo.jpg\"

{IMGDATA}
--=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk--"
                                    
                                                             
# DOWNLOAD THE SNAPSHOT                                      
exec wget -q -O /tmp/snapshot.jpg $SNAPSHOT_URL                                                        
                                                             
# READ SNAPSHOT INTO VARIABLE & BASE64 ENCODE                                                          
set fp [open "/tmp/snapshot.jpg" r]                                                                    
fconfigure $fp -translation binary                                                                     
set imgdata [read $fp]                                                                                 
set encodeddata [::base64::encode $imgdata]                     
close $fp                                                    
                                                                
# REPLACE IMG DATA WITH REAL IMAGE DATA                
regsub -all "{IMGDATA}" $tmpl $encodeddata tmpl              
                                                                
# WRITE READY EMAIL TO A TMP FILE                            
set fp [open "/tmp/ready.eml" w]                                
puts $fp $tmpl                                                  
close $fp                                                    
                                                       
set config "                                                    
defaults                                               
tls on                                                          
tls_certcheck off                                               
logfile /var/log/email.log                                      
account provider                                                
host $SMTP_HOST                                
from $SEND_FROM                                
domain $SMTP_DOMAIN                            
auth login                                     
user $SMTP_USER
password $SMTP_PASSWD                                           
account default: provider                                    
"                                                               
                                                                
set fp [open "/tmp/msmtp.conf" w]                            
puts $fp $config                                       
close $fp                                                       
                                                       
exec chmod 0600 /tmp/msmtp.conf                                 
                                                                
# SEND EMAIL USING MSMTP                                        
exec cat /tmp/ready.eml | msmtp -C /tmp/msmtp.conf $SEND_TO     
                                               
# CLEAN UP                                     
exec rm -f /tmp/msmtp.conf                                 
exec rm -f /tmp/ready.eml                      
exec rm -f /tmp/snapshot.jpg
Wie schon geschrieben hat das bis vor ca. 1 Woche funktioniert, email aus HP über die CCU funktionieren noch.
Auch eine Testmail über die email Erweiterung funktioniert.
Jemand eine Idee was das sein kann ???

Re: Plötzlich Fehler bei email Versand ???

Verfasst: 15.11.2016, 15:15
von alchy
Warum suchst du dir nicht den Thread, wo es um dieses Script geht, und hängst dich dort dran?

EDIT hab ich mal für dich erledigt.


Was sagt dir die Meldung

Code: Alles auswählen

cannot connect to smtp.strato.de
?

PS:Google bietet auch einen Translator.

Prüfen ob die >> CCU ins Netz<< kommt, da du anderweitig Emails verschicken kannst, wird es vielleicht mit dem 2.Teil der Fehlermeldung

Code: Alles auswählen

port 25
zu tun haben. Bietet strato noch einen Versand über #25?

Alchy

Email Versand über CCU2, Fehler ohne Änderung am Programm

Verfasst: 15.11.2016, 15:42
von ralalla
Auch dieser Versuch wurde hier hin verschoben.


Bis vor einer Woche hat der email Versand mit einem Script immer funktioniert.
Dieses hat mir ein Bild bei Bewegung an der Haustür zugesendet.

Nun nicht mehr, es erscheint eine Fehlermeldung im email Log:

Code: Alles auswählen

Nov 15 15:04:43 host=smtp.strato.de tls=on auth=on user=xxx@xxx.de from=xxx@xxx.de recipients=xxx@xxx.de errormsg='cannot connect to smtp.strato.de, port 25: Network is unreachable' exitcode=EX_TEMPFAIL
An Programmen wurde nichts geändert, alles so wie als es noch funktionierte.

Aufgerufen wird folgendes Script:

Code: Alles auswählen

package require base64

set SNAPSHOT_URL "http://192.168.xxx.xxx/addons/cuxd/index.ccc?file=%2ftmp%2fsnapshots%2fCUX9104006%2fCUX9104006_000.jpg"
set EMAIL_SUBJECT "Bewegung Haustür"
set EMAIL_BODY "siehe Anhang"
set SEND_TO "xxx@xxx.de"
set SEND_FROM "xxx@xxx.de"
set SMTP_HOST "smtp.strato.de"
set SMTP_USER "xxx@xxx.de"
set SMTP_PASSWD "xxxxxxxxxx"
set SMTP_DOMAIN "smtp.strato.de"


# DEFINE EMAIL TEMPLATE
set tmpl "To: $SEND_TO
From: $SEND_FROM
Subject: $EMAIL_SUBJECT
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=\"=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk\"

--=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 8bit

$EMAIL_BODY

--=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk
Content-Type: application/octet-stream; name=\"photo.jpg\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=\"photo.jpg\"

{IMGDATA}
--=_542bc72c.5lV8m7jWYOrj//k2cdijZPr9Fjy8v4J0l/m4onTDRLUmUDMk--"
                                    
                                                             
# DOWNLOAD THE SNAPSHOT                                      
exec wget -q -O /tmp/snapshot.jpg $SNAPSHOT_URL                                                        
                                                             
# READ SNAPSHOT INTO VARIABLE & BASE64 ENCODE                                                          
set fp [open "/tmp/snapshot.jpg" r]                                                                    
fconfigure $fp -translation binary                                                                     
set imgdata [read $fp]                                                                                 
set encodeddata [::base64::encode $imgdata]                     
close $fp                                                    
                                                                
# REPLACE IMG DATA WITH REAL IMAGE DATA                
regsub -all "{IMGDATA}" $tmpl $encodeddata tmpl              
                                                                
# WRITE READY EMAIL TO A TMP FILE                            
set fp [open "/tmp/ready.eml" w]                                
puts $fp $tmpl                                                  
close $fp                                                    
                                                       
set config "                                                    
defaults                                               
tls on                                                          
tls_certcheck off                                               
logfile /var/log/email.log                                      
account provider                                                
host $SMTP_HOST                                
from $SEND_FROM                                
domain $SMTP_DOMAIN                            
auth login                                     
user $SMTP_USER
password $SMTP_PASSWD                                           
account default: provider                                    
"                                                               
                                                                
set fp [open "/tmp/msmtp.conf" w]                            
puts $fp $config                                       
close $fp                                                       
                                                       
exec chmod 0600 /tmp/msmtp.conf                                 
                                                                
# SEND EMAIL USING MSMTP                                        
exec cat /tmp/ready.eml | msmtp -C /tmp/msmtp.conf $SEND_TO     
                                               
# CLEAN UP                                     
exec rm -f /tmp/msmtp.conf                                 
exec rm -f /tmp/ready.eml                      
exec rm -f /tmp/snapshot.jpg
Jemand eine Idee woran das liegen könnte ?
Versendet wird, wie zu sehen über Strato, ist dort vielleicht etwas geändert worden und jemand hat eine Info darüber ?
Emailversand aus einem HP Programm auf der CCU funktioniert ohne Fehler.