Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 99102

WARNING Script already running

$
0
0

@LeoSum wrote:

Hi there,
I was trying to be smart and make generic scripts that will do the same actions with different entities for me, following “Don’t repeat yourself!”.

For example in my snapcast configuration, when the stream that clients are currently playing goes silent, I want to mute them.

For this, I have an automation that is triggered by the stream switching to “idle” which checks all clients if they currently have this stream selected and mutes them if they do, by calling this script with the entity_id as a passed in variable snapclient_id :

mute_client:
  alias: "Mute Client"
  sequence:
  - delay: 0
  - service: media_player.volume_mute
    data_template:
      entity_id: "{{ snapclient_id }}"
      is_volume_muted: true

In general this works with any client, but whenever more than one client was using the stream, and the script should be run for several clients, it only mutes the first client and fails on the others:

WARNING (MainThread) [homeassistant.components.script] Script script.mute_client already running.

Yeah, I know it’s already running, I inteded it to be. But why is that a problem? :slight_smile:
Is this a general limitation of homeassistant?
Can I not spare myself typing effort and redundancy like I planned?
Do I need to make specific scripts for each client?
What would be the best practice in a scenario like mine where I have a lot of scripts that I want to use for multiple entities and sometimes also at the same time.

I already tried to add in delays but this is not really feasible.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 99102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>