Modbus ioLogic MOXA

Moderatoren: seppy, udo1toni

Antworten
Ralf.Kruppa
Beiträge: 3
Registriert: 2. Apr 2019 21:29

Modbus ioLogic MOXA

Beitrag von Ralf.Kruppa » 3. Apr 2019 07:50

Hallo,

ich bin am Testen von OpenHAB. Habe bei mir FHEM am laufen möchte aber umsteigen.
Meine CCU3 von Home Matic habe ich problemlos in OpenHAB zu laufen bekommen.
Nun möchte ich meine Modbus IO Module in betrieb bekommen.

modbus_ext1.things

Code: Alles auswählen

Bridge modbus:tcp:localhostTCP [ host="192.168.0.11", port=502, id=1 ] {
// read-write for coils. Reading 4 coils, with index 4, and 5.
    // These correspond to input register numbers 000005, and 000005
    Bridge poller coils [ start=4, length=2, refresh=1000, type="coil" ] {
        // Note the zero based indexing: first coil is index 0.
        Thing data do0 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
        Thing data do1 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
    }
   // read-only for discrete inputs. Reading 4 discrete inputs, with index 1200, 1201, 1202, 1203.
    // These correspond to input register numbers 101201, 101202, 101203, 101204.
    Bridge poller discreteInputs [ start=1200, length=4, refresh=1000, type="discrete" ] {
        Thing data di0 [ readStart="0", readValueType="bit" ]
        Thing data di1 [ readStart="1", readValueType="bit" ]
        Thing data di2 [ readStart="2", readValueType="bit" ]
    }
// Write-only entry: thing is child of tcp directly. No readStart etc. need to be defined.
    // Note that the openHAB state might differ from the physical slave since it is not refreshed at all
    Thing data holding5write [ writeStart="5", writeValueType="int16", writeType="holding" ]
}
IP , Port und Modbus adresse ist richtig. Probleme habe ich jetzt aber mit den Outputs und den Inputs.

In FHEM sieht die Konfig folgendermaßen aus

Code: Alles auswählen

define IO_Garten ModbusAttr 1 10 192.168.0.11:502 TCP
attr IO_Garten userattr DbLogExclude event-on-change-reading obj-c0-len obj-c0-poll obj-c0-reading obj-c0-set obj-c0-showget obj-c1-len obj-c1-poll obj-c1-reading obj-c1-set obj-c1-showget obj-c2-len obj-c2-poll obj-c2-reading obj-c2-set obj-c2-showget obj-c3-len obj-c3-poll obj-c3-reading obj-c3-set obj-c3-showget obj-d0-len obj-d0-poll obj-d0-reading obj-d0-set obj-d0-showget obj-d1-len obj-d1-poll obj-d1-reading obj-d1-showget obj-d2-len obj-d2-poll obj-d2-reading obj-d2-showget obj-d3-len obj-d3-poll obj-d3-reading obj-d3-showget
attr IO_Garten DbLogExclude .*
attr IO_Garten event-on-change-reading .*
attr IO_Garten obj-c0-len 1
attr IO_Garten obj-c0-poll 1
attr IO_Garten obj-c0-reading OutputDO0
attr IO_Garten obj-c0-set 1
attr IO_Garten obj-c0-showget 1
attr IO_Garten obj-c1-len 1
attr IO_Garten obj-c1-poll 1
attr IO_Garten obj-c1-reading OutputDO1
attr IO_Garten obj-c1-set 1
attr IO_Garten obj-c1-showget 1
attr IO_Garten obj-c2-len 1
attr IO_Garten obj-c2-poll 1
attr IO_Garten obj-c2-reading OutputDO2
attr IO_Garten obj-c2-set 1
attr IO_Garten obj-c2-showget 1
attr IO_Garten obj-c3-len 1
attr IO_Garten obj-c3-poll 1
attr IO_Garten obj-c3-reading OutputDO3
attr IO_Garten obj-c3-set 1
attr IO_Garten obj-c3-showget 1
attr IO_Garten obj-d0-len 1
attr IO_Garten obj-d0-poll 1
attr IO_Garten obj-d0-reading InputDI0
attr IO_Garten obj-d0-showget 1
attr IO_Garten obj-d1-len 1
attr IO_Garten obj-d1-poll 1
attr IO_Garten obj-d1-reading InputDI1
attr IO_Garten obj-d1-showget 1
attr IO_Garten obj-d2-len 1
attr IO_Garten obj-d2-poll 1
attr IO_Garten obj-d2-reading InputDI2
attr IO_Garten obj-d2-showget 1
attr IO_Garten obj-d3-len 1
attr IO_Garten obj-d3-poll 1
attr IO_Garten obj-d3-reading InputDI3
attr IO_Garten obj-d3-showget 1
attr IO_Garten room Garten,MODBUS
Ich weiß leider ncith wie ich das ganze nun in OpenHAB einsetzen muß.

