Modbus stop working when I upgrade hassio version

I’m using hassio to communicate with PLC via TCP modbus. It work perfectly with all hassio version 0.92.2 and before. Now I upgrade to 0.97.2. It stop working.
I return to old version and the communication start working again.

Any suggestions?

Any chance you could share any errors in your logs and maybe your modbus config?

1 Like

please check below my configuration:

modbus:
  name: modbus
  type: tcp
  host: 192.168.1.75
  port: 502
  timeout: 5



sensor:
 - platform: modbus
   registers:
    - name: water temperature
      unit_of_measurement: °C
      slave: 1
      register: 4096
      scale: 0.1
      precision: 1
    - name: water sv
      unit_of_measurement: °C
      slave: 1
      register: 4097
      scale: 0.1
    - name: Home Amp
      unit_of_measurement: A
      slave: 1
      register: 4098
      scale: 0.1
      precision: 1
    - name: Sensor4
      unit_of_measurement: mg
      slave: 1
      register: 4099
    - name: door
      device_class: door
      slave: 1
      register: 4208
 - platform: template
   sensors:
    frontdoor:
      value_template: >-
        {% if states.sensor.door.state == '1' %}
          Open
        {% elif states.sensor.door.state == '0' %}
          Closed
        {% else %}
          n/a
        {% endif %}
      icon_template: >
        {% if states.sensor.door.state == '1' %}
          mdi:door-open
        {% elif states.sensor.door.state == '0' %}
          mdi:door-closed
        {% else %}
          mdi:help
        {% endif %} 
      
 - platform: broadlink
   host: 192.168.1.64
   mac: B4:43:0D:38:B7:1E
   monitored_conditions:
      - 'temperature'
 - platform: time_date
   display_options:
   - 'time'



switch:
  - platform: modbus
    slave: 1
    coils:
    - name: master bedroom
      slave: 1
      coil: 2648
    - name: master bath
      slave: 1
      coil: 2649
    - name: small bath
      slave: 1
      coil: 2650
    - name: room entrance
      slave: 1
      coil: 2651
    - name: kids bedroom
      slave: 1
      coil: 2652
    - name: blue bedroom
      slave: 1
      coil: 2653
    - name: water pump
      slave: 1
      coil: 2355
    - name: entrance spot
      slave: 1
      coil: 2658
    - name: entrance traya
      slave: 1
      coil: 2660
    - name: outdoor lamp
      slave: 1
      coil: 2661
    - name: guest bath
      slave: 1
      coil: 2662
    - name: red mirror
      slave: 1
      coil: 2663
    - name: play room
      slave: 1
      coil: 2664 
    - name: salon traya 
      slave: 1
      coil: 2668 
    - name: dinner traya
      slave: 1
      coil: 2669
    - name: salon spot
      slave: 1
      coil: 2670
    - name: doorsensor
      slave: 1
      coil: 2060

      

      
      
light:
  - platform: switch
    name: master bedroom
    entity_id: switch.master_bedroom
  - platform: switch
    name: master bath
    entity_id: switch.master_bath
  - platform: switch
    name: small bath
    entity_id: switch.small_bath
  - platform: switch
    name: room entrance
    entity_id: switch.room_entrance
  - platform: switch
    name: kids bedroom
    entity_id: switch.kids_bedroom
  - platform: switch
    name: blue bedroom
    entity_id: switch.blue_bedroom
  - platform: switch
    name: entrance spot
    entity_id: switch.entrance_spot
  - platform: switch
    name: entrance traya
    entity_id: switch.entrance_traya
  - platform: switch
    name: outdoor lamp
    entity_id: switch.outdoor_lamp
  - platform: switch
    name: guest bath
    entity_id: switch.guest_bath
  - platform: switch
    name: red mirror
    entity_id: switch.red_mirror
  - platform: switch
    name: play room
    entity_id: switch.play_room
  - platform: switch
    name: salon traya
    entity_id: switch.salon_traya 
  - platform: switch
    name: dinner traya
    entity_id: switch.dinner_traya
  - platform: switch
    name: salon spot
    entity_id: switch.salon_spot
  - platform: groupmodbus:
  name: modbus
  type: tcp
  host: 192.168.1.75
  port: 502
  timeout: 5



