WTH can't an automation set the state of an entity

There are many reasons that an automation may need to set the state of an entity, and plenty of forum posts from people wondering how to do this. The answer is to use a script, but this shouldn’t be necessary. There should be an action or a service that provides this ability.

Many integrations provide a service to allow a user to programmatically set the state of the entities they create/manage. For example, the cover integration offers several services to set a cover entity’s state. So does lock, input_boolean, etc

If the integration lacks a service call, it’s usually by design. For example, sensor and binary_sensor entities are read-only and meant to be managed by the integrations that produce them.

The script you mentioned is only able to make a temporary change to the entity’s state value. It operates the same way as if you use Developer Tools > States > Set State. The value you specify is temporary, cannot survive a restart, and will always be replaced by whatever value is reported by its integration.