Kann einer helfer der eventuell ähnliches gemacht hat ?

Danke Ralf

Ralf.Kruppa
Beiträge: 3
Registriert: 2. Apr 2019 21:29

Re: Modbus ioLogic MOXA

Beitrag von Ralf.Kruppa » 11. Apr 2019 09:37

Hallo,

ich bin jetzt auf folgende Modbustabelle gestoßen die mir die Belegung entsprechend aufzeigt:

ioLogik E2212 Modbus Mapping
0xxxx Read/Write Coils (Functions 1, 5, 15)

Reference Address Data Type Description
00001 0x0000 1 bit "CH0 DO value 0: off 1: on"
00002 0x0001 1 bit "CH1 DO value 0: off 1: on"
00003 0x0002 1 bit "CH2 DO value 0: off 1: on"
00004 0x0003 1 bit "CH3 DO value 0: off 1: on"
00005 0x0004 1 bit "CH4 DO value 0: off 1: on"
00006 0x0005 1 bit "CH5 DO value 0: off 1: on"
00007 0x0006 1 bit "CH6 DO value 0: off 1: on"
00008 0x0007 1 bit "CH7 DO value 0: off 1: on"
00009 0x0008 1 bit "CH8 DO value 0: off 1: on"
00010 0x0009 1 bit "CH9 DO value 0: off 1: on"
00011 0x000A 1 bit "CH10 DO value 0: off 1: on"
00012 0x000B 1 bit "CH11 DO value 0: off 1: on"

1xxxx Read Only Coils (Function 2)

Reference Address Data Type Description
10001 0x0000 1 bit CH0 DI value
10002 0x0001 1 bit CH1 DI value
10003 0x0002 1 bit CH2 DI value
10004 0x0003 1 bit CH3 DI value
10005 0x0004 1 bit CH4 DI value
10006 0x0005 1 bit CH5 DI value
10007 0x0006 1 bit CH6 DI value
10008 0x0007 1 bit CH7 DI value
10009 0x0008 1 bit CH8 DI value
10010 0x0009 1 bit CH9 DI value
10011 0x000A 1 bit CH10 DI value
10012 0x000B 1 bit CH11 DI value


Daraus habe ich folgendes in OpenHAB abgebildet:

modbus.things

Code: Alles auswählen

Bridge modbus:tcp:garten [ host="192.168.0.12", port=502, id=1 ] {
    Bridge poller coils [ start=0, length=4, refresh=1000, type="coil" ] {
		  Thing data 12_0[ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
      Thing data 12_1[ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
		  Thing data 12_2[ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
		  Thing data 12_3[ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]	
    }

	 Bridge poller discreteInputs [ start=0, length=4, refresh=1000, type="discrete" ] {
      Thing data di0 [ readStart="0", readValueType="bit" ]
      Thing data di1 [ readStart="1", readValueType="bit" ]
      Thing data di2 [ readStart="2", readValueType="bit" ]
		  Thing data di3 [ readStart="3", readValueType="bit" ]
    }
}
modbus:items

Code: Alles auswählen

//DO 
Number Moxa_IO_12_0  { channel="modbus:data:garten:coils:12_0:number" , autopudate="true"}
Number Moxa_IO_12_1  { channel="modbus:data:garten:coils:12_1:number" , autopudate="true"}
Number Moxa_IO_12_2  { channel="modbus:data:garten:coils:12_2:number" , autopudate="true"}
Number Moxa_IO_12_3  { channel="modbus:data:garten:coils:12_3:number" , autopudate="true"}

//DI
Contact Moxa_Garten_DI0  { channel="modbus:data:garten:discreteInputs:di0:contact" , autopudate="true"}
Contact Moxa_Garten_DI1  { channel="modbus:data:garten:discreteInputs:di1:contact" , autopudate="true"}
Contact Moxa_Garten_DI2  { channel="modbus:data:garten:discreteInputs:di2:contact" , autopudate="true"}
Contact Moxa_Garten_DI3  { channel="modbus:data:garten:discreteInputs:di3:contact" , autopudate="true"}
Leider läuft dieses nicht.

Gruß Ralf

Antworten

Wer ist online?

Mitglieder in diesem Forum: Bing [Bot] und 2 Gäste