sensor:
 - platform: modbus
   registers:
    - name: water temperature
      unit_of_measurement: °C
      slave: 1
      register: 4096
      scale: 0.1
      precision: 1
    - name: water sv
      unit_of_measurement: °C
      slave: 1
      register: 4097
      scale: 0.1
    - name: Home Amp
      unit_of_measurement: A
      slave: 1
      register: 4098
      scale: 0.1
      precision: 1
    - name: Sensor4
      unit_of_measurement: mg
      slave: 1
      register: 4099
    - name: door
      device_class: door
      slave: 1
      register: 4208
 - platform: template
   sensors:
    frontdoor:
      value_template: >-
        {% if states.sensor.door.state == '1' %}
          Open
        {% elif states.sensor.door.state == '0' %}
          Closed
        {% else %}
          n/a
        {% endif %}
      icon_template: >
        {% if states.sensor.door.state == '1' %}
          mdi:door-open
        {% elif states.sensor.door.state == '0' %}
          mdi:door-closed
        {% else %}
          mdi:help
        {% endif %} 
      
 - platform: broadlink
   host: 192.168.1.64
   mac: B4:43:0D:38:B7:1E
   monitored_conditions:
      - 'temperature'
 - platform: time_date
   display_options:
   - 'time'



switch:
  - platform: modbus
    slave: 1
    coils:
    - name: master bedroom
      slave: 1
      coil: 2648
    - name: master bath
      slave: 1
      coil: 2649
    - name: small bath
      slave: 1
      coil: 2650
    - name: room entrance
      slave: 1
      coil: 2651
    - name: kids bedroom
      slave: 1
      coil: 2652
    - name: blue bedroom
      slave: 1
      coil: 2653
    - name: water pump
      slave: 1
      coil: 2355
    - name: entrance spot
      slave: 1
      coil: 2658
    - name: entrance traya
      slave: 1
      coil: 2660
    - name: outdoor lamp
      slave: 1
      coil: 2661
    - name: guest bath
      slave: 1
      coil: 2662
    - name: red mirror
      slave: 1
      coil: 2663
    - name: play room
      slave: 1
      coil: 2664 
    - name: salon traya 
      slave: 1
      coil: 2668 
    - name: dinner traya
      slave: 1
      coil: 2669
    - name: salon spot
      slave: 1
      coil: 2670
    - name: doorsensor
      slave: 1
      coil: 2060

      

      
      
light:
  - platform: switch
    name: master bedroom
    entity_id: switch.master_bedroom
  - platform: switch
    name: master bath
    entity_id: switch.master_bath
  - platform: switch
    name: small bath
    entity_id: switch.small_bath
  - platform: switch
    name: room entrance
    entity_id: switch.room_entrance
  - platform: switch
    name: kids bedroom
    entity_id: switch.kids_bedroom
  - platform: switch
    name: blue bedroom
    entity_id: switch.blue_bedroom
  - platform: switch
    name: entrance spot
    entity_id: switch.entrance_spot
  - platform: switch
    name: entrance traya
    entity_id: switch.entrance_traya
  - platform: switch
    name: outdoor lamp
    entity_id: switch.outdoor_lamp
  - platform: switch
    name: guest bath
    entity_id: switch.guest_bath
  - platform: switch
    name: red mirror
    entity_id: switch.red_mirror
  - platform: switch
    name: play room
    entity_id: switch.play_room
  - platform: switch
    name: salon traya
    entity_id: switch.salon_traya 
  - platform: switch
    name: dinner traya
    entity_id: switch.dinner_traya
  - platform: switch
    name: salon spot
    entity_id: switch.salon_spot
  - platform: group
    name: salon Lights
    entities:
      - light.salon_traya 
      - light.salon_spot
      - light.dinner_traya

    name: salon Lights
    entities:
      - light.salon_traya 
      - light.salon_spot
      - light.dinner_traya

Please check the configuration in my reply

@marcelkhalaf

Your modbus hub config:

modbus:
  name: modbus # so from now on your modbus 'hub' is called 'modbus'
  type: tcp
  host: 192.168.1.75
  port: 502
  timeout: 5

I am a little concerned by that choice of name…it could confuse you?
Consider using something like ‘hub1’ BUT For now we move on with your hub = modbus

SO…
Your modbus sensor config: REQUIRES A HUB NAME FOR EACH SENSOR = hub: modbus

sensor:
 - platform: modbus
   registers:
    - name: water temperature
      hub: modbus
      unit_of_measurement: °C
      slave: 1
      register: 4096
      scale: 0.1
      precision: 1

To confirm the requirements please read here: https://www.home-assistant.io/integrations/sensor.modbus/

I suggest you should correct that (for all sensors) and then report back here what you find please.

i change hub1 to modbus in all senors and switch also i upgrade to hassio version 0.100
but im still facing the same problem. show unavailable for all sesnors and switch.

i restore to old version 0.92.2 (see attached photo ) and return to work with below configuration even without mention any hub.

