2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 04:36:36 +00:00

V0.3 - get-Methoden implementiert, als Aufruf von XML-RPC getValue()

- bei Boolean-Werten wurde bei false bei jedem event-Empfang
       faelschlicherweise eine Notification ausgeloest


git-svn-id: https://svn.fhem.de/fhem/trunk@1064 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
oliverwagner 2011-10-09 22:37:44 +00:00
parent 1fdbb01599
commit 0e42aec5e8
3 changed files with 45 additions and 10 deletions

View File

@ -3,7 +3,7 @@
# HomeMatic XMLRPC API Device Provider
# Written by Oliver Wagner <owagner@vapor.com>
#
# V0.1
# V0.3
#
##############################################
#
@ -36,6 +36,7 @@ sub HMRPC_Initialize($)
$hash->{ShutdownFn} = "HMRPC_Shutdown";
$hash->{ReadFn} = "HMRPC_Read";
$hash->{SetFn} = "HMRPC_Set";
$hash->{GetFn} = "HMRPC_Get";
$hash->{Clients} = ":HMDEV:";
}
@ -231,4 +232,21 @@ HMRPC_Set($@)
}
}
################################
#
#
sub
HMRPC_Get($@)
{
my ($hash,@a) = @_;
return "argument missing, usage is <id> <attribute> @a" if(@a!=3);
my $ret=$hash->{client}->simple_request("getValue",$a[1],$a[2]);
if(ref($ret))
{
return $ret->{faultCode}.": ".$ret->{faultString};
}
return $ret;
}
1;

View File

@ -2,7 +2,7 @@
# HMRPC Device Handler
# Written by Oliver Wagner <owagner@vapor.com>
#
# V0.2
# V0.3
#
##############################################
#
@ -23,6 +23,7 @@ HMDEV_Initialize($)
$hash->{DefFn} = "HMDEV_Define";
$hash->{ParseFn} = "HMDEV_Parse";
$hash->{SetFn} = "HMDEV_Set";
$hash->{GetFn} = "HMDEV_Get";
$hash->{AttrList} = "IODev do_not_notify:0,1";
}
@ -73,10 +74,10 @@ HMDEV_Parse($$)
$hash->{READINGS}{$mp[2]}{TIME}=TimeNow();
# Note that we always trigger a change on PRESS_LONG/PRESS_SHORT events
# (they are sent whenever a button is presed, and there is no change back)
if(!$currentval || ($currentval ne $mp[3]) || ($currentval =~ m/^PRESS_/))
if(!defined $currentval || ($currentval ne $mp[3]) || ($currentval =~ m/^PRESS_/))
{
push @changed, "$mp[2]: $mp[3]";
$hash->{READINGS}{$mp[2]}{VAL}=$mp[3];
push @changed, "$mp[2]: $mp[3]";
$hash->{READINGS}{$mp[2]}{VAL}=$mp[3];
}
$hash->{CHANGED}=\@changed;
@ -90,7 +91,7 @@ HMDEV_Set($@)
my ($hash, @a) = @_;
return "invalid set call @a" if(@a != 3 && @a != 4);
# We delegate this call to the IODev, after having added the device address
# We delegate this call to the HMRPC IODev, after having added the device address
if(@a==4)
{
return HMRPC_Set($hash->{IODev},$hash->{IODev}->{NAME},$hash->{hmaddr},$a[1],$a[2],$a[3]);
@ -101,5 +102,14 @@ HMDEV_Set($@)
}
}
################################
sub
HMDEV_Get($@)
{
my ($hash, @a) = @_;
return "argument missing, usage is <attribute> @a" if(@a!=2);
# Like set, we simply delegate to the HMPRC IODev here
return HMRPC_Get($hash->{IODev},$hash->{IODev}->{NAME},$hash->{hmaddr},$a[1]);
}
1;

View File

@ -2,7 +2,7 @@ HMRPC - xmlrpc-basierte Homematic-Integration fuer fhem
=======================================================
Von Oliver Wagner <owagner@vapor.com>
V0.2
V0.3
Uebersicht
----------
@ -90,10 +90,10 @@ zur
set hmw req getDeviceDescription IEQ0208603
Weitergehende Funktionen wie synchrones Abfragen von Werten oder Paramsets
oder Statii des jeweiligen Service (Meldungen etc.) sind geplant, aber noch
nicht implementiert.
Der get-Aufruf ist ebenfalls implementiert und fuehrt einen synchronen
"getValue()"-Aufruf durch:
get light_buero_olli STATE
Design
------
@ -112,6 +112,13 @@ und daher unnoetige re-inits verursachen. Diese scheinen aber grundsaetzlich kei
Problem auf der Service-Seite darzustellen.
Aenderungen
-----------
V0.3 - get-Methoden implementiert, als Aufruf von XML-RPC getValue()
- bei Boolean-Werten wurde bei false bei jedem Empfang faelschlicherweise
eine Notification ausgeloest
Anhang
------