Modul für die Ansteuerung des MCP23017 I2C Portextender

Begonnen von klausw, 03 Mai 2014, 01:02:40

Vorheriges Thema - Nächstes Thema

Frank_Huber

welches Modul hast denn?
Wegen dem Adresswechsel würde ich von einem Defekt ausgehen.

klausw

Zitat von: AlphaKingOne am 05 Oktober 2016, 17:09:15
ja hab ich ich hab eigentlich 0x20 manchmal wenn GPA0 auf output geht hab ich dann 0x27  nachmal hab ich das Gefühl das es am DS18B20 liegt. Oder könnte es auch an der Stromversorgung liegen? War jetzt aber eigentlich nicht mein haupt anliegen mir ging es jetzt mehr um die Fehler Meldung da ich gern das Modul zum laufen bekommen würde

Hab den Pi 2 und das mit der 0 ist nur bei Ver. 1

Ich habe nicht nachgeschaut, welchen I2C Bus das Pi2 hat.
Aber dein Befehl aus dem anderen Post:
system("sudo i2cset -y 0 0x20 0x13 0xff &")}
Greift auf den I2C-0 zu.

was gibt denn
ls -l /dev/i* aus?

kannst du auch direkt in FHEM eingeben: {`ls -l /dev/i*`}

den user unter dem fhem läuft hattest du der Gruppe i2c hinzugefügt und neu gestartet?
RasPi B v2 mit FHEM 18B20 über 1Wire, LED PWM Treiber über I2C, Luchtdruck-, Feuchtesensor und ein paar Schalter/LED\'s zum testen
Module: RPI_GPIO, RPII2C, I2C_EEPROM, I2C_MCP23008, I2C_MCP23017, I2C_MCP342x, I2C_PCA9532, I2C_PCF8574, I2C_SHT21, I2C_BME280

AlphaKingOne

Zitat von: Frank_Huber am 06 Oktober 2016, 08:10:45
welches Modul hast denn?
Wegen dem Adresswechsel würde ich von einem Defekt ausgehen.
Ich hab das Modul aus beitrag 24

Zitat von: klausw am 06 Oktober 2016, 09:08:07
Ich habe nicht nachgeschaut, welchen I2C Bus das Pi2 hat.
Aber dein Befehl aus dem anderen Post:
system("sudo i2cset -y 0 0x20 0x13 0xff &")}
Greift auf den I2C-0 zu.

was gibt denn
ls -l /dev/i* aus?

kannst du auch direkt in FHEM eingeben: {`ls -l /dev/i*`}

den user unter dem fhem läuft hattest du der Gruppe i2c hinzugefügt und neu gestartet?

Wenn ich zuhause bin werde ich das mal ausprobieren
Raspberry B, B+, B v2 u. v3; DS18B20; MCP23017; CUL; ESP8266

klausw

Zitat von: AlphaKingOne am 08 Oktober 2016, 00:56:20
Ich hab das Modul aus beitrag 24

Wenn ich zuhause bin werde ich das mal ausprobieren
Das Modul wird mit FHEM ausgeliefert. Du solltest dieses verwenden.
Beitrag 24 beinhaltet eine veraltete Version.
RasPi B v2 mit FHEM 18B20 über 1Wire, LED PWM Treiber über I2C, Luchtdruck-, Feuchtesensor und ein paar Schalter/LED\'s zum testen
Module: RPI_GPIO, RPII2C, I2C_EEPROM, I2C_MCP23008, I2C_MCP23017, I2C_MCP342x, I2C_PCA9532, I2C_PCF8574, I2C_SHT21, I2C_BME280

AlphaKingOne

hmm blöd gelaufen. Mal schauen ob ich das original im netz finde

bei mir kommt
ls -l /dev/i*
crw-rw---T 1 pi   pi   89, 1 Oct  7 17:17 /dev/i2c-1

/dev/input:
total 0
crw-rw---T 1 root input 13, 63 Jan  1  1970 mice
Raspberry B, B+, B v2 u. v3; DS18B20; MCP23017; CUL; ESP8266

klausw

