mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
Pushsafer: optimized picture file error handling (Forum: #59240)
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@12447 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
08355de7b4
commit
79e47c7cdd
1
CHANGED
1
CHANGED
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- changed: Pushsafer: optimized picture file error handling
|
||||||
- new: 59_Wunderground: new weather module to fetch
|
- new: 59_Wunderground: new weather module to fetch
|
||||||
data from Weather Underground
|
data from Weather Underground
|
||||||
- bugfix: 50_HP1000: correct default unit for windSpeed/windGust from m/s to
|
- bugfix: 50_HP1000: correct default unit for windSpeed/windGust from m/s to
|
||||||
|
@ -203,12 +203,8 @@ sub Pushsafer_createBody($$)
|
|||||||
|
|
||||||
if($key =~/^p\d?$/)
|
if($key =~/^p\d?$/)
|
||||||
{
|
{
|
||||||
if(-r $val)
|
|
||||||
{
|
if($val =~ /^IPCAM:(\S+)$/)
|
||||||
$val = Pushsafer_createDataUrl($hash, $val);
|
|
||||||
next unless(defined($val));
|
|
||||||
}
|
|
||||||
elsif($val =~ /^IPCAM:(\S+)$/)
|
|
||||||
{
|
{
|
||||||
my $ipcam = $1;
|
my $ipcam = $1;
|
||||||
|
|
||||||
@ -218,13 +214,23 @@ sub Pushsafer_createBody($$)
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $path = AttrVal($ipcam, "storage",$attr{global}{modpath}."/www/snapshots");
|
my $path = AttrVal($ipcam, "storage",AttrVal("global", "modpath", ".")."/www/snapshots");
|
||||||
$path .= "/" unless($path =~ m,/$,);
|
$path .= "/" unless($path =~ m,/$,);
|
||||||
$path .= ReadingsVal($ipcam, "last", "");
|
$path .= ReadingsVal($ipcam, "last", "");
|
||||||
|
|
||||||
$val = Pushsafer_createDataUrl($hash, $path);
|
$val = Pushsafer_createDataUrl($hash, $path);
|
||||||
|
next unless(defined($val));
|
||||||
|
}
|
||||||
|
elsif(-e $val)
|
||||||
|
{
|
||||||
|
$val = Pushsafer_createDataUrl($hash, $val);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log3 $name, 3, "Pushsafer ($name) - picture file does not exist: $val - sending message without a picture...";
|
||||||
|
next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
push @urlParts, $key."=".urlEncode($val);
|
push @urlParts, $key."=".urlEncode($val);
|
||||||
@ -269,7 +275,8 @@ sub Pushsafer_createDataUrl($$)
|
|||||||
|
|
||||||
if(defined($err))
|
if(defined($err))
|
||||||
{
|
{
|
||||||
Log3 $name, 3, "Pushsafer ($name) - unable to open image file: $file - sending message without picture...";
|
Log3 $name, 3, "Pushsafer ($name) - unable to open image file $file: $err";
|
||||||
|
Log3 $name, 3, "Pushsafer ($name) - sending message without picture...";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user