2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 07:24:21 +00:00

32_yowsup.pm: added home attribute

git-svn-id: https://svn.fhem.de/fhem/trunk@8774 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2015-06-18 21:06:35 +00:00
parent d26d7ffc16
commit f8b37ff948
2 changed files with 16 additions and 1 deletions

View File

@ -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 { '' => <default> }

View File

@ -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($$$)
<li>cmd<br>
complette commandline to start the yowsup cli client<br>
eg: attr WhatsApp cmd /opt/local/bin/yowsup-cli demos -c /root/config.yowsup --yowsup</li>
<li>home<br>
set $HOME for the started yowsup process<br>
PWD -> set to $PWD<br>
anything else -> use as $HOME</li>
<li>accept_from<br>
comma separated list of contacts (numbers) from which messages will be accepted</li>
<li>commandPrefix<br>
not set -> don't accept commands<br>
0 -> don't accept commands<br>
1 -> allow commands, every message is interpreted as a fhem command<br>
anything else -> if the message starts with this prefix then everything after the prefix is taken as the command</li>
<li>allowedCommands<br>
A comma separated list of commands that are allowed from this contact.<br>
If set to an empty list <code>, (i.e. comma only)</code> no commands are accepted.<br>