Dann isses I2C 1
mit "update force" erhältst du alle aktuellen Modulversionen
RasPi B v2 mit FHEM 18B20 über 1Wire, LED PWM Treiber über I2C, Luchtdruck-, Feuchtesensor und ein paar Schalter/LED\'s zum testen
Module: RPI_GPIO, RPII2C, I2C_EEPROM, I2C_MCP23008, I2C_MCP23017, I2C_MCP342x, I2C_PCA9532, I2C_PCF8574, I2C_SHT21, I2C_BME280

AlphaKingOne

ok danke solangsam wird es :)

nur kommt jetzt wenn ich was schalten will also Output "icMCP23017 error: PortA0 is defined as input"
ich hab mir noch mal die config angeschaut kann aber leider kein fehler finden

###I2C-Device###
define i2cBus RPII2C 1..
attr i2cBus group MCP23017

###MCP23017-0x20###
define icMCP23017 I2C_MCP23017 0x20
attr icMCP23017 IODev i2cBus
attr icMCP23017 Interrupt B0,B1,B2,B3,B4,B5,B6,B7
attr icMCP23017 InterruptOut connected_active-low
attr icMCP23017 OnStartup A0=off,A1=off, A2=off,A3=off, A4=off,A5=off, A6=off,A7=off
attr icMCP23017 OutputPorts A0,A1,A2,A3,A3,A5,A6,A7
attr icMCP23017 Pullup B0,B1,B2,B3,B4,B5,B6,B7
attr icMCP23017 invert_input B0,B1,B2,B3,B4,B5,B6,B7
attr icMCP23017 group MCP23017

###Interrupt A&B####
define Interrupt RPI_GPIO 4
attr Interrupt active_low yes
attr Interrupt direction input
attr Interrupt interrupt both
attr Interrupt userReadings test {fhem ("get icMCP23017")}
attr Interrupt group MCP23017

###Sensoren (Input)####
#--Bank-B--#

define prxPortB0 readingsProxy icMCP23017:PortB0
attr prxPortB0 group InputPorts
attr prxPortB0 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortB1 readingsProxy icMCP23017:PortB1
attr prxPortB1 group InputPorts
attr prxPortB1 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortB2 readingsProxy icMCP23017:PortB2
attr prxPortB2 group InputPorts
attr prxPortB2 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortB3 readingsProxy icMCP23017:PortB3
attr prxPortB3 group InputPorts
attr prxPortB3 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortB4 readingsProxy icMCP23017:PortB4
attr prxPortB4 group InputPorts
attr prxPortB4 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortB5 readingsProxy icMCP23017:PortB5
attr prxPortB5 group InputPorts
attr prxPortB5 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortB6 readingsProxy icMCP23017:PortB6
attr prxPortB6 group InputPorts
attr prxPortB6 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortB7 readingsProxy icMCP23017:PortB7
attr prxPortB7 group InputPorts
attr prxPortB7 valueFn {($VALUE eq "on")?"off":"on"}

####Aktoren (Output)####
#---A-Kanal-----

define prxPortA0 readingsProxy icMCP23017:PortA0
attr prxPortA0 group OutputPorts
attr prxPortA0 setFn {($CMD eq "on")?"PortA4 off":"PortA0 on"}
attr prxPortA0 setList on off
attr prxPortA0 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortA1 readingsProxy icMCP23017:PortA1
attr prxPortA1 group OutputPorts
attr prxPortA1 setFn {($CMD eq "on")?"PortA5 off":"PortA1 on"}
attr prxPortA1 setList on off
attr prxPortA1 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortA2 readingsProxy icMCP23017:PortA2
attr prxPortA2 group OutputPorts
attr prxPortA2 setFn {($CMD eq "on")?"PortA4 off":"PortA2 on"}
attr prxPortA2 setList on off
attr prxPortA2 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortA3 readingsProxy icMCP23017:PortA3
attr prxPortA3 group OutputPorts
attr prxPortA3 setFn {($CMD eq "on")?"PortA5 off":"PortA3 on"}
attr prxPortA3 setList on off
attr prxPortA3 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortA4 readingsProxy icMCP23017:PortA4
attr prxPortA4 group OutputPorts
attr prxPortA4 setFn {($CMD eq "on")?"PortA4 off":"PortA4 on"}
attr prxPortA4 setList on off
attr prxPortA4 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortA5 readingsProxy icMCP23017:PortA5
attr prxPortA5 group OutputPorts
attr prxPortA5 setFn {($CMD eq "on")?"PortA5 off":"PortA5 on"}
attr prxPortA5 setList on off
attr prxPortA5 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortA6 readingsProxy icMCP23017:PortA6
attr prxPortA6 group OutputPorts
attr prxPortA6 setFn {($CMD eq "on")?"PortA4 off":"PortA6 on"}
attr prxPortA6 setList on off
attr prxPortA6 valueFn {($VALUE eq "on")?"off":"on"}

