postnik0706 Yes, telemetry topics are published when each new message registered. Key parameter that you may use to understand if this is last message or not is to use MQTT 5.0 version client and compare "timestamp" user property.
In order to detect state change I recommend you to look into analytics. It is specifically designed to extract from sequential messages some intervals and calculate them. With analytics you may detect the state you want to control and catch event if current known device state has changed.
Alternatively, you may subscribe to the topic "flespi/message/gw/devices/XXX" and receive full JSON text of each new message registered into the device. This will lead to less events and you can compare parameters to some internally stored state.