Check for script response in another script, to get status of a light

In short I’m trying to have a single toggle button to turn on/off a light I have with Google Assistant SDK.

With two buttons it’s easy, two scripts that send a text command to Google Assistant like “turn off the living room light”. But it doesn’t look very nice, two buttons on the Dashboard and they don’t show the status if it’s on or off (always off status).

So my plan was to have another script which send the text command “is the living room light on” and get a response from that, and based on that turn the light on or off, and hopefully show the correct status in the Dashboard (the lit lightbulb, or not).

Is this possible? Or even the right way?

You could use a template switch. You can use lists of services in the turn_on and turn_off actions if required. So put your whole existing script sequences in them. Use the state of the light in the value_template.