FHEM with Modbus over Network on Neuron L403 / a first step



  • Hi,

    after a hint in the FHEM.forum i can switch all Outputs:

    append FHEM with two new Modules (in the command line interface):
    update all https://raw.githubusercontent.com/ChrisD70/FHEM-Modules/master/autoupdate/mb/controls_modbus.txt

    reload 36_ModbusTCPServer.pm
    reload 37_ModbusCoil.pm
    reload 37_ModbusRegister.pm

    add to fhem.cfg

    #define Modbus Server 1 (Relays)
    #####################################
    define ModbusTCPRelay ModbusTCPServer 127.0.0.1:502
    attr ModbusTCPRelay queueDelay 20
    attr ModbusTCPRelay room Modbus
    
    #define Relay Group 1
    #####################################
    define DigitalOut1.01 ModbusCoil 0 1
    attr DigitalOut1.01 IODev ModbusTCPRelay
    attr DigitalOut1.01 event-on-change-reading .*
    attr DigitalOut1.01 room Modbus
    define DigitalOut1.02 ModbusCoil 0 2
    attr DigitalOut1.02 IODev ModbusTCPRelay
    attr DigitalOut1.02 event-on-change-reading .*
    attr DigitalOut1.02 room Modbus
    define DigitalOut1.03 ModbusCoil 0 3
    attr DigitalOut1.03 IODev ModbusTCPRelay
    attr DigitalOut1.03 event-on-change-reading .*
    attr DigitalOut1.03 room Modbus
    define DigitalOut1.04 ModbusCoil 0 4
    attr DigitalOut1.04 IODev ModbusTCPRelay
    attr DigitalOut1.04 event-on-change-reading .*
    attr DigitalOut1.04 room Modbus
    
    #define Relay Group 2
    #####################################
    define DigitalOut2.01 ModbusCoil 2 1
    attr DigitalOut2.01 IODev ModbusTCPRelay
    attr DigitalOut2.01 event-on-change-reading .*
    attr DigitalOut2.01 room Modbus
    define DigitalOut2.02 ModbusCoil 2 2
    attr DigitalOut2.02 IODev ModbusTCPRelay
    attr DigitalOut2.02 event-on-change-reading .*
    attr DigitalOut2.02 room Modbus
    define DigitalOut2.03 ModbusCoil 2 3
    attr DigitalOut2.03 IODev ModbusTCPRelay
    attr DigitalOut2.03 event-on-change-reading .*
    attr DigitalOut2.03 room Modbus
    define DigitalOut2.04 ModbusCoil 2 4
    attr DigitalOut2.04 IODev ModbusTCPRelay
    attr DigitalOut2.04 event-on-change-reading .*
    attr DigitalOut2.04 room Modbus
    
    define DigitalOut2.05 ModbusCoil 2 5
    attr DigitalOut2.05 IODev ModbusTCPRelay
    attr DigitalOut2.05 event-on-change-reading .*
    attr DigitalOut2.05 room Modbus
    define DigitalOut2.06 ModbusCoil 2 6
    attr DigitalOut2.06 IODev ModbusTCPRelay
    attr DigitalOut2.06 event-on-change-reading .*
    attr DigitalOut2.06 room Modbus
    define DigitalOut2.07 ModbusCoil 2 7
    attr DigitalOut2.07 IODev ModbusTCPRelay
    attr DigitalOut2.07 event-on-change-reading .*
    attr DigitalOut2.07 room Modbus
    define DigitalOut2.08 ModbusCoil 2 8
    attr DigitalOut2.08 IODev ModbusTCPRelay
    attr DigitalOut2.08 event-on-change-reading .*
    attr DigitalOut2.08 room Modbus
    
    
    define DigitalOut2.09 ModbusCoil 2 9
    attr DigitalOut2.09 IODev ModbusTCPRelay
    attr DigitalOut2.09 event-on-change-reading .*
    attr DigitalOut2.09 room Modbus
    define DigitalOut2.10 ModbusCoil 2 10
    attr DigitalOut2.10 IODev ModbusTCPRelay
    attr DigitalOut2.10 event-on-change-reading .*
    attr DigitalOut2.10 room Modbus
    define DigitalOut2.11 ModbusCoil 2 11
    attr DigitalOut2.11 IODev ModbusTCPRelay
    attr DigitalOut2.11 event-on-change-reading .*
    attr DigitalOut2.11 room Modbus
    define DigitalOut2.12 ModbusCoil 2 12
    attr DigitalOut2.12 IODev ModbusTCPRelay
    attr DigitalOut2.12 event-on-change-reading .*
    attr DigitalOut2.12 room Modbus
    
    define DigitalOut2.13 ModbusCoil 2 13
    attr DigitalOut2.13 IODev ModbusTCPRelay
    attr DigitalOut2.13 event-on-change-reading .*
    attr DigitalOut2.13 room Modbus
    define DigitalOut2.14 ModbusCoil 2 14
    attr DigitalOut2.14 IODev ModbusTCPRelay
    attr DigitalOut2.14 event-on-change-reading .*
    attr DigitalOut2.14 room Modbus
    define DigitalOut2.15 ModbusCoil 2 15
    attr DigitalOut2.15 IODev ModbusTCPRelay
    attr DigitalOut2.15 event-on-change-reading .*
    attr DigitalOut2.15 room Modbus
    define DigitalOut2.16 ModbusCoil 2 16
    attr DigitalOut2.16 IODev ModbusTCPRelay
    attr DigitalOut2.16 event-on-change-reading .*
    attr DigitalOut2.16 room Modbus
    
    
    define DigitalOut2.17 ModbusCoil 2 17
    attr DigitalOut2.17 IODev ModbusTCPRelay
    attr DigitalOut2.17 event-on-change-reading .*
    attr DigitalOut2.17 room Modbus
    define DigitalOut2.18 ModbusCoil 2 18
    attr DigitalOut2.18 IODev ModbusTCPRelay
    attr DigitalOut2.18 event-on-change-reading .*
    attr DigitalOut2.18 room Modbus
    define DigitalOut2.19 ModbusCoil 2 19
    attr DigitalOut2.19 IODev ModbusTCPRelay
    attr DigitalOut2.19 event-on-change-reading .*
    attr DigitalOut2.19 room Modbus
    define DigitalOut2.20 ModbusCoil 2 20
    attr DigitalOut2.20 IODev ModbusTCPRelay
    attr DigitalOut2.20 event-on-change-reading .*
    attr DigitalOut2.20 room Modbus
    
    define DigitalOut2.21 ModbusCoil 2 21
    attr DigitalOut2.21 IODev ModbusTCPRelay
    attr DigitalOut2.21 event-on-change-reading .*
    attr DigitalOut2.21 room Modbus
    define DigitalOut2.22 ModbusCoil 2 22
    attr DigitalOut2.22 IODev ModbusTCPRelay
    attr DigitalOut2.22 event-on-change-reading .*
    attr DigitalOut2.22 room Modbus
    define DigitalOut2.23 ModbusCoil 2 23
    attr DigitalOut2.23 IODev ModbusTCPRelay
    attr DigitalOut2.23 event-on-change-reading .*
    attr DigitalOut2.23 room Modbus
    define DigitalOut2.24 ModbusCoil 2 24
    attr DigitalOut2.24 IODev ModbusTCPRelay
    attr DigitalOut2.24 event-on-change-reading .*
    attr DigitalOut2.24 room Modbus
    
    define DigitalOut2.25 ModbusCoil 2 25
    attr DigitalOut2.25 IODev ModbusTCPRelay
    attr DigitalOut2.25 event-on-change-reading .*
    attr DigitalOut2.25 room Modbus
    define DigitalOut2.26 ModbusCoil 2 26
    attr DigitalOut2.26 IODev ModbusTCPRelay
    attr DigitalOut2.26 event-on-change-reading .*
    attr DigitalOut2.26 room Modbus
    define DigitalOut2.27 ModbusCoil 2 27
    attr DigitalOut2.27 IODev ModbusTCPRelay
    attr DigitalOut2.27 event-on-change-reading .*
    attr DigitalOut2.27 room Modbus
    define DigitalOut2.28 ModbusCoil 2 28
    attr DigitalOut2.28 IODev ModbusTCPRelay
    attr DigitalOut2.28 event-on-change-reading .*
    attr DigitalOut2.28 room Modbus
    
    #define Relay Group 3
    #####################################
    define DigitalOut3.01 ModbusCoil 3 1
    attr DigitalOut3.01 IODev ModbusTCPRelay
    attr DigitalOut3.01 event-on-change-reading .*
    attr DigitalOut3.01 room Modbus
    define DigitalOut3.02 ModbusCoil 3 2
    attr DigitalOut3.02 IODev ModbusTCPRelay
    attr DigitalOut3.02 event-on-change-reading .*
    attr DigitalOut3.02 room Modbus
    define DigitalOut3.03 ModbusCoil 3 3
    attr DigitalOut3.03 IODev ModbusTCPRelay
    attr DigitalOut3.03 event-on-change-reading .*
    attr DigitalOut3.03 room Modbus
    define DigitalOut3.04 ModbusCoil 3 4
    attr DigitalOut3.04 IODev ModbusTCPRelay
    attr DigitalOut3.04 event-on-change-reading .*
    attr DigitalOut3.04 room Modbus
    
    define DigitalOut3.05 ModbusCoil 3 5
    attr DigitalOut3.05 IODev ModbusTCPRelay
    attr DigitalOut3.05 event-on-change-reading .*
    attr DigitalOut3.05 room Modbus
    define DigitalOut3.06 ModbusCoil 3 6
    attr DigitalOut3.06 IODev ModbusTCPRelay
    attr DigitalOut3.06 event-on-change-reading .*
    attr DigitalOut3.06 room Modbus
    define DigitalOut3.07 ModbusCoil 3 7
    attr DigitalOut3.07 IODev ModbusTCPRelay
    attr DigitalOut3.07 event-on-change-reading .*
    attr DigitalOut3.07 room Modbus
    define DigitalOut3.08 ModbusCoil 3 8
    attr DigitalOut3.08 IODev ModbusTCPRelay
    attr DigitalOut3.08 event-on-change-reading .*
    attr DigitalOut3.08 room Modbus
    
    
    define DigitalOut3.09 ModbusCoil 3 9
    attr DigitalOut3.09 IODev ModbusTCPRelay
    attr DigitalOut3.09 event-on-change-reading .*
    attr DigitalOut3.09 room Modbus
    define DigitalOut3.10 ModbusCoil 3 10
    attr DigitalOut3.10 IODev ModbusTCPRelay
    attr DigitalOut3.10 event-on-change-reading .*
    attr DigitalOut3.10 room Modbus
    define DigitalOut3.11 ModbusCoil 3 11
    attr DigitalOut3.11 IODev ModbusTCPRelay
    attr DigitalOut3.11 event-on-change-reading .*
    attr DigitalOut3.11 room Modbus
    define DigitalOut3.12 ModbusCoil 3 12
    attr DigitalOut3.12 IODev ModbusTCPRelay
    attr DigitalOut3.12 event-on-change-reading .*
    attr DigitalOut3.12 room Modbus
    
    define DigitalOut3.13 ModbusCoil 3 13
    attr DigitalOut3.13 IODev ModbusTCPRelay
    attr DigitalOut3.13 event-on-change-reading .*
    attr DigitalOut3.13 room Modbus
    define DigitalOut3.14 ModbusCoil 3 14
    attr DigitalOut3.14 IODev ModbusTCPRelay
    attr DigitalOut3.14 event-on-change-reading .*
    attr DigitalOut3.14 room Modbus
    define DigitalOut3.15 ModbusCoil 3 15
    attr DigitalOut3.15 IODev ModbusTCPRelay
    attr DigitalOut3.15 event-on-change-reading .*
    attr DigitalOut3.15 room Modbus
    define DigitalOut3.16 ModbusCoil 3 16
    attr DigitalOut3.16 IODev ModbusTCPRelay
    attr DigitalOut3.16 event-on-change-reading .*
    attr DigitalOut3.16 room Modbus
    
    
    define DigitalOut3.17 ModbusCoil 3 17
    attr DigitalOut3.17 IODev ModbusTCPRelay
    attr DigitalOut3.17 event-on-change-reading .*
    attr DigitalOut3.17 room Modbus
    define DigitalOut3.18 ModbusCoil 3 18
    attr DigitalOut3.18 IODev ModbusTCPRelay
    attr DigitalOut3.18 event-on-change-reading .*
    attr DigitalOut3.18 room Modbus
    define DigitalOut3.19 ModbusCoil 3 19
    attr DigitalOut3.19 IODev ModbusTCPRelay
    attr DigitalOut3.19 event-on-change-reading .*
    attr DigitalOut3.19 room Modbus
    define DigitalOut3.20 ModbusCoil 3 20
    attr DigitalOut3.20 IODev ModbusTCPRelay
    attr DigitalOut3.20 event-on-change-reading .*
    attr DigitalOut3.20 room Modbus
    
    define DigitalOut3.21 ModbusCoil 3 21
    attr DigitalOut3.21 IODev ModbusTCPRelay
    attr DigitalOut3.21 event-on-change-reading .*
    attr DigitalOut3.21 room Modbus
    define DigitalOut3.22 ModbusCoil 3 22
    attr DigitalOut3.22 IODev ModbusTCPRelay
    attr DigitalOut3.22 event-on-change-reading .*
    attr DigitalOut3.22 room Modbus
    define DigitalOut3.23 ModbusCoil 3 23
    attr DigitalOut3.23 IODev ModbusTCPRelay
    attr DigitalOut3.23 event-on-change-reading .*
    attr DigitalOut3.23 room Modbus
    define DigitalOut3.24 ModbusCoil 3 24
    attr DigitalOut3.24 IODev ModbusTCPRelay
    attr DigitalOut3.24 event-on-change-reading .*
    attr DigitalOut3.24 room Modbus
    
    define DigitalOut3.25 ModbusCoil 3 25
    attr DigitalOut3.25 IODev ModbusTCPRelay
    attr DigitalOut3.25 event-on-change-reading .*
    attr DigitalOut3.25 room Modbus
    define DigitalOut3.26 ModbusCoil 3 26
    attr DigitalOut3.26 IODev ModbusTCPRelay
    attr DigitalOut3.26 event-on-change-reading .*
    attr DigitalOut3.26 room Modbus
    define DigitalOut3.27 ModbusCoil 3 27
    attr DigitalOut3.27 IODev ModbusTCPRelay
    attr DigitalOut3.27 event-on-change-reading .*
    attr DigitalOut3.27 room Modbus
    define DigitalOut3.28 ModbusCoil 3 28
    attr DigitalOut3.28 IODev ModbusTCPRelay
    attr DigitalOut3.28 event-on-change-reading .*
    attr DigitalOut3.28 room Modbus
    

    ...this is only 'onway', no. The next step ist to read the state oft the output's...

    the FHEM Modules in the wiki:
    https://wiki.fhem.de/wiki/Dimplex_Wärmepumpenmanager


  • administrators

    @burnscm Thanks for the code! Looks great :) Please keep this updated



  • Hi,

    I tried to control a Neuron xS10 directly via ModbusRTU over FHEM but I can't get it work :-(

    I tried this in my fhem.cfg

    #Neuron xS10
    define NeuronModbus Modbus /dev/ttyUSB0@19200,8,N,1
    define NeuronxS10 ModbusAttr 0 60 RTU
    
    define DigitalOut1 ModbusCoil 0 0
    attr DigitalOut1 IODev NeuronxS10
    attr DigitalOut1 event-on-change-reading .*
    

    The RX-Led on the extension stay's green. But I can't get a relay to change between on/off. No LED of an relay ist getting on.

    So is there anybody who could help me please or give me an hint to an conclusion?

    Thx a lot

    Negropo