# Help to control mopidy volume and "streams" via script (api?)

**URL:** <https://discourse.mopidy.com/t/help-to-control-mopidy-volume-and-streams-via-script-api/6065>\
**Category:** Help and support\
**Created:** [February 18, 2025, 9:01am UTC](https://discourse.mopidy.com/t/help-to-control-mopidy-volume-and-streams-via-script-api/6065 "2025-02-18T09:01:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dll-live](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dll-live](https://discourse.mopidy.com/u/dll-live)\
**Post date:** [February 18, 2025, 9:01am UTC](https://discourse.mopidy.com/t/help-to-control-mopidy-volume-and-streams-via-script-api/6065/1 "2025-02-18T09:01:08Z")

</div>

Hi everyone

MoPiDy run at home - and it works fiine.  
Now i want to “play” with api but my knowledge is to less…  
How i can control the volume by API?  
How i “say” mopidy to Play a stream (tunein:station:s303413)?  
With Webfront End it works fine, but now i want a script with this step? so i can control mopidy by mi smarthome…)

I think this describe my situation below my 2 pain-Points 🙂

With a bash or python i want to make a “start up” script (with API?) with the following steps

1. Set volume to value xy
2. Play stream a (by tunein (tunein:station:s303413)

---

<div class="post-metadata">

**Author:** ![Matthias\_Meulien](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/matthias_meulien/32/2260_2.png) [@Matthias\_Meulien](https://discourse.mopidy.com/u/Matthias_Meulien)\
**Post date:** [February 18, 2025, 9:20am UTC](https://discourse.mopidy.com/t/help-to-control-mopidy-volume-and-streams-via-script-api/6065/2 "2025-02-18T09:20:02Z")

</div>

Hi,

TLDR; Read the documentation!

The documentation gives examples of uses of the HTTP API, using `curl`; See [HTTP JSON-RPC API — Mopidy 3.4.2 documentation](https://docs.mopidy.com/stable/api/http/#http-json-rpc-api).

You should also read about JSON-RPC; Understanding the [Wikipedia page](https://en.wikipedia.org/wiki/JSON-RPC) should be ok.

Then for 1. use the JSON-RPC `core.mixer.set_volume` method.

For 2. I would add the stream to the track list with a call to `core.tracklist.add`. But you should also have a look to `core.tracklist.clear`, `core.playback.get_state` and `core.playback.play` to handle non-empty track list, already playing instance, etc…

All public methods are documented in [API reference — Mopidy 3.4.2 documentation](https://docs.mopidy.com/stable/api/#basics).

---

<div class="post-metadata">

**Author:** ![dll-live](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dll-live](https://discourse.mopidy.com/u/dll-live)\
**Post date:** [February 18, 2025, 9:39am UTC](https://discourse.mopidy.com/t/help-to-control-mopidy-volume-and-streams-via-script-api/6065/3 "2025-02-18T09:39:49Z")

</div>

Thank you for the answer.

Step 1 (adjust volume): → Yes, I found it in the documentation, but I’m stupid and it doesn’t work - please give me the command (which I have to send to MoPiDy) - I’m crying about my stupidity… - it shows me once again that I don’t know / can’t do “anything”…  
Maybe then I’ll understand it and can then take a few intermediate steps for the second step (play stream).

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/system/32/1_2.png) [@system](https://discourse.mopidy.com/u/system)\
**Post date:** [August 19, 2025, 9:40pm UTC](https://discourse.mopidy.com/t/help-to-control-mopidy-volume-and-streams-via-script-api/6065/4 "2025-08-19T21:40:26Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
