mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +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:
parent
1fdbb01599
commit
0e42aec5e8
@ -3,7 +3,7 @@
|
|||||||
# HomeMatic XMLRPC API Device Provider
|
# HomeMatic XMLRPC API Device Provider
|
||||||
# Written by Oliver Wagner <owagner@vapor.com>
|
# Written by Oliver Wagner <owagner@vapor.com>
|
||||||
#
|
#
|
||||||
# V0.1
|
# V0.3
|
||||||
#
|
#
|
||||||
##############################################
|
##############################################
|
||||||
#
|
#
|
||||||
@ -36,6 +36,7 @@ sub HMRPC_Initialize($)
|
|||||||
$hash->{ShutdownFn} = "HMRPC_Shutdown";
|
$hash->{ShutdownFn} = "HMRPC_Shutdown";
|
||||||
$hash->{ReadFn} = "HMRPC_Read";
|
$hash->{ReadFn} = "HMRPC_Read";
|
||||||
$hash->{SetFn} = "HMRPC_Set";
|
$hash->{SetFn} = "HMRPC_Set";
|
||||||
|
$hash->{GetFn} = "HMRPC_Get";
|
||||||
$hash->{Clients} = ":HMDEV:";
|
$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;
|
1;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# HMRPC Device Handler
|
# HMRPC Device Handler
|
||||||
# Written by Oliver Wagner <owagner@vapor.com>
|
# Written by Oliver Wagner <owagner@vapor.com>
|
||||||
#
|
#
|
||||||
# V0.2
|
# V0.3
|
||||||
#
|
#
|
||||||
##############################################
|
##############################################
|
||||||
#
|
#
|
||||||
@ -23,6 +23,7 @@ HMDEV_Initialize($)
|
|||||||
$hash->{DefFn} = "HMDEV_Define";
|
$hash->{DefFn} = "HMDEV_Define";
|
||||||
$hash->{ParseFn} = "HMDEV_Parse";
|
$hash->{ParseFn} = "HMDEV_Parse";
|
||||||
$hash->{SetFn} = "HMDEV_Set";
|
$hash->{SetFn} = "HMDEV_Set";
|
||||||
|
$hash->{GetFn} = "HMDEV_Get";
|
||||||
$hash->{AttrList} = "IODev do_not_notify:0,1";
|
$hash->{AttrList} = "IODev do_not_notify:0,1";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,10 +74,10 @@ HMDEV_Parse($$)
|
|||||||
$hash->{READINGS}{$mp[2]}{TIME}=TimeNow();
|
$hash->{READINGS}{$mp[2]}{TIME}=TimeNow();
|
||||||
# Note that we always trigger a change on PRESS_LONG/PRESS_SHORT events
|
# 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)
|
# (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]";
|
push @changed, "$mp[2]: $mp[3]";
|
||||||
$hash->{READINGS}{$mp[2]}{VAL}=$mp[3];
|
$hash->{READINGS}{$mp[2]}{VAL}=$mp[3];
|
||||||
}
|
}
|
||||||
$hash->{CHANGED}=\@changed;
|
$hash->{CHANGED}=\@changed;
|
||||||
|
|
||||||
@ -90,7 +91,7 @@ HMDEV_Set($@)
|
|||||||
my ($hash, @a) = @_;
|
my ($hash, @a) = @_;
|
||||||
|
|
||||||
return "invalid set call @a" if(@a != 3 && @a != 4);
|
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)
|
if(@a==4)
|
||||||
{
|
{
|
||||||
return HMRPC_Set($hash->{IODev},$hash->{IODev}->{NAME},$hash->{hmaddr},$a[1],$a[2],$a[3]);
|
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;
|
1;
|
||||||
|
@ -2,7 +2,7 @@ HMRPC - xmlrpc-basierte Homematic-Integration fuer fhem
|
|||||||
=======================================================
|
=======================================================
|
||||||
Von Oliver Wagner <owagner@vapor.com>
|
Von Oliver Wagner <owagner@vapor.com>
|
||||||
|
|
||||||
V0.2
|
V0.3
|
||||||
|
|
||||||
Uebersicht
|
Uebersicht
|
||||||
----------
|
----------
|
||||||
@ -90,10 +90,10 @@ zur
|
|||||||
|
|
||||||
set hmw req getDeviceDescription IEQ0208603
|
set hmw req getDeviceDescription IEQ0208603
|
||||||
|
|
||||||
Weitergehende Funktionen wie synchrones Abfragen von Werten oder Paramsets
|
Der get-Aufruf ist ebenfalls implementiert und fuehrt einen synchronen
|
||||||
oder Statii des jeweiligen Service (Meldungen etc.) sind geplant, aber noch
|
"getValue()"-Aufruf durch:
|
||||||
nicht implementiert.
|
|
||||||
|
|
||||||
|
get light_buero_olli STATE
|
||||||
|
|
||||||
Design
|
Design
|
||||||
------
|
------
|
||||||
@ -112,6 +112,13 @@ und daher unnoetige re-inits verursachen. Diese scheinen aber grundsaetzlich kei
|
|||||||
Problem auf der Service-Seite darzustellen.
|
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
|
Anhang
|
||||||
------
|
------
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user