Giter Site home page Giter Site logo

denisblondeau / sonosremote Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.6 MB

This Swift/SwiftUI (MacOS) demo receives keypresses from a bluetooth remote connected to a Raspberry Pi server and forwards those commands, using unofficial Sonos API requests, to a Sonos controller.

Swift 100.00%

sonosremote's Introduction

SonosRemote

This Swift/SwiftUI (MacOS) demo receives keypresses from a bluetooth remote connected to a Raspberry Pi server and forwards those commands, using unsupported (i.e. unofficial) Sonos API requests, to a Sonos controller (i.e. Sonos speakers).

Static Badge Static Badge

About the Project

This demo:

  • Connects to a specific Sonos controller on the local network.
  • Sends the following commands to the Sonos controller: Play/Pause, Previous Track, Next Track, Volume Up, Volume Down.
  • Those commands are received from a bluetooth remote connected to a Raspberry Pi running a Socket IO server (Python application).
  • Displays a MacOS menu bar application that let you play/pause the Sonos controller. The menu bar application also displays current play/pause status as well as current Sonos volume level (see MenuBarApp.jpeg).
  • Subscribes to Sonos events (e.g. monitors play/pause state, volume level).

Prerequisites

  • Before building/running this application:

  • Install the latest release of the SonosAPI package: https://github.com/denisblondeau/SonosAPI

  • Install the Socket.IO-Client-Swift package: https://github.com/socketio/socket.io-client-swift

  • Install and run the Python keypress-server on a Raspberry Pi: https://github.com/denisblondeau/keypress-server

  • In SonosModel.swift, you need to:

  • Set the callback URL. The callback URL is used by the Sonos coordinator to notify this demo of specific events.

  • Set the coodinator's name. This is the name of the Sonos Room you wish to control. You can find that name in the Sonos application.

  • Set the server URL. This is the Pi server hosting the SocketIO application that is receiving then forwarding the bluetooth remote's keypress to this application.

    private var callbackURL = URL(string: "http://192.168.0.1:1337")
    private var coordinatorName = "Living Room"
    private var serverURL = URL(string: "http://piserver.local:8080")

Testing

Once you have launched this application:

1) Use the bluetooth remote.
2) Use the menu bar application to start/pause Sonos.

sonosremote's People

Contributors

denisblondeau avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.