define prxPortA7 readingsProxy icMCP23017:PortA7
attr prxPortA7 group OutputPorts
attr prxPortA7 setFn {($CMD eq "on")?"PortA5 off":"PortA7 on"}
attr prxPortA7 setList on off
attr prxPortA57 valueFn {($VALUE eq "on")?"off":"on"}
Raspberry B, B+, B v2 u. v3; DS18B20; MCP23017; CUL; ESP8266

klausw

lässt sich der Port direkt auf der Detailseite von icMCP23017 schalten?
RasPi B v2 mit FHEM 18B20 über 1Wire, LED PWM Treiber über I2C, Luchtdruck-, Feuchtesensor und ein paar Schalter/LED\'s zum testen
Module: RPI_GPIO, RPII2C, I2C_EEPROM, I2C_MCP23008, I2C_MCP23017, I2C_MCP342x, I2C_PCA9532, I2C_PCF8574, I2C_SHT21, I2C_BME280

AlphaKingOne

Wenn du mir sagst wo die ist probiere ich es.
Ansteuern kann ich es über fhem mit dem Shell Befehl aber nicht mit dem Modul
Raspberry B, B+, B v2 u. v3; DS18B20; MCP23017; CUL; ESP8266

klausw

Auf der Detailseite von icMCP23017 sollten die Ausgangsports wählbar sein.

Was bringt denn ein
list icMCP23017
?
RasPi B v2 mit FHEM 18B20 über 1Wire, LED PWM Treiber über I2C, Luchtdruck-, Feuchtesensor und ein paar Schalter/LED\'s zum testen
Module: RPI_GPIO, RPII2C, I2C_EEPROM, I2C_MCP23008, I2C_MCP23017, I2C_MCP342x, I2C_PCA9532, I2C_PCF8574, I2C_SHT21, I2C_BME280

AlphaKingOne

da kommt bei mir nur
Internals:
   DEF        0x20
   NAME       icMCP23017
   NR         175
   STATE      defined
   TYPE       I2C_MCP23017
Attributes:
   OnStartup  A5=on,B1=off
   group      MCP23017
Raspberry B, B+, B v2 u. v3; DS18B20; MCP23017; CUL; ESP8266

klausw

RasPi B v2 mit FHEM 18B20 über 1Wire, LED PWM Treiber über I2C, Luchtdruck-, Feuchtesensor und ein paar Schalter/LED\'s zum testen
Module: RPI_GPIO, RPII2C, I2C_EEPROM, I2C_MCP23008, I2C_MCP23017, I2C_MCP342x, I2C_PCA9532, I2C_PCF8574, I2C_SHT21, I2C_BME280

AlphaKingOne

File               Rev   Last Change

52_I2C_MCP23017.pm 12059 2016-08-22 21:14:59Z klauswitt
Raspberry B, B+, B v2 u. v3; DS18B20; MCP23017; CUL; ESP8266

klausw

Langsam weiß ich nicht weiter.

Deine Attribute (die meiner Meinung nach alle korrekt gesetzt sind) passen überhaupt nicht zu dem, was beim List kommt.
Beim genaueren hinsehen:
define i2cBus RPII2C 1..
was machen die Punkte hinter der 1?

Hattest du mal ein "update force" gemacht? Evtl. ein noch irgend ein alte Modul in deinem FHEM vorhanden.

