00_NetzerI2C.pm: =item summary added

00_RPII2C.pm: =item summary added
51_I2C_BMP180.pm: =item summary added
51_Netzer.pm: =item summary added
51_RPI_GPIO.pm: =item summary added
52_I2C_BME280.pm: =item summary added
52_I2C_EEPROM.pm: =item summary added
52_I2C_MCP23008.pm: =item summary added
52_I2C_MCP23017.pm: =item summary added
52_I2C_MCP342x.pm: =item summary added
52_I2C_PCA9532.pm: =item summary added
52_I2C_PCA9685.pm: =item summary added
52_I2C_PCF8574.pm: =item summary added
52_I2C_SHT21.pm: =item summary added
53_GHoma.pm: =item summary added, Notes for new firmware added


git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@12059 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
klauswitt 2016-08-22 21:14:59 +00:00
parent e25384a04b
commit a0ed08b527
15 changed files with 85 additions and 36 deletions

View File

@ -26,10 +26,8 @@ I2C_PC.*
I2C_MCP.*
I2C_BME280
I2C_BMP180
I2C_BH1750
I2C_SHT.*
I2C_SHT21
I2C_TSL2561
I2C_K30
);
sub NetzerI2C_Initialize($) {
@ -501,6 +499,9 @@ sub NetzerI2C_RemoveInternalTimer($$) {
1;
=pod
=item device
=item summary accesses I2C interface on an Netzer
=item summary_DE Zugriff auf das I2C-Interface einer Netzer
=begin html
<a name="NetzerI2C"></a>
@ -646,4 +647,4 @@ sub NetzerI2C_RemoveInternalTimer($$) {
<br>
</ul>
=end html_DE
=end html_DE

View File

@ -16,10 +16,8 @@ I2C_PC.*
I2C_MCP.*
I2C_BME280
I2C_BMP180
I2C_BH1750
I2C_SHT.*
I2C_SHT21
I2C_TSL2561
I2C_K30
);
my $gpioprg = "/usr/local/bin/gpio"; #WiringPi GPIO utility
@ -535,6 +533,9 @@ sub RPII2C_HWACCESS_ioctl($$) {
=pod
=item device
=item summary accesses I2C interface via sysfs on linux
=item summary_DE Zugriff auf das I2C-Interface &uuml;ber sysfs auf Linux Systemen
=begin html
<a name="RPII2C"></a>
@ -855,4 +856,4 @@ sub RPII2C_HWACCESS_ioctl($$) {
=end html_DE
1;
1;

View File

@ -546,6 +546,9 @@ sub I2C_BMP180_DbLog_splitFn($) {
1;
=pod
=item device
=item summary reads pressure and temperature from an via I2C connected BMP180/BMP085
=item summary_DE lese Druck und Temperatur eines &uuml;ber I2C angeschlossenen BMP180/BMP085
=begin html
<a name="I2C_BMP180"></a>

View File

@ -290,6 +290,9 @@ sub Netzer_disconn($$) {
1;
=pod
=item device
=item summary controls/reads GPIO pins on an Netzer
=item summary_DE steuern/lesen der GPIO Pins eines Netzer
=begin html
<a name="Netzer"></a>

View File

@ -62,7 +62,6 @@ sub RPI_GPIO_Initialize($) {
" interrupt:none,falling,rising,both" .
" toggletostate:no,yes active_low:no,yes" .
" debounce_in_ms restoreOnStartup:no,yes,on,off,last" .
" dblclicklevel:0,1 dblclicktime" .
" unexportpin:no,yes longpressinterval" .
" $readingFnAttributes";
}
@ -508,11 +507,9 @@ sub RPI_GPIO_Except($) { #called from main if an interrupt occured
Log3 $hash, 5, "Zaehler ist jetzt $valcnt";
}
#Doppelklick (noch im Teststatus)
if (defined($hash->{lasttrg})) {
my $testtt = (gettimeofday() - $hash->{lasttrg} );
readingsSingleUpdate($hash, 'Dblclick', "on", 1) if $testtt < 2;
}
my $testtt = (gettimeofday() - $hash->{lasttrg} );
$hash->{lasttrg} = gettimeofday();
readingsSingleUpdate($hash, 'Dblclick', "on", 1) if $testtt < 2;
#langer Testendruck
} elsif ($eval eq "both") {
if ( $val == 1 ) {
@ -524,11 +521,9 @@ sub RPI_GPIO_Except($) { #called from main if an interrupt occured
}
#Doppelklick (noch im Teststatus)
if ( $val == AttrVal($hash->{NAME}, "dblclicklevel", "1") ) {
if (defined $hash->{lasttrg}) {
my $testtt = (gettimeofday() - $hash->{lasttrg} );
readingsSingleUpdate($hash, 'Dblclick', "on", 1) if $testtt < int(AttrVal($hash->{NAME}, "dblclicktime", 2));
}
my $testtt = (gettimeofday() - $hash->{lasttrg} );
$hash->{lasttrg} = gettimeofday();
readingsSingleUpdate($hash, 'Dblclick', "on", 1) if $testtt < 2;
} else {
readingsSingleUpdate($hash, 'Dblclick', "off", 1);
}
@ -675,6 +670,9 @@ sub RPI_GPIO_inthandling($$) { #start/stop Interrupthandling
1;
=pod
=item device
=item summary controls/reads GPIO pins accessible via sysfs on linux
=item summary_DE steuern/lesen von GPIO Pins &uuml;ber sysfs auf Linux Systemen
=begin html
<a name="RPI_GPIO"></a>
@ -967,4 +965,4 @@ sub RPI_GPIO_inthandling($$) { #start/stop Interrupthandling
=end html_DE
=cut
=cut

View File

@ -172,7 +172,7 @@ sub I2C_BME280_Set($@) { # Messwerte manuell anfordern
} else { #..but get calibration variables first
Log3 $hash, 5, "$name: in set but no calibrationData, requesting again";
I2C_BME280_i2cread($hash, 0x88, 26);
I2C_BME280_i2cread($hash, 0xE1, 8);
I2C_BME280_i2cread($hash, 0xE1, 16);
}
}
return undef
@ -194,7 +194,7 @@ sub I2C_BME280_Get($@) { # Messwerte manuell anfordern
} else { #..but get calibration variables first
Log3 $hash, 5, "$name: in set but no calibrationData, requesting again";
I2C_BME280_i2cread($hash, 0x88, 26);
I2C_BME280_i2cread($hash, 0xE1, 8);
I2C_BME280_i2cread($hash, 0xE1, 16);
}
} else {
return 'Unknown argument ' . $cmd . ', choose one of readValues:noArg';
@ -498,6 +498,9 @@ sub I2C_BME280_DbLog_splitFn($) { # Einheiten
1;
=pod
=item device
=item summary reads pressure, humidity and temperature from an via I2C connected BME280
=item summary_DE lese Druck, Feuchte und Temperatur eines &uuml;ber I2C angeschlossenen BME280
=begin html
<a name="I2C_BME280"></a>

View File

@ -286,6 +286,9 @@ sub I2C_EEPROM_BytefromReading($@) {
1;
=pod
=item device
=item summary reads the content from an via I2C connected EEPROM
=item summary_DE lesen des Inhals eines &uuml;ber I2C angeschlossenen EEPROM
=begin html
<a name="I2C_EEPROM"></a>

View File

@ -489,6 +489,9 @@ sub I2C_MCP23008_UpdReadings($$$) { #nach Rueckmeldung read
1;
=pod
=item device
=item summary controls/reads GPIOs from an via I2C connected MCP23008 port extender
=item summary_DE steuern/lesen der GPIOs eines &uuml;ber I2C angeschlossenen MCP23008
=begin html
<a name="I2C_MCP23008"></a>

View File

@ -11,6 +11,7 @@ use strict;
use warnings;
use SetExtensions;
use Scalar::Util qw(looks_like_number);
no if $] >= 5.017011, warnings => 'experimental::smartmatch';
my %Registers = (
'IODIRA' => 0x00, #1 = input; 0 = output (default 1)
@ -490,6 +491,9 @@ sub I2C_MCP23017_UpdReadings($$$) { #nach Rueckmeldung read
1;
=pod
=item device
=item summary controls/reads GPIOs from an via I2C connected MCP23017 port extender
=item summary_DE steuern/lesen der GPIOs eines &uuml;ber I2C angeschlossenen MCP23017
=begin html
<a name="I2C_MCP23017"></a>
@ -711,4 +715,4 @@ sub I2C_MCP23017_UpdReadings($$$) { #nach Rueckmeldung read
=end html_DE
=cut
=cut

View File

@ -90,23 +90,27 @@ sub I2C_MCP342x_Init($$) {
my ( $hash, $args ) = @_;
my $name = $hash->{NAME};
Log3 $hash, 1, "$hash->{NAME}: Init Argumente1: $args";
if (defined $args && int(@$args) < 1) {
Log3 $hash, 0, "Define: Wrong syntax. Usage:\n" .
"define <name> MCP342x [<i2caddress>] [<type>]";
if (defined $args && int(@$args) > 1)
{
return "Define: Wrong syntax. Usage:\n" .
"define <name> MCP342x [<i2caddress>] [<type>]";
}
if (defined (my $address = shift @$args)) {
$hash->{I2C_Address} = $address =~ /^0x.*$/ ? oct($address) : $address;
Log3 $hash, 0, "$name: I2C Address not valid" unless ($hash->{I2C_Address} < 128 && $hash->{I2C_Address} > 3);
} else {
if (defined (my $address = shift @$args)) {
$hash->{I2C_Address} = $address =~ /^0.*$/ ? oct($address) : $address;
return "$name I2C Address not valid" unless ($address < 128 && $address > 3);
} else {
$hash->{I2C_Address} = hex(MCP3422_I2C_ADDRESS);
}
if (defined (my $channels = shift @$args)) {
$hash->{channels} = ($channels == 4 ? 4 : 2);
$hash->{channels} = $channels if $channels == 2 || $channels == 4;
} else {
$hash->{channels} = 2;
}
my $msg = '';
# create default attributes
if (AttrVal($name, 'poll_interval', '?') eq '?') {
@ -330,6 +334,9 @@ sub I2C_MCP342x_readvoltage($@) {
1;
=pod
=item device
=item summary reads the analog inputs from an via I2C connected MCP342x
=item summary_DE lesen der Analogeing&aumlnge eines &uuml;ber I2C angeschlossenen MCP342x
=begin html
<a name="I2C_MCP342x"></a>

View File

@ -24,6 +24,7 @@ package main;
use strict;
use warnings;
use SetExtensions;
no if $] >= 5.017011, warnings => 'experimental::smartmatch';
#use POSIX;
use Scalar::Util qw(looks_like_number);
@ -440,6 +441,9 @@ sub I2C_PCA9532_UpdReadings($$$) {
1;
=pod
=item device
=item summary controls PWM outputs from an via I2C connected PCA9532
=item summary_DE steuern der PWM Ausg&aumlnge eines &uuml;ber I2C angeschlossenen PCA9532
=begin html
<a name="I2C_PCA9532"></a>
@ -610,4 +614,4 @@ sub I2C_PCA9532_UpdReadings($$$) {
=end html_DE
=cut
=cut

View File

@ -215,7 +215,7 @@ sub I2C_PCA9685_Attr(@) { # wird beim setzen eines Attributes ausgef
$val = $defaultreg{'PRESCALE'} unless (defined($val)); #beim loeschen wieder auf Standard setzen
return "wrong value: $val for \"set $name $attr\" use 0-255"
unless($val =~ m/^(\d+)$/ && $val >= 0 && $val < 256);
Log3 $hash, 5, $hash->{NAME} . ": $attr alter Wert: ".$hash->{confregs}{PRESCALE}." neuer Wert: ".$val;
Log3 $hash, 5, $hash->{NAME} . ": $attr alter Wert: ".(defined($hash->{confregs}{PRESCALE})?$hash->{confregs}{PRESCALE}:"empty")." neuer Wert: ".$val;
if ($main::init_done && $val != $hash->{confregs}{PRESCALE}) {
my $modereg1 = defined $hash->{confregs}{$confregs{0}} ? $hash->{confregs}{$confregs{0}} : $defaultreg{'modereg1'};
my $modereg1mod = ( $modereg1 & 0x7F ) | $mr1{ "SLEEP" };
@ -481,7 +481,6 @@ sub I2C_PCA9685_i2cwrite($$$) { # Schreibbefehl an Hardware absetzen
I2C_PCA9685_i2cread($hash, 6 + $n * $reg, $reg - ($reg * ($n+1) - 64)) if (($n+1) * $reg) > 64;
}
}
return undef;
} else {
if (AttrVal($hash->{NAME}, "dummy", 0) == 1) {
I2C_PCA9685_UpdReadings($hash, $reg, $data); # Zeile zum testen (Werte werden direkt zu I2CRec umgeleitet)
@ -598,6 +597,9 @@ sub I2C_PCA9685_UpdReadings($$$) { # vom IODev gesendete Werte in Read
1;
=pod
=item device
=item summary controls PWM outputs from an via I2C connected PCA9685
=item summary_DE steuern der PWM Ausg&aumlnge eines &uuml;ber I2C angeschlossenen PCA9685
=begin html
<a name="I2C_PCA9685"></a>
@ -881,4 +883,4 @@ sub I2C_PCA9685_UpdReadings($$$) { # vom IODev gesendete Werte in Read
=end html_DE
=cut
=cut

View File

@ -336,6 +336,9 @@ sub I2C_PCF8574_Parse($$) { #wird ueber dispatch vom physical device aufgerufen
1;
=pod
=item device
=item summary controls/reads GPIOs from an via I2C connected PCF8574 port extender
=item summary_DE steuern/lesen der GPIOs eines &uuml;ber I2C angeschlossenen PCF8574
=begin html
<a name="I2C_PCF8574"></a>

View File

@ -293,7 +293,7 @@ sub I2C_SHT21_CheckCrc(@) {
$crc = ($crc & 0x80 ? $poly : 0 ) ^ ($crc << 1);
}
}
return ($crc == $data[2] ? undef : $crc);
return ($crc = $data[2] ? undef : $crc);
}
sub I2C_SHT21_DbLog_splitFn($) {
@ -312,6 +312,9 @@ sub I2C_SHT21_DbLog_splitFn($) {
1;
=pod
=item device
=item summary reads humidity and temperature from an via I2C connected SHT2x
=item summary_DE lese Feuchte und Temperatur eines &uuml;ber I2C angeschlossenen SHT2x
=begin html
<a name="I2C_SHT21"></a>

View File

@ -166,7 +166,7 @@ sub GHoma_Define($$$) { #
#my $name = $a[0];
# my $addr = $a[2];
#$hash->{Id} = pack('C*', ( hex(substr($pport,0,2)), hex(substr($pport,2,2)), hex(substr($pport,4,2)) ) );
$hash->{Id} = lc $pport;
$hash->{Id} = $pport;
return;
}
@ -420,6 +420,9 @@ sub GHoma_Undef($$) { #
1;
=pod
=item device
=item summary controls an G-Homa wlan adapter plug
=item summary_DE Steuerung einer G-Homa Wlan Steckdose
=begin html
<a name="GHoma"></a>
@ -428,6 +431,10 @@ sub GHoma_Undef($$) { #
<ul>
<ul>
Connects fhem to an G-Homa adapter plug<br><br>
<b>ATTENTION!:</b><br>
With an actual firmware and after firmware update, http access will be disabled.<br>
Network parameters cannot changed anymore.
The only way to use the plug again with FHEM is to change route DNS requests from G-Homa plug to plug.g-homa.com to your FHEM server.<br>
<b>preliminary:</b><br>
<li>Configure WLAN settings:<br>
bring device in AP mode (press button for more than 3s, repeat this step until the LED is permanently on)<br>
@ -509,6 +516,10 @@ sub GHoma_Undef($$) { #
<ul>
<ul>
Verbindet fhem mit einem G-Homa Zwischenstecker<br><br>
<b>Achtung!:</b><br>
Mit aktueller Firmware und nach einem Firmware Update ist der integrierte Webserver nicht mehr erreichbar.<br>
Dadurch lassen sich keine Einstellungen mehr anpassen.
Die einzige Möglichkeit ist, die DNS anfragen der G-Homa Dose an plug.g-homa.com zum FHEM server umzuleiten.<br>
<b>Vorbereitung:</b><br>
<li>WLAN konfigurieren:<br>
Ger&auml;t in den AP modus bringen (Knopf f&uuml;r mehr als 3s dr&uuml;cken, diesen Schritt wiederholen bis die LED permanent leuchtet)<br>