for example if I have an arduino that is connected to pi and sending data via serial. if I disconnect it and connect it again it won't send any data unless I am openning the port again.
Is there any way I could do that automatically?
So... think about what distinguishes a normal, functioning state from the abnormal state.
Usually Arduino sketches are sending data regularly several times per second. This means, the time between incoming packets should be a few hundred ms at most.
When it stops sending, the time since the last packet will be much larger.
Is there a way to measure time since the last bang in an inlet? Yes, see [timer].
So you could use a trigger object to generate a bang from the comport outlet and send it to the reset inlet of a [timer]. Then you could use a metro to bang the measuring inlet of the same timer. If the timer outlet is larger than one or two thousand ms, then you can assume that the connection got broken and send a message back up, to reconnect.
Haven't tested but it should be pretty close.