Modbus TCP Interfacer

Hi
I’m playing about with the modbus TCP interfacer that’s built in with the current version of EmonCMS, though I am getting a “WARNING MainThread ModbusTCP thread is dead”
As you’ll see, I’ve tried to reduce the one register to get it running.

In EmonHUB config I have the following…

[[ModbusTCP]]     
    # this interfacer retrieves register information from modbusTCP clients 
    # retrieve register information from modbus TCP documentation for your inverter.
    # Information here is designed for Fronius Symo 3 phase inverter.
    Type = EmonModbusTcpInterfacer
    [[[init_settings]]]
        modbus_IP = 192.168.10.33   # ip address of client to retrieve data from
        modbus_port = 502          # Portclient listens on
    [[[runtimesettings]]]
        # list of names of items being retrieved
#        rName = DC_Current_1,DC_Voltage_1,DC_Current_2,DC_Voltage_2,Power,AC_Current,Frequency,Temperature,Residual_Current,Total_Yield,Daily_Yield
        rName = Daily_Yield
        # List of starting registers for items listed above
#        register = 30769,30771,30957,30959,30775,30795,30803,30953,31247,30513,30517
        register = 30517
        # List of # of registers used for each item 
#        nReg = 1,1,1,1,1,1,1,1,1,1,1
        nReg = 1
        # Data type for each item above
#        rType = float32,float32,float32,float32,float32,unint32,unint32,float32,float32,uint64,uint64
        rType = uint64
        # nodeid used to match with node definition in nodes section below. Can be set to any integer value not previously used.
        nodeId = 15
        # Channel to publish data to should leave as ToEmonCMS
        pubchannels = ToEmonCMS,
        # time in seconds between checks, This is in addition to emonhub_interfacer.run() sleep time of .01
        # use this value to set the frequency of data retrieval from modbus client
        interval = 1 

AND LATER DOWN THE PAGE....

[[15]]
    nodename = Inverter
    [[[rx]]]
        names = Daily_Yield
        datacodes = Q
        scales = 1
        units = Wh

Regards
Dave

I know its a little late, have you managed to get it to work?

For my register 40002 i needed to use 259. i think its to do with the start/first register.

I have tried to contact the person who wrote the code for help but i have been unable.

Paul

Hi Paul and Dave,
I have been playing around with the modbus interfacer too.
currently polling one Arduino slave, very much early days, the values are there in the input.

Just a comment on the Daves setup, an unsigned 64 bit integer (uint64) will fill 4 registers not 1 nReg from my understanding of modbus registers = 16 bits. Also the use of scale vs scales in the definition of the node and datacode vs datacodes might be an issue for single read of data.

But I do have a question: How would I write to the modbus slave? Is it best done through openHab? and has any body done it?

Thanks Dave M.

HI Dave
TBH I have put the modbus on the back burner as I couldn’t get it going, if you do get it going please can you let us know what you did.

Regards
Dave