diff --git a/fhem/FHEM/50_WS300.pm b/fhem/FHEM/50_WS300.pm index 1102c152d..0d0b77254 100644 --- a/fhem/FHEM/50_WS300.pm +++ b/fhem/FHEM/50_WS300.pm @@ -66,7 +66,6 @@ WS300_Initialize($) # Provider $hash->{AttrList} = "do_not_notify:0,1 showtime:0,1 model:ws300 ". - "loglevel:0,1,2,3,4,5,6 ". $readingFnAttributes; $hash->{DefFn} = "WS300_Define"; @@ -669,7 +668,6 @@ NEXTPOLL: Attributes
i2c-bcm2708
+
- via HiPi library
+ Add these two lines to your /etc/modules file to load the I2C relevant kernel modules
+ automaticly during booting your Raspberry Pi.
+ i2c-bcm2708
i2c-dev
- Install HiPi perl modules:
- wget http://raspberry.znix.com/hipifiles/hipi-install
+ Install HiPi perl modules:
+ wget http://raspberry.znix.com/hipifiles/hipi-install
perl hipi-install
- To change the permissions of the I2C device create file:
- /etc/udev/rules.d/98_i2c.rules
- with this content:
- SUBSYSTEM=="i2c-dev", MODE="0666"
- Reboot
+ To change the permissions of the I2C device create file:
+ /etc/udev/rules.d/98_i2c.rules
+ with this content:
+ SUBSYSTEM=="i2c-dev", MODE="0666"
+ Reboot
- To use the sensor on the second I2C bus at P5 connector
- (only for version 2 of Raspberry Pi) you must add the bold
- line of following code to your FHEM start script:
- case "$1" in
+ To use the sensor on the second I2C bus at P5 connector
+ (only for version 2 of Raspberry Pi) you must add the bold
+ line of following code to your FHEM start script:
+ case "$1" in
'start')
sudo hipi-i2c e 0 1
...
-
+ +
Define
define BMP180 I2C_BMP180 [<I2C device>]
@@ -571,7 +570,7 @@ sub I2C_BMP180_calcTruePressure($$$) {
attr BMP180 oversampling_settings 3
attr BMP180 poll_interval 5
-
+
define BMP180 I2C_BMP180
attr BMP180 IODev RPiI2CMod
attr BMP180 oversampling_settings 3
@@ -640,39 +639,39 @@ sub I2C_BMP180_calcTruePressure($$$) {
Dieses Modul ermöglicht das Auslesen der digitalen (Luft)drucksensoren
BMP085 und BMP180 über den I2C Bus des Raspberry Pi.
Es gibt zwei Möglichkeiten das Modul mit dem I2C Bus zu verbinden:
- i2c-bcm2708
+
+ - Über das RPII2C Modul
+ I2C-Botschaften werden über ein I2C Interface Modul wie beispielsweise das RPII2C, FRM
+ oder NetzerI2C gesendet. Daher muss dieses vorher definiert werden.
+ Das Attribut IODev muss definiert sein.
+
+ - Über die HiPi Bibliothek
+ Diese beiden Zeilen müssen in die Datei /etc/modules angefügt werden,
+ um die Kernel Module automatisch beim Booten des Raspberry Pis zu laden.
+ i2c-bcm2708
i2c-dev
- Installation des HiPi Perl Moduls:
- wget http://raspberry.znix.com/hipifiles/hipi-install
+ Installation des HiPi Perl Moduls:
+ wget http://raspberry.znix.com/hipifiles/hipi-install
perl hipi-install
- Um die Rechte für die I2C Devices anzupassen, folgende Datei:
- /etc/udev/rules.d/98_i2c.rules
- mit diesem Inhalt anlegen:
- SUBSYSTEM=="i2c-dev", MODE="0666"
- Reboot
- Falls der Sensor am zweiten I2C Bus am Stecker P5 (nur in Version 2 des
- Raspberry Pi) verwendet werden soll, muss die fett gedruckte Zeile
- des folgenden Codes in das FHEM Start Skript aufgenommen werden:
- case "$1" in
+ Um die Rechte für die I2C Devices anzupassen, folgende Datei:
+ /etc/udev/rules.d/98_i2c.rules
+ mit diesem Inhalt anlegen:
+ SUBSYSTEM=="i2c-dev", MODE="0666"
+ Reboot
+ Falls der Sensor am zweiten I2C Bus am Stecker P5 (nur in Version 2 des
+ Raspberry Pi) verwendet werden soll, muss die fett gedruckte Zeile
+ des folgenden Codes in das FHEM Start Skript aufgenommen werden:
+ case "$1" in
'start')
sudo hipi-i2c e 0 1
...
-
+ Define
define BMP180 <BMP180_name> <I2C_device>
@@ -680,7 +679,7 @@ sub I2C_BMP180_calcTruePressure($$$) {
attr BMP180 oversampling_settings 3
attr BMP180 poll_interval 5
-
+
define BMP180 I2C_BMP180
attr BMP180 IODev RPiI2CMod
attr BMP180 oversampling_settings 3
diff --git a/fhem/MAINTAINER.txt b/fhem/MAINTAINER.txt
index 68bb91ce4..fae3307fa 100644
--- a/fhem/MAINTAINER.txt
+++ b/fhem/MAINTAINER.txt
@@ -324,6 +324,7 @@ contrib/71_LISTENLIVE.pm betateilchen http://forum.fhem.de Multimedi
contrib/98_geodata.pm betateilchen http://forum.fhem.de Sonstiges
contrib/98_openweathermap.pm betateilchen http://forum.fhem.de Unterstuetzende Dienste
contrib/98_PID.pm betateilchen http://forum.fhem.de Automatisierung
+contrib/WebViewControl/* Dirk http://forum.fhem.de Mobile Devices
www/codemirror/* betateilchen http://forum.fhem.de Frontends
www/gplot/* rudolfkoenig http://forum.fhem.de Frontends
diff --git a/fhem/contrib/WebViewControl/95_WebViewControl.pm b/fhem/contrib/WebViewControl/95_WebViewControl.pm
new file mode 100644
index 000000000..15aad6216
--- /dev/null
+++ b/fhem/contrib/WebViewControl/95_WebViewControl.pm
@@ -0,0 +1,311 @@
+################################################################################
+# 95_webViewControl.pm
+# Modul for FHEM
+#
+# Modul for communication between WebViewControl Android App and FHEM
+#
+# contributed by Dirk Hoffmann 01/2013
+# $Id:
+#
+################################################################################
+
+package main;
+
+use Data::Dumper; # for debugging only
+
+use strict;
+use warnings;
+use URI::Escape;
+
+use vars qw {%data %attr %defs %modules $FW_RET}; #supress errors in Eclipse EPIC
+
+use constant {
+ webViewControl_Version => '0.5.1_beta',
+};
+
+#########################
+# Forward declaration
+sub webViewControl_Initialize($); # Initialize
+sub webViewControl_Define($$); # define WEBVIEWCONTROL
+sub webViewControl_Undef($$); # delete
+sub webViewControl_modifyJsInclude($); # include js parts
+sub webViewControl_Set($@); # set
+sub webViewControl_Get($@); # get
+sub webViewControl_Cgi(); # analyze and parse URL
+sub webViewControl_Attr(@);
+
+#########################
+# Global variables
+my $fhemUrl = '/webviewcontrol' ;
+
+my %sets = (
+ 'screenBrightness' => 'screenBrightness', # slider,1,1,100',
+ 'volume' => 'volume', # slider,1,1,100',
+ 'keepScreenOn' => 'keepScreenOn',
+ 'toastMessage' => 'toastMessage',
+ 'reload' => 'reload',
+ 'audioPlay' => 'audioPlay',
+ 'audioStop' => 'audioStop',
+ 'ttsSay' => 'ttsSay',
+ 'voiceRec' => 'voiceRec',
+ 'newUrl' => 'newUrl',
+ 'reload' => 'reload',
+);
+
+my %gets = (
+ 'powerLevel' => 1,
+ 'powerPlugged' => 1,
+ 'voiceRecognitionLastError' => 1,
+ 'voiceRecognitionLastResult'=> 1,
+);
+
+my $FW_encoding="UTF-8"; # like in FHEMWEB: encoding hardcoded
+
+################################################################################
+# Implements Initialize function
+#
+# @param hash $hash hash of device addressed
+#
+################################################################################
+sub webViewControl_Initialize($) {
+ my ($hash) = @_;
+
+ $hash->{DefFn} = 'webViewControl_Define';
+ $hash->{UndefFn} = 'webViewControl_Undef';
+ $hash->{SetFn} = 'webViewControl_Set';
+ $hash->{GetFn} = 'webViewControl_Get';
+ $hash->{AttrFn} = "webViewControl_Attr";
+
+ $hash->{AttrList} = 'loglevel:0,1,2,3,4,5,6 model userJsFile userCssFile '
+ . $readingFnAttributes;
+
+ # CGI
+ $data{FWEXT}{$fhemUrl}{FUNC} = 'webViewControl_Cgi';
+}
+
+################################################################################
+# Implements DefFn function
+#
+# @param hash $hash hash of device addressed
+# @param string $def definition string
+#
+# @return string
+#
+################################################################################
+sub webViewControl_Define($$) {
+ my ($hash, $def) = @_;
+ my @a = split("[ \t][ \t]*", $def);
+
+ my $name = $hash->{NAME};
+ return "wrong syntax: define WEBVIEWCONTROL APP-ID" if int(@a)!=3;
+
+ $hash->{appID} = $a[2];
+ $modules{webViewControl}{defptr}{$name} = $hash;
+
+ webViewControl_modifyJsInclude($hash);
+
+ $hash->{VERSION} = webViewControl_Version;
+
+ return undef;
+}
+
+#############################
+sub webViewControl_Undef($$) {
+ my ($hash, $name) = @_;
+
+ delete($modules{webViewControl}{defptr}{$name});
+ webViewControl_modifyJsInclude($hash);
+
+ return undef;
+}
+
+sub webViewControl_Attr (@) {
+ my (undef, $name, $attr, $val) = @_;
+ my $hash = $defs{$name};
+ my $msg = '';
+
+ if ($attr eq 'userJsFile' || $attr eq 'userCssFile') {
+ $attr{$name}{$attr} = $val;
+ webViewControl_modifyJsInclude($hash);
+ }
+
+ return undef;
+}
+
+sub webViewControl_modifyJsInclude($) {
+ my ($hash) = @_;
+ my $name = $hash->{NAME};
+
+ my @appsArray;
+ foreach my $appName (keys %{ $modules{webViewControl}{defptr} } ) {
+ push(@appsArray, '\'' . $modules{webViewControl}{defptr}{$appName}->{appID} . '\': \'' . $appName . '\'');
+ }
+
+ my $vars = 'var wvcDevices = {' . join(', ', @appsArray) . '}';
+ my $userJs = AttrVal($name, 'userJsFile', '');
+ $userJs = $userJs ? '' : '';
+
+ my $userCss = AttrVal($name, 'userCssFile', '');
+ if ($userCss) {
+ $vars.= '; var wvcUserCssFile="' . $userCss . '"';
+ }
+
+ $data{FWEXT}{$fhemUrl}{SCRIPT} = 'cordova-2.3.0.js">' .
+ '' .
+ $userJs .
+ '' .
+ '