Is there any way to change the status of entities such as switches through automation

Developer tool, which can change the status and attribute values of an entity without affecting or operating the actual device. Can I implement this process by automatically adding actions or commands in the service? I just want to change the status of a custom entity, i.e., on or off. What should I do

Take look on: Home Assistant Entities Script ( GitHub - pmazz/ps_hassio_entities: Python script to handle state and attributes of existing sensors and entities )

Thank you for your help. I want to automatically change the custom media_ The status of the player entity, which only changes its status. The data comes from Bluetooth scanning, and the switch of the device is kept correct