home-assistant.io icon indicating copy to clipboard operation
home-assistant.io copied to clipboard

Modbus status not updated

Open poratnir1 opened this issue 3 years ago • 6 comments

Feedback

For a while, under the new settings, coils control is working but in relay module is manually changed using dry contact, status is not updated, switch keeps previous status.

  type: serial
  method: rtu
  port: /dev/ttyUSB0
  #port: /dev/serial/by-id/usb-Silicon_Labs_CP2104_USB_to_UART_Bridge_Controller_0133D18C-if00-port0
  baudrate: 9600
  stopbits: 1
  bytesize: 8
  parity: N
  timeout: 4
  retry_on_empty: true
  retries: 10
  message_wait_milliseconds: 100

  - platform: modbus
    coils:
    #====================================Module #1=============================
   # First Floor
      - name: Switch01
        slave: 10 
        coil: 0
      - name: Switch02
        slave: 10 
        coil: 1
      - name: Switch03
        slave: 10
        coil: 2
      - name: Switch04
        slave: 10
        coil: 3

new settings: status is not updating:

modbus:
  - type: rtuovertcp
    host: 192.168.1.7
    port: 501
    timeout: 2
    switches:
      - name: Switch1
        slave: 3
        address: 0
        write_type: coil
      - name: Switch2
        slave: 3
        address: 1
        write_type: coil
      - name: Switch3
        slave: 3
        address: 2

URL

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

Version

2022.7.6

Additional information

No response

poratnir1 avatar Jul 23 '22 19:07 poratnir1

Hey there @adamchengtkc, @janiversen, @vzahradnik, mind taking a look at this feedback as it has been labeled with an integration (modbus) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

You have not added the verify part https://www.home-assistant.io/integrations/modbus/#configuring-platform-switch, so naturally the switch in HA will not update.

janiversen avatar Jul 24 '22 06:07 janiversen

Thanks for your answer...

Actually i never used verify function and all was working just fine..

How can i find the address for the verification? And in here it is referring to register while i am using coil..

i don't think you mean i need to have verification and switch per each item no?

https://www.ahatos.com/support/Manuals/REL/Ahatos_REL0808_UserGuide_Eng_v0.4.2.0.pdf

i am using this relay module..

poratnir1 avatar Jul 24 '22 20:07 poratnir1

If you want to see the effect of a switching you need to read the status (verify). It is typically the same address.

The verify function have been around for a year or so.

janiversen avatar Jul 25 '22 09:07 janiversen

As I mentioned this is not working for a while..

is it possible to get specific example?

will apricate your support , as this is not working for me for long time. tried the forum several times without success ... so either modbus is not commonly used or I just missing something..

      - name: Switch8
        slave: 3
        address: 7
        write_type: coil
        #input_type: coil
        verify:
      - name: Register7
        address: 7
        command_on: 1
        command_off: 0
        verify:
            input_type: holding
            address: 7
            state_on: 1
            state_off: 0

poratnir1 avatar Jul 25 '22 18:07 poratnir1

The part of the configuration you show seems correct for register7, for Switch8 you need to add "verify:" if you want to use input_type.

BUT you have to control with the documentation of your device, It is not normal to write to a coil and verify (read) from a holding register. Normally you write to a coil and read from the same coil.

There are examples in the doc.

janiversen avatar Jul 25 '22 19:07 janiversen

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved. If this issue is still relevant, please let us know by leaving a comment 👍 This issue has now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Sep 23 '22 20:09 github-actions[bot]