From abe77cd44eea4f20b062d645bbce9e26cd22ac0e Mon Sep 17 00:00:00 2001 From: borisneubert Date: Sun, 12 Mar 2017 14:24:36 +0000 Subject: [PATCH] 98_template: new FHEM command template git-svn-id: https://svn.fhem.de/fhem/trunk@13683 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/98_template.pm | 218 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 219 insertions(+) create mode 100644 fhem/FHEM/98_template.pm diff --git a/fhem/CHANGED b/fhem/CHANGED index 879e55150..19f521cbc 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - feature: 98_template: new FHEM command template - feature: 70_MEDIAPORTAL: Plugins can be retreived and changed to - update: 00_SONOS: New version, see Wiki- or File-Changelog - update: 88_HMCCU: Code optimized. Fixed Windows process ID bug. diff --git a/fhem/FHEM/98_template.pm b/fhem/FHEM/98_template.pm new file mode 100644 index 000000000..9d2a91846 --- /dev/null +++ b/fhem/FHEM/98_template.pm @@ -0,0 +1,218 @@ +# $Id$ + +package main; +use strict; +use warnings; + +sub template_Initialize($$) { + + $cmds{template} = + { Fn=>"CommandTemplate", + Hlp=>"[use] [= [= [...]]],use a template" }; +} + +sub EvaluateTemplate($$) { + my ($filename, $args)= @_; + + # load template from file + my @result; + if(open(TEMPLATE, $filename)) { + @result=