Manually setting values of entities without triggering their action for e.g. locks?

I have a Nuki smart lock. It works within Home Assistant but the integrations aren’t the best (no offense) because they’re all polling-type rather than push. If you unlock and lock the smart lock quickly, chances are this won’t show up in Home Assistant because first, the bridge (I use a software bridge replacement) needs to poll the lock, and then HA needs to poll the bridge API. So it’s likely that a small unlock-lock sequence won’t get captured.

Since the bridge is in-software rather than using Nuki’s hardware bridge, I thought I could extend it by having the bridge send mqtt events. That at least cuts down half the polling delays already. (There is no setting for polling frequency in the stock Nuki integration.) So I could have it send out the mqtt events but then I’d need to have HA set the lock state accordingly. I could use a template sensor and write my automations against that, but… it feels messier. I’d rather set the actual lock.whatever entity.

Is it possible to do this somehow - setting some random entity’s state programmatically? That is, without having HA telling the smart lock to lock/unlock.

tldr, I think: I want to use the ‘set state’ tool (in Developer Tools → States) but from within a script or automation. Is that possible?