Du könntest auch nochmal einen FHEM restart mit Verbose 5 machen. Irgendwelche Fehler müssen doch im Log auftauchen

RasPi B v2 mit FHEM 18B20 über 1Wire, LED PWM Treiber über I2C, Luchtdruck-, Feuchtesensor und ein paar Schalter/LED\'s zum testen
Module: RPI_GPIO, RPII2C, I2C_EEPROM, I2C_MCP23008, I2C_MCP23017, I2C_MCP342x, I2C_PCA9532, I2C_PCF8574, I2C_SHT21, I2C_BME280

AlphaKingOne

 punkte hab ich weggemacht keine ahnung wie die da rein gekommen sind. Update hatte ich auch schon gemacht und der restart brachte nur

016.11.09 01:33:22 0: Server shutdown
2016.11.09 01:33:27 1: reload: Error:Modul 99_myUtils deactivated:
Unrecognized character \xC2; marked by <-- HERE after <-- HERE near column 1 at ./FHEM/99_myUtils.pm line 8.

2016.11.09 01:33:27 1: Including fhem.cfg
2016.11.09 01:33:27 1: reload: Error:Modul 99_myUtils deactivated:
Unrecognized character \xC2; marked by <-- HERE after <-- HERE near column 1 at ./FHEM/99_myUtils.pm line 8, <$fh> line 4.

2016.11.09 01:33:28 3: WEB: port 8083 opened
2016.11.09 01:33:28 3: WEBphone: port 8084 opened
2016.11.09 01:33:28 3: WEBtablet: port 8085 opened
2016.11.09 01:33:29 3: Opening CUL_USB device /dev/ttyACM0
2016.11.09 01:33:29 3: CUL_USB device opened
2016.11.09 01:33:29 2: Switched CUL_USB rfmode to MAX
2016.11.09 01:33:29 3: CUL_MAX_Check: Detected firmware version 155 of the CUL-compatible IODev
2016.11.09 01:33:33 2: eventTypes: loaded 440 events from ./log/eventTypes.txt
2016.11.09 01:33:44 1: PERL WARNING: readline() on closed filehandle DATA at ./FHEM/58_GPIO4.pm line 132.
2016.11.09 01:33:44 1: Including ./log/fhem.save
2016.11.09 01:33:45 1: usb create starting
2016.11.09 01:33:46 3: Probing CUL device /dev/ttyAMA0
2016.11.09 01:33:47 3: Probing TCM_ESP3 device /dev/ttyAMA0
2016.11.09 01:33:47 3: Probing FRM device /dev/ttyAMA0
2016.11.09 01:33:52 1: usb create end
2016.11.09 01:33:52 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 376) line 1.
2016.11.09 01:33:52 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 377) line 1.
2016.11.09 01:33:52 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 378) line 1.
2016.11.09 01:33:52 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 379) line 1.
2016.11.09 01:33:52 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 380) line 1.
2016.11.09 01:33:52 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 381) line 1.
2016.11.09 01:33:52 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 382) line 1.
2016.11.09 01:33:52 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 383) line 1.
2016.11.09 01:33:52 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 384) line 1.
2016.11.09 01:33:52 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 385) line 1.
2016.11.09 01:33:52 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 386) line 1.
2016.11.09 01:33:53 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 387) line 1.
2016.11.09 01:33:53 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 388) line 1.
2016.11.09 01:33:53 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 389) line 1.
2016.11.09 01:33:53 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 390) line 1.
2016.11.09 01:33:53 0: Featurelevel: 5.7
2016.11.09 01:33:53 0: Server started with 73 defined entities (fhem.pl:12519/2016-11-07 perl:5.014002 os:linux user:fhem pid:15942)


also wenn du es auch nicht weißt dann weiß ich auch nicht. Vllt nehme ich mir ein pi mach fhem neu drauf und versuche es noch einmal wenn ich mal zeit habe.
Wäre aber auch mal schön wenn mal eine Anleitung ins wiki kommen könnte. Ist dann doch übersichtlicher :)
Raspberry B, B+, B v2 u. v3; DS18B20; MCP23017; CUL; ESP8266