mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
83_IOhomecontrol, 84_IOhomecontrolDevice: complete rewrite and extended features
git-svn-id: https://svn.fhem.de/fhem/trunk@16990 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0d82e774bf
commit
c5b22e3702
22
fhem/CHANGED
22
fhem/CHANGED
@ -1,5 +1,7 @@
|
||||
# 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.
|
||||
- change: 83_IOhomecontrol, 84_IOhomecontrolDevice: complete rewrite and
|
||||
extended features
|
||||
- feature: 42_AptToDate: add Attribut upgradeListReading for Reading in JSON
|
||||
- change: 98_DOIFtools: added shortcut remove_DOIFtoolsLog to commandref
|
||||
- change: 01_FHEMWEB.pm: default plotEmbed to 0 (Forum #82351)
|
||||
@ -23,7 +25,7 @@
|
||||
- changed: 14_SD_WS09: standard battery readings
|
||||
- changed: 41_Oregon: standard battery readings
|
||||
- change: 76_SMAInverter: Internal MODEL added
|
||||
- feature: 49_SSCam: V5.3.0, new createStreamDev generic, control elements
|
||||
- feature: 49_SSCam: V5.3.0, new createStreamDev generic, control elements
|
||||
for runView content within fhemweb, some new CamLive-
|
||||
Readings, minor fixes
|
||||
- change: 95_Dashboard: V3.10.1, added FW_hideDisplayName, Forum #88727
|
||||
@ -33,10 +35,10 @@
|
||||
- change: 82_LGTV_WebOS: change part of code
|
||||
- bugfix: 49_SSCam: fix state turns to "off" even though cam is disabled
|
||||
- bugfix: 38_netatmo: fixed camera recording and notification settings
|
||||
- feature: 36_WMBUS: support for WMBUS type C and Kamstrup Multical 21
|
||||
- feature: 36_WMBUS: support for WMBUS type C and Kamstrup Multical 21
|
||||
encoding.
|
||||
ATTENTION: decryption has changed, please install
|
||||
the perl modules Crypt::Mode::CBC and
|
||||
ATTENTION: decryption has changed, please install
|
||||
the perl modules Crypt::Mode::CBC and
|
||||
Crypt::Mode::CTR if you want to decrypt messages.
|
||||
(sudo cpan -i Crypt::Mode::CBC Crypt::Mode::CTR)
|
||||
- change: 93_DbLog: commandref hint for special character usage in passwords
|
||||
@ -58,16 +60,16 @@
|
||||
- feature: 98_Text2Speech: added Duch language for Google TTS
|
||||
- feature: 74_UnifiSwitch: initial version
|
||||
- feature: 74_Unifi: new child-Module UnifiSwitch
|
||||
new reading UC_newClients for new clients
|
||||
block clients by mac-address
|
||||
new reading UC_newClients for new clients
|
||||
block clients by mac-address
|
||||
- change: 98_dewpoint: new attribute legacyStateHandling
|
||||
- feature: 93_DbRep: V7.18.0, possible use of y:(\d) in timeDiffToNow,
|
||||
- feature: 93_DbRep: V7.18.0, possible use of y:(\d) in timeDiffToNow,
|
||||
timeOlderThan, delEntries considers executeBeforeDump,
|
||||
executeAfterDump, minor fixes
|
||||
- feature: 49_SSCam: PTZ-Panel integrated into created StreamDevice
|
||||
- fixed: 74_Unifi: import encode_json for newest libs
|
||||
- change: 10_KNX: new major release. See commandref for details. The
|
||||
following attributes are deprecated now: readonly,
|
||||
- fixed: 74_Unifi: import encode_json for newest libs
|
||||
- change: 10_KNX: new major release. See commandref for details. The
|
||||
following attributes are deprecated now: readonly,
|
||||
listenonly, slider and useSetExtensions.
|
||||
- change: 36_WMBUS: standard battery readings
|
||||
- change: 32_withings/38_netatmo/72_XiaomiDevice: standard battery readings
|
||||
|
File diff suppressed because it is too large
Load Diff
210
fhem/FHEM/84_IOhomecontrolDevice.pm
Normal file
210
fhem/FHEM/84_IOhomecontrolDevice.pm
Normal file
@ -0,0 +1,210 @@
|
||||
# $Id$
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# 84_IOhomecontrolDevice.pm
|
||||
# Copyright by Dr. Boris Neubert
|
||||
# e-mail: omega at online dot de
|
||||
#
|
||||
# This file is part of fhem.
|
||||
#
|
||||
# Fhem is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Fhem is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with fhem. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
package main;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub IOhomecontrolDevice_Initialize($) {
|
||||
my ($hash) = @_;
|
||||
|
||||
$hash->{DefFn} = "IOhomecontrolDevice_Define";
|
||||
$hash->{SetFn} = "IOhomecontrolDevice_Set";
|
||||
$hash->{parseParams} = 1;
|
||||
$hash->{AttrList} = "setCmds " . $readingFnAttributes;
|
||||
}
|
||||
|
||||
sub IOhomecontrolDevice_Define($$) {
|
||||
|
||||
# define <name> IOhomecontrolDevice <interface>
|
||||
my ( $hash, $argref, undef ) = @_;
|
||||
|
||||
my @def = @{$argref};
|
||||
if ( $#def != 2 ) {
|
||||
my $msg = "wrong syntax: define <name> IOhomecontrolDevice <interface>";
|
||||
Log 2, $msg;
|
||||
return $msg;
|
||||
}
|
||||
|
||||
my $name = $def[0];
|
||||
my $master = $def[2];
|
||||
|
||||
my $interface = $defs{$master};
|
||||
$hash->{"INTERFACE"} = $interface;
|
||||
if ( !defined($interface) || $interface->{TYPE} ne "IOhomecontrol" ) {
|
||||
return "No such IOhomecontrol interface: $master";
|
||||
}
|
||||
else { return; }
|
||||
}
|
||||
|
||||
sub IOhomecontrolDevice_getSetCmds($) {
|
||||
my $hash = shift;
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
my $attr = AttrVal( $name, "setCmds", "" );
|
||||
my ( undef, $setCmds ) = parseParams( $attr, "," );
|
||||
return $setCmds;
|
||||
}
|
||||
|
||||
sub IOhomecontrolDevice_runSceneByIdCallback($$$$) {
|
||||
my ( $hash, $httpParams, $err, $result ) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
my $interface = $hash->{INTERFACE};
|
||||
my $id = $httpParams->{params}{id};
|
||||
my $sn = $interface->{fhem}{".scenes"}->{$id};
|
||||
if ( defined($err) ) {
|
||||
Log3 $hash, 2,
|
||||
"IOhomecontrolDevice $name: running scene id $id, name $sn, failed ($err)";
|
||||
}
|
||||
else {
|
||||
Log3 $hash, 5,
|
||||
"IOhomecontrolDevice $name: running scene id $id, name $sn, completed";
|
||||
readingsSingleUpdate( $hash, "state", $sn, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
sub IOhomecontrolDevice_Set($$$) {
|
||||
my ( $hash, $argsref, undef ) = @_;
|
||||
|
||||
my @a = @{$argsref};
|
||||
return "set needs at least one parameter" if ( @a < 2 );
|
||||
|
||||
my $name = shift @a;
|
||||
my $cmd = shift @a;
|
||||
|
||||
my $setCmds = IOhomecontrolDevice_getSetCmds($hash);
|
||||
my $usage = "Unknown argument $cmd, choose one of scene"
|
||||
. join( " ", ( keys %{$setCmds} ) );
|
||||
if ( exists( $setCmds->{$cmd} ) ) {
|
||||
readingsSingleUpdate( $hash, "state", $cmd, 1 );
|
||||
my $subst = $setCmds->{$cmd};
|
||||
Log3 $hash, 5,
|
||||
"IOhomecontrolDevice $name: substitute set command $cmd by $subst";
|
||||
( $argsref, undef ) = parseParams($subst);
|
||||
@a = @{$argsref};
|
||||
$cmd = shift @a;
|
||||
}
|
||||
|
||||
if ( $cmd eq "scene" ) {
|
||||
if ($#a) {
|
||||
return "Command scene needs exactly one argument.";
|
||||
}
|
||||
else {
|
||||
my $id = $a[0];
|
||||
my $interface = $hash->{INTERFACE};
|
||||
return IOhomecontrol_setScene( $interface, $id,
|
||||
\&IOhomecontrolDevice_runSceneByIdCallback );
|
||||
}
|
||||
}
|
||||
else {
|
||||
return $usage;
|
||||
}
|
||||
|
||||
return undef;
|
||||
|
||||
}
|
||||
|
||||
#####################################
|
||||
|
||||
1;
|
||||
|
||||
=pod
|
||||
=item device
|
||||
=item summary control IOhomecontrol devices via IOhomecontrol interface
|
||||
=item summary_DE IOhomecontrol-Geräte mittels IOhomecontrol-Interface steuern
|
||||
=begin html
|
||||
|
||||
<a name="IOhomecontrolDevice"></a>
|
||||
<h3>IOhomecontrolDevice</h3>
|
||||
<ul>
|
||||
|
||||
<a name="IOhomecontrolDevicedefine"></a>
|
||||
<b>Define</b><br><br>
|
||||
<ul>
|
||||
<code>define <name> IOhomecontrolDevice <interface> </code><br><br>
|
||||
|
||||
Defines an IOhomecontrol device. <code><interface></code> is the
|
||||
name of the IOhomecontrol interface device (gateway) that is used to
|
||||
communicate with the IOhomecontrol devices.
|
||||
<br><br>
|
||||
|
||||
Example:
|
||||
<ul>
|
||||
<code>define shutter1 IOhomecontrolDevice myKLF200</code><br>
|
||||
</ul>
|
||||
<br><br>
|
||||
</ul>
|
||||
|
||||
<a name="IOhomecontrolDeviceset"></a>
|
||||
<b>Set</b><br><br>
|
||||
<ul>
|
||||
<code>set <name> scene <id></code>
|
||||
<br><br>
|
||||
Runs the scene identified by <code><id></code> which can be either
|
||||
the numeric id of the scene or the scene's name.
|
||||
<br><br>
|
||||
Examples:
|
||||
<ul>
|
||||
<code>set shutter1 scene 1</code><br>
|
||||
<code>set shutter1 scene "3.dz.roll2 100%"</code><br>
|
||||
</ul>
|
||||
<br>
|
||||
Scene names with blanks must be enclosed in double quotes.
|
||||
<br><br>
|
||||
</ul>
|
||||
|
||||
<a name="IOhomecontrolDeviceattr"></a>
|
||||
<b>Attributes</b>
|
||||
<br>
|
||||
<br>
|
||||
<ul>
|
||||
<li>setCmds: a comma-separated list of set command definitions.
|
||||
Every definition is of the form <code><shorthand>=<command></code>. This defines a new single-word command <code><shorthand></code> as a substitute for <code><command></code>.<br>
|
||||
Example: <code>attr shutter1 setCmds up=scene "3.dz.roll2 100%",down=scene "3.dz.roll2 0%"</code><br>
|
||||
Substituted commands (and only these) are shown in the state reading.
|
||||
This is useful in conjunction with the <code>devStateIcon</code> attribute,
|
||||
e.g. <code>attr shutter1 devStateIcon down:shutter_closed up:shutter_open</code>.</li>
|
||||
<br>
|
||||
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
|
||||
</ul>
|
||||
<br><br>
|
||||
<b>Full example</b>
|
||||
<ul><code>
|
||||
define myKLF200 IOhomecontrol KLF200 velux.local /opt/fhem/etc/veluxpw.txt<br>
|
||||
attr myKLF200 verbose 5<br>
|
||||
attr myKLF200 logTraffic 1<br>
|
||||
<br>
|
||||
define shutter1 IOhomecontrolDevice myKLF200<br>
|
||||
attr shutter1 setCmds up=scene "3.dz.roll2 0%",down=scene "3.dz.roll2 100%"<br>
|
||||
attr shutter1 webCmd up:down<br>
|
||||
attr shutter1 devStateIcon down:shutter_closed up:shutter_open<br>
|
||||
</code></ul>
|
||||
<br><br>
|
||||
|
||||
</ul>
|
||||
|
||||
=end html
|
||||
=cut
|
Loading…
Reference in New Issue
Block a user