fix(device): move initialisation of last_heartbeat outside the loop
We were reinitialising the last heartbeat time each time around the loop to the
last update time.
This can cause offsets in both directions;
- for devices that only send updates on full polls, only the first heartbeat is
delayed as designed, then the rest will come every 0.1s as before.
- for devices that send frequent unsolicited messages, the heartbeat will get
delayed, and this may cause timeouts.
High probability that he second case above is the cause of #4884 and #4885