{"id":21554147,"url":"https://github.com/sabinus52/soundtouchapi","last_synced_at":"2025-04-10T09:16:41.965Z","repository":{"id":62538898,"uuid":"165491155","full_name":"sabinus52/SoundTouchApi","owner":"sabinus52","description":"Library to control the speakers Bose SoundTouch API","archived":false,"fork":false,"pushed_at":"2022-06-11T11:46:04.000Z","size":76,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-17T05:20:14.927Z","etag":null,"topics":["api","bose","bose-soundtouch","domotic","php","soundtouch","speaker"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sabinus52.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-13T10:13:29.000Z","updated_at":"2022-06-11T11:46:03.000Z","dependencies_parsed_at":"2022-11-02T16:15:23.797Z","dependency_job_id":null,"html_url":"https://github.com/sabinus52/SoundTouchApi","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sabinus52%2FSoundTouchApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sabinus52%2FSoundTouchApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sabinus52%2FSoundTouchApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sabinus52%2FSoundTouchApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sabinus52","download_url":"https://codeload.github.com/sabinus52/SoundTouchApi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226134362,"owners_count":17578782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bose","bose-soundtouch","domotic","php","soundtouch","speaker"],"created_at":"2024-11-24T07:13:40.342Z","updated_at":"2024-11-24T07:13:41.141Z","avatar_url":"https://github.com/sabinus52.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SoundTouchApi\n\nSoundTouchApi is a PHP Library that allows you to interact with Bose SoundTouch speakers. It allows you to integrate control into your own PHP applications or domotic box.\n\n\n## Installation\n\nFor install the package with composer :\n\n~~~\ncomposer require sabinus52/soundtouchapi\ncomposer install\n~~~\n\n\n## Usage\n\n~~~ php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse Sabinus\\SoundTouch\\SoundTouchApi;\nuse Sabinus\\SoundTouch\\Component\\ContentItem;\nuse Sabinus\\SoundTouch\\Constants\\Source;\nuse Sabinus\\SoundTouch\\Constants\\Key;\n\n\n// Initialize object API\n$api = new SoundTouchApi('192.168.0.1');\n\n// Get informations\n$info = $api-\u003egetInfo();\nprint 'DeviceID : '.$info-\u003egetDeviceID().\"\\n\";\nprint 'Nom : '.$info-\u003egetName().\"\\n\";\n\n// Get now playing\n$result = $api-\u003egetNowPlaying();\nprint 'Source : '.$result-\u003egetSource().\"\\n\";\n\n// Volume\n$volume = $api-\u003egetVolume();\nprint 'Volume : '.$volume-\u003egetActual().\"\\n\";\nprint 'Mute : '.$volume-\u003eisMuted().\"\\n\";\n$api-\u003esetVolume(27); // Set new volume 0..100\n$api-\u003emute(); // Cut volume\n\n// Select source BLUETOOTH\n$source = new ContentItem();\n$source-\u003esetSource(Source::BLUETOOTH);\n$api-\u003eselectSource($source);\n\n// Select station radio TUNEIN\n$source = new ContentItem();\n$source-\u003esetSource(Source::TUNEIN)\n    -\u003esetType('stationurl')\n    -\u003esetLocation('/v1/playback/station/s17695')\n    -\u003esetName('FG Radio FG')\n    -\u003esetImage('http://cdn-radiotime-logos.tunein.com/s17695q.png');\n$api-\u003eselectSource($source);\n\n// Send Command pause music\n$api-\u003esetKey(Key::PAUSE);\n$result = $api-\u003egetNowPlaying();\nprint 'Track : '.$result-\u003egetTrack().\"\\n\";\nprint 'Artist : '.$result-\u003egetArtist().\"\\n\";\n\n// List of the sources\n$result = $api-\u003egetSources();\nforeach ($result as $key =\u003e $source) {\n    print $key.' : '.$source-\u003egetName().' / '.$source-\u003egetSource().\"\\n\";\n}\n\n// Liste of presets\n$result = $api-\u003egetPresets();\nforeach ($result as $preset) {\n    print 'Preset '.$preset-\u003egetId().' : '.$preset-\u003egetContentItem()-\u003egetSource().' / '.$preset-\u003egetContentItem()-\u003egetName().\"\\n\";\n}\n\n// Play preset No. 1\n$api-\u003eplayPreset(1);\n\n// Set current source as preset No. 5\n$api-\u003esetPreset(5);\n~~~\n\n\n## MutiRoom\n\n~~~ php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse Sabinus\\SoundTouch\\SoundTouchApi;\nuse Sabinus\\SoundTouch\\Component\\ContentItem;\nuse Sabinus\\SoundTouch\\Constants\\Source;\nuse Sabinus\\SoundTouch\\Constants\\Key;\n\n// Initialize object API\n$api = new SoundTouchApi('192.168.0.1');\n\n// Create zone\n$zone = new Zone();\n$zone-\u003esetMaster('ABCD123456')-\u003esetSender('192.168.0.1');\n$slave1 = new ZoneSlave();\n$slave1-\u003esetMacAddress('111ABCDEF')-\u003esetIpAddress('192.168.0.2');\n$slave2 = new ZoneSlave();\n$slave2-\u003esetMacAddress('222ABCDEF')-\u003esetIpAddress('192.168.0.3');\n$zone-\u003esetSlaves( [ $slave1, $slave2 ] );\n$api-\u003esetZone($zone);\n\n// Remove slave\n$api-\u003eremoveZoneSlave($slave2);\n// Add slave\n$api-\u003eaddZoneSlave($slave2);\n~~~\n\n\n## Jeedom\n\nA specific class to integrate control into Jeedom. (More features)\n\nSee my Jeedom plugin : https://github.com/sabinus52/jeedom-bose-soundtouch\n\nExample :\n\n~~~ php\nuse Sabinus\\SoundTouch\\JeedomSoundTouchApi;\n\n$speaker = new JeedomSoundTouchApi('soundtouch');\n\n// Power ON\n$speaker-\u003epowerOn();\n\n// Select BlueTooth\n$speaker-\u003eselectBlueTooth();\n$status = $speaker-\u003egetNowPlaying();\nprint 'Source : '.$status-\u003egetSource().\"\\n\";\nprint 'Track : '.$status-\u003egetTrack().\"\\n\";\nprint 'Artist : '.$status-\u003egetArtist().\"\\n\";\n$speaker-\u003eplay();\n$speaker-\u003enextTrack();\n$status = $speaker-\u003egetNowPlaying(true); // Refresh status\nprint 'Track : '.$status-\u003egetTrack().\"\\n\";\nprint 'Artist : '.$status-\u003egetArtist().\"\\n\";\n\n// Select source HDMI\n$speaker-\u003eselectHDMI();\n\n// Display volume and change it\nprint 'Volume Actual : '.$speaker-\u003egetLevelVolume().\"\\n\";\nprint 'Mute : '.$speaker-\u003eisMuted().\"\\n\";\n$speaker-\u003esetVolume(27);\nprint 'New volume : '.$speaker-\u003egetLevelVolume(true).\"\\n\";\n~~~\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsabinus52%2Fsoundtouchapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsabinus52%2Fsoundtouchapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsabinus52%2Fsoundtouchapi/lists"}