How to make the "last_updated" attribute update?

I made a custom component, where I receive data from some homemade device. The value doesn’t always change, but I’m still interested in the “last_updated” attribute, because I’d like to know whether my device is still alive.

In my custom component, I update my sensors like this :

entity_id = "sensor.tzb_beekje_waterlevel"
value = "7"
hass.states.async_set(entity_id, value)

In the docs I see :

state.last_updated	Time the state was written to the state machine. Note that writing the exact same state including attributes will not result in this field being updated. Example: 2017-10-28 08:13:36.715874+00:00.

This is very weird, as a value that doesn’t change on any update, but only when values are different, rather looks like the definition of last_CHANGED and not last_UPDATED.
Why would it be like that ? Is there some trickery I can do to just make it update whenever any value comes in ?

Note that writing the exact same state including attributes will not result in this field being updated

Something has to change for it to be considered an update. The answer is to have an attribute that changes.

HA does this deliberately - it avoids causing lots of database writes when sensors keep sending the same data.