I’m watching to debug log for modbus and everything looks ok…
So, why isn’t the correct status reported on the home assistant dashboard?
2021-01-27 09:50:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=binary_sensor.test, old_state=<state binary_sensor.test=off; friendly_name=test @ 2021-01-27T09:50:16.823159+01:00>, new_state=<state binary_sensor.test=unavailable; friendly_name=test @ 2021-01-27T09:50:26.834605+01:00>>
2021-01-27 09:50:26 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [140516954943552] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "binary_sensor.test", "old_state": {"entity_id": "binary_sensor.test", "state": "off", "attributes": {"friendly_name": "test"}, "last_changed": "2021-01-27T08:50:16.823159+00:00", "last_updated": "2021-01-27T08:50:16.823159+00:00", "context": {"id": "5aaeca969388b3a6b290872b107ecfc6", "parent_id": null, "user_id": null}}, "new_state": {"entity_id": "binary_sensor.test", "state": "unavailable", "attributes": {"friendly_name": "test"}, "last_changed": "2021-01-27T08:50:26.834605+00:00", "last_updated": "2021-01-27T08:50:26.834605+00:00", "context": {"id": "f723a97fecc28155efece223d624a7f6", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-01-27T08:50:26.834605+00:00", "context": {"id": "f723a97fecc28155efece223d624a7f6", "parent_id": null, "user_id": null}}}
2021-01-27 09:50:26 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [140516873991072] Sending {"id": 16, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "binary_sensor.test", "old_state": {"entity_id": "binary_sensor.test", "state": "off", "attributes": {"friendly_name": "test"}, "last_changed": "2021-01-27T08:50:16.823159+00:00", "last_updated": "2021-01-27T08:50:16.823159+00:00", "context": {"id": "5aaeca969388b3a6b290872b107ecfc6", "parent_id": null, "user_id": null}}, "new_state": {"entity_id": "binary_sensor.test", "state": "unavailable", "attributes": {"friendly_name": "test"}, "last_changed": "2021-01-27T08:50:26.834605+00:00", "last_updated": "2021-01-27T08:50:26.834605+00:00", "context": {"id": "f723a97fecc28155efece223d624a7f6", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-01-27T08:50:26.834605+00:00", "context": {"id": "f723a97fecc28155efece223d624a7f6", "parent_id": null, "user_id": null}}}
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Current transaction state - TRANSACTION_COMPLETE
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Running transaction 2
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] SEND: 0x0 0x2 0x0 0x0 0x0 0x6 0x1 0x1 0x0 0x1 0x0 0x1
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] RECV: 0x0 0x2 0x0 0x0 0x0 0x4 0x1 0x1 0x1 0x0
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.framer.socket_framer] Processing: 0x0 0x2 0x0 0x0 0x0 0x4 0x1 0x1 0x1 0x0
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.factory] Factory Response[ReadCoilsResponse: 1]
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Adding transaction 2
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Getting transaction 2
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.transaction] Current transaction state - IDLE
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.transaction] Running transaction 1
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.transaction] SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x1 0x0 0x5 0x0 0x1
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.transaction] RECV: 0x0 0x1 0x0 0x0 0x0 0x4 0x1 0x1 0x1 0x0
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.framer.socket_framer] Processing: 0x0 0x1 0x0 0x0 0x0 0x4 0x1 0x1 0x1 0x0
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.factory] Factory Response[ReadCoilsResponse: 1]
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.transaction] Adding transaction 1
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.transaction] Getting transaction 1
2021-01-27 09:50:26 DEBUG (SyncWorker_1) [pymodbus.transaction] Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.transaction] Current transaction state - IDLE
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.transaction] Running transaction 1
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.transaction] SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x1 0x0 0x5 0x0 0x1
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.transaction] RECV: 0x0 0x1 0x0 0x0 0x0 0x4 0x1 0x1 0x1 0x0
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.framer.socket_framer] Processing: 0x0 0x1 0x0 0x0 0x0 0x4 0x1 0x1 0x1 0x0
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.factory] Factory Response[ReadCoilsResponse: 1]
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.transaction] Adding transaction 1
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.transaction] Getting transaction 1
2021-01-27 09:50:26 DEBUG (SyncWorker_4) [pymodbus.transaction] Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Current transaction state - TRANSACTION_COMPLETE
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Running transaction 2
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] SEND: 0x0 0x2 0x0 0x0 0x0 0x6 0x1 0x1 0x0 0x5 0x0 0x1
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] RECV: 0x0 0x2 0x0 0x0 0x0 0x4 0x1 0x1 0x1 0x0
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.framer.socket_framer] Processing: 0x0 0x2 0x0 0x0 0x0 0x4 0x1 0x1 0x1 0x0
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.factory] Factory Response[ReadCoilsResponse: 1]
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Adding transaction 2
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Getting transaction 2
2021-01-27 09:50:26 DEBUG (SyncWorker_3) [pymodbus.transaction] Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMP