From f8b37ff948ddb252dabf654aaaa374990f335a66 Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Thu, 18 Jun 2015 21:06:35 +0000 Subject: [PATCH] 32_yowsup.pm: added home attribute git-svn-id: https://svn.fhem.de/fhem/trunk@8774 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/32_yowsup.pm | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 3cb8f172d..5042879be 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: 32_yowsup.pm: added home attribute - feature: readingsGroup: allow commands for attributes allow calculation with values in the rows and columns allow default mappings with { '' => } diff --git a/fhem/FHEM/32_yowsup.pm b/fhem/FHEM/32_yowsup.pm index dd6660b54..6b6dd9596 100644 --- a/fhem/FHEM/32_yowsup.pm +++ b/fhem/FHEM/32_yowsup.pm @@ -24,7 +24,7 @@ yowsup_Initialize($) #$hash->{GetFn} = "yowsup_Get"; $hash->{AttrFn} = "yowsup_Attr"; $hash->{AttrList} = "disable:1 "; - $hash->{AttrList} .= "acceptFrom cmd ". $readingFnAttributes; + $hash->{AttrList} .= "acceptFrom cmd home ". $readingFnAttributes; } ##################################### @@ -158,6 +158,12 @@ yowsup_Connect($) $ENV{PYTHONUNBUFFERED} = 1; + if( my $home = AttrVal($name, "home", undef ) ) { + $home = $ENV{'PWD'} if( $home eq 'PWD' ); + $ENV{'HOME'} = $home; + Log3 $name, 2, "$name: setting \$HOME to $home"; + } + my $cmd = AttrVal($name, "cmd", "/opt/local/bin/yowsup-cli demos -c /root/config.yowsup --yowsup" ); Log3 $name, 2, "$name: starting yoswup-cli: $cmd"; @@ -528,13 +534,21 @@ yowsup_Attr($$$)
  • cmd
    complette commandline to start the yowsup cli client
    eg: attr WhatsApp cmd /opt/local/bin/yowsup-cli demos -c /root/config.yowsup --yowsup
  • + +
  • home
    + set $HOME for the started yowsup process
    + PWD -> set to $PWD
    + anything else -> use as $HOME
  • +
  • accept_from
    comma separated list of contacts (numbers) from which messages will be accepted
  • +
  • commandPrefix
    not set -> don't accept commands
    0 -> don't accept commands
    1 -> allow commands, every message is interpreted as a fhem command
    anything else -> if the message starts with this prefix then everything after the prefix is taken as the command
  • +
  • allowedCommands
    A comma separated list of commands that are allowed from this contact.
    If set to an empty list , (i.e. comma only) no commands are accepted.