55_InfoPanel.pm: create empty layout on define file if not already existent

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@15708 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2017-12-27 15:01:42 +00:00
parent 8d55842e4b
commit 021f2f8772

View File

@ -260,8 +260,15 @@ sub btIP_readLayout {
my ($err, @layoutfile) = FileRead($filename);
if($err) {
# Log 1, "InfoPanel $name: $err";
# $hash->{fhem}{layout} = "text ERROR 50 50 \"Error on reading layout!\"";
Log 1, "InfoPanel $name: $err";
$hash->{fhem}{layout} = "text ERROR 50 50 \"Error on reading layout!\"";
my ($e,@layout) = FileRead('./FHEM/template.layout');
unless ($e){
FileWrite($filename,@layout);
$hash->{fhem}{layout} = "text ERROR 50 50 \"Please edit layoutfile now.\"";
}
} else {
$hash->{fhem}{layout} = join("\n", @layoutfile);
while($hash->{fhem}{layout} =~ m/\@include/ && $level < 1000) {