Automatic control of a pump via the solar system

That’s not a script. It is a dashboard card config. And to automate things you need to write an automation. Not a script or card.

Also: https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16