Modbus TCP

It would help more for you to share your modbus config and a link to the manual you have for your device please?

Hi all,

i have found this topic having really usefull information.

i have been searching for a really long time to find information to input the CCGX in HA and i could not find anywhere right information.

Using this info i think i would go for Modbus instead of MQTT.
Still i have a few troubles to know where to start now.

Does anyone have more information regarding how i can install Modbus on my HA installation? Iā€™m rather new to this and a bit of help in how i can make the information into my dashboard would really be appreciated .

Thanks :slight_smile:

There is no useful manual for it, other than this http://www.hi-flying.com/elfin-ew10-elfin-ew11

Regarding the hassio config itā€™s just de default with a different port and ip

Looking for someone with a similar setup who has gotten it to work

If you can, please post your config so I can confirm that is not the problem.

You also need the manual for the Eastron modbus kwh-meterā€¦thats where the information to connect to the registers will be.

Cheers.

Hi to all,
i would integrate home assistant with my webserver modbus slave tcp.
Is there a possibility to see if integration is ok or not?
Iā€™ve anything in my home assistant logs.

Configuration.yaml:

#ModBus Ave
modbus:
  name: ave
  type: TCP
  host: 192.168.1.10
  port: 502

A switch test:

- platform: modbus
  coils:
    - name: Switch1
      hub: ave
      slave: 1
      coil: 13
    - name: Switch2
      slave: 2
      coil: 14
  registers:
    - name: Register1
      hub: ave
      slave: 1
      register: 11
      command_on: 1
      command_off: 0

Log:

Invalid config for [modbus]: extra keys not allowed @ data['modbus'][0]['host']. Got None
not a valid value for dictionary value @ data['modbus'][0]['type']. Got None
required key not provided @ data['modbus'][0]['baudrate']. Got None
required key not provided @ data['modbus'][0]['bytesize']. Got None
required key not provided @ data['modbus'][0]['method']. Got None
required key not provided @ data['modbus'][0]['parity']. Got None
required key not provided @ data['modbus'][0]['stopbits']. Got None. (See /config/configuration.yaml, line 45). 

Thank you so much for any help.
Regards,

Alessandro

1 Like

Hi @alessandro.bardi You have a problem in your modbus hub config.
Your ā€˜TCPā€™ is not the same as the corrrect ā€˜tcpā€™

See the docs here for the correct format for a modbus hub.

# Example configuration.yaml entry for a TCP connection
modbus:
  name: hub1
  type: tcp
  host: IP_ADDRESS
  port: 2020

Fix that and test again and you could be good to go I think!

Hi Steave,
thanks for your reply.

Iā€™ve fix that but now iā€™ve these errors:

 Invalid config for [switch.modbus]: required key not provided @ data['coils'][0]['slave']. Got None. (See ?, line ?). 

Iā€™m newby on modbus, i donā€™t know where can i take coils, slave and register numbers from my modbus.
Thank you so much.
Regards,

Alessandro

@alessandro.bardi Progress at least as the hub errors are gone.

You need to consult the manual for your modbus device to obtain that information.

Iā€™ve this scheme and i would control only ā€œ44ABRXā€:

The question is: how can i check the status of my entities?
Which code identify a single light?
Is there a guide to study the mechanism?

Thanks for your patience,

Alessandro

Hi,
finally iā€™ve found all registers of my lights.

Iā€™ve a bit problem with output values of my thermostat:
Thermostat temp goes out from Modbus in HEX value like this: ā€œ80AFā€

I would keeps out the first two bytes (80) and convert to decimal the others two (AF).

Iā€™ve tried with this code but climate entitiy doesnā€™t create from HA.

Thanks in advance for any help,

Alessandro

When I bumped into this error "Invalid config for [switch.modbus]: required key not provided @ data[ā€˜coilsā€™][0][ā€˜slaveā€™]. Got None. (See ?, line ?). ", I didnā€™t have a ā€œslaveā€ defined. The documentation mentions ā€˜slaveā€™ is optional for Modbus over TCP, but for me it was definitely ā€œrequiredā€.
This works for me on a Sealevel 463-E :

switch:
  - platform: modbus
    scan_interval: 3
    coils:
    -       name: sea0
            hub: sealevel
            slave: 1
            coil: 0
    -       name: sea1
            hub: sealevel
            slave: 1
            coil: 1

With the above, the switches will show up on the overview page and be functional.

I donā€™t manage to show my modbus climate on Hassio :frowning:
Iā€™ve this code on my climates.yaml:

Cattura

But no climate showed on Hassio.
This is my modbus bit istructions:

The temp values are in bin or hex format?
I donā€™t Know, and maybe the issue is there.

Any help is apreciated.
Regards,

Alessandro

It looks like:

40128 = Use a unsigned integer /10. value= 202 - 20.2 C
40129= setpoint, you have to build the integer from the binary, combination of o/off in b13, and the SP , same format. Setpoint of 20.2 C = 202 integer in , since this will always be below 100,
then you can use a single word write on b7-b0,
You probably cannot use the Climate object, try with read/write Modbus first.

Download the Chipkin Modbus testing tool, you can build your numbers, and read/write to to modbus registers.

salve,
stĆ² provando a far dialogare HA con un simulatore PLC server, la comunicazione avviene, e se cambio i dati sul PLC me li cambia anche nella plancia di HA, ma se volessi fare il contrario, ovvero scrivere da HA e far cambiare il valore nel PLC ĆØ possibile?