modbus:
  type: tcp
  host: 192.168.1.75
  port: 502
  timeout: 5



sensor:
 - platform: modbus
   registers:
    - name: water temperature
      unit_of_measurement: °C
      slave: 1
      register: 4096
      scale: 0.1
      precision: 1
    - name: water sv
      unit_of_measurement: °C
      slave: 1
      register: 4097
      scale: 0.1
    - name: Home Amp
      unit_of_measurement: A
      slave: 1
      register: 4098
      scale: 0.1
      precision: 1
    - name: Sensor4
      unit_of_measurement: mg
      slave: 1
      register: 4099
    - name: door
      device_class: door
      slave: 1
      register: 4208
 - platform: template
   sensors:
    frontdoor:
      value_template: >-
        {% if states.sensor.door.state == '1' %}
          Open
        {% elif states.sensor.door.state == '0' %}
          Closed
        {% else %}
          n/a
        {% endif %}
      icon_template: >
        {% if states.sensor.door.state == '1' %}
          mdi:door-open
        {% elif states.sensor.door.state == '0' %}
          mdi:door-closed
        {% else %}
          mdi:help
        {% endif %} 
      
 - platform: broadlink
   host: 192.168.1.64
   mac: B4:43:0D:38:B7:1E
   monitored_conditions:
      - 'temperature'
 - platform: time_date
   display_options:
   - 'time'



switch:
  - platform: modbus
    slave: 1
    coils:
    - name: master bedroom
      slave: 1
      coil: 2648
    - name: master bath
      slave: 1
      coil: 2649
    - name: small bath
      slave: 1
      coil: 2650
    - name: room entrance
      slave: 1
      coil: 2651
    - name: kids bedroom
      slave: 1
      coil: 2652
    - name: blue bedroom
      slave: 1
      coil: 2653
    - name: water pump
      slave: 1
      coil: 2355
    - name: entrance spot
      slave: 1
      coil: 2658
    - name: entrance traya
      slave: 1
      coil: 2660
    - name: outdoor lamp
      slave: 1
      coil: 2661
    - name: guest bath
      slave: 1
      coil: 2662
    - name: red mirror
      slave: 1
      coil: 2663
    - name: play room
      slave: 1
      coil: 2664 
    - name: salon traya 
      slave: 1
      coil: 2668 
    - name: dinner traya
      slave: 1
      coil: 2669
    - name: salon spot
      slave: 1
      coil: 2670
    - name: doorsensor
      slave: 1
      coil: 2060

      

      
      
light:
  - platform: switch
    name: master bedroom
    entity_id: switch.master_bedroom
  - platform: switch
    name: master bath
    entity_id: switch.master_bath
  - platform: switch
    name: small bath
    entity_id: switch.small_bath
  - platform: switch
    name: room entrance
    entity_id: switch.room_entrance
  - platform: switch
    name: kids bedroom
    entity_id: switch.kids_bedroom
  - platform: switch
    name: blue bedroom
    entity_id: switch.blue_bedroom
  - platform: switch
    name: entrance spot
    entity_id: switch.entrance_spot
  - platform: switch
    name: entrance traya
    entity_id: switch.entrance_traya
  - platform: switch
    name: outdoor lamp
    entity_id: switch.outdoor_lamp
  - platform: switch
    name: guest bath
    entity_id: switch.guest_bath
  - platform: switch
    name: red mirror
    entity_id: switch.red_mirror
  - platform: switch
    name: play room
    entity_id: switch.play_room
  - platform: switch
    name: salon traya
    entity_id: switch.salon_traya 
  - platform: switch
    name: dinner traya
    entity_id: switch.dinner_traya
  - platform: switch
    name: salon spot
    entity_id: switch.salon_spot
  - platform: group
    name: salon Lights
    entities:
      - light.salon_traya 
      - light.salon_spot
      - light.dinner_traya

The implementation to allow multiple hubs in modbus was made in 088.8 from memory so from then on it “should” have been necessary for you to setup a hub name. I really can’t explain why yours is working with that last config you posted in 0.92.2 but hey thats good it works.

If you ever want to move forward you will need to read up on how hubs work and try again. Is it possible for you to run a separate hassio version 0.100 and get it working in that installation? Just a thought.

PS: Is it too late for you to post what your config looked like that failed to work?
I would still like to help you move forward with a working modbus config so post again if you want to have a crack at getting it working.

dear wellsy,

thanks for your help.

just to inform you that the problem is from ( device_class: door) it freeze the reading for all modbus sensors. when i remove it and add hub name for all sensors and switch everything work goods with hassio version 0.100.2

1 Like