How to stop modbus interrogation

I use Modbus to get electrical data from 3 devices. the setup is HA connect to a TCP <=> Modbus converter. the 3 devices are connected via a RS485 bus to the converter.
In the configuration.yaml file the 3 devices are addressed via the Slave parameter and I use the Sensor platform to read the data.
so fa so good, this works fine, HA receives all the required information.
one of the devices is my Goodwe PV inverter. and for some obscure reason the inverter does not like being interrogated during bootup.
every morning when there is enough power from the PV panels the inverter boots. when HA sends a request to the inverter during this moment, the inverter resets all of its internal counters. Goodwe is not willing to seriously investigate the problem.
So what I want is to stop interrogating this slave from sunset to sunrise.
the 2 other slaves should continue to operate, so I can’t stop the whole modbus thing. I want only to stop the secified slave.
Any suggestions how to achieve this?

You’ll need to disable polling on the modbus integration and create an automation to do the polling. The automation in turn will make the decision of what to poll / not poll.

To disable polling go into the integration system options and turn polling off, then use this method call to poll when needed.

    - service: homeassistant.update_entity
      data: {}
        entity_id: sensor.r_generator_state

Actually for modbus you’ll want to set the scan_interval to zero

scan_interval integer (optional, default: 15)

Update interval in seconds. scan_interval = 0 for no polling. Entities are read shortly after startup and then according to scan_interval. Remark, when restarting HA the last known value is restored.

1 Like