core: Modbus not working correctly with TCP/IP WAGO-750-352

The problem

I am using WAGO 750-352 for switching on off lights. This unit has optional sensors and switches. Switches are set on addresses starting from 0 to 511. Their current state is however read on coil+512 - meaning adress 0 state is read from 512, 1 from 513 etc.

Previously I hardcoded this into def _read_coil function on my custom modbus fork but now I saw that it is now possible to set verify_register for registers. Could we please also add this to coils?

I have implemented it here: https://github.com/JurajNyiri/home-assistant/commit/e761a2bdb45fc4c64c3a4a5a8ef754c13ef13362 Shall I open PR or is my configuration simply not correct and there is already a way to do this?

What I know that it is indeed a coil, not a register. Without the read address adjustments the readings are not correct.

What is version of Home Assistant Core has the issue?

core-2021.4.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

modbus

Link to integration documentation on our website

https://www.home-assistant.io/integrations/modbus/

Example YAML snippet

custom_modbus:
  - name: hub1
    type: udp
    host: 192.168.100.3
    port: 502
    switches:
      - name: STerasa
        address: 24
        scan_interval: 1
        input_type: coil

Anything in the logs that might be useful for us?

N/A

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (7 by maintainers)

Most upvoted comments

2021.4.6 will not solve your problem. And I just see I was wrong too. The PR that solves your problem is scheduled for 2021.6. Sorry about the confusion.

VERIFY_STATE as well as the old configuration style no longer exist. now you need to add

verify:
       address: 17
       ....

which allows you to set different types and adresses for the write and the read.

All is on dev if you want to try it.

PR #49386 solves your problem, you can not set address/type for writing and verifying. https://github.com/home-assistant/core/pull/49386

I am not sure why this was not added automatically.

@JurajNyiri your idea/request is in my plans as I walk through all the modbus platforms to make them more consistent. I expect your PR will be ready soon.