Change entity state through automation?

Hi all
I’ll get straight to the point. I have a Z-wave sensor, a rain gauge, that isn’t returning to zero after the rain has stopped, or ever for that matter. Only way I see it is to manually set the entity state using the Developer Tools. I have a separate thread going for this Popp Z-rain not returning to zero
My idea of mitigating the problem is by setting up an automation that would trigger if the gauge hasn’t changed to a while. That part is easily researched but not the action part. I cannot figure out how to set the state.
Any input would be appreciated.

Regards
Fredrik

Normally there’s no need to set a sensor’s state so there’s no native service to do it. However, as you’ve discovered, there are unique situations where it is required.

I suggest you consider using the python_script created by rodpayne:

pnbruckner has a similar python_script posted here: