Code Monkey home page Code Monkey logo

hueentertainmentswift's Introduction

HueEntertainmentSwift

A way to talk to the Hue Entertainment API.

Usage

// Get a session
let session = HueSession()

// Find the IP of the bridge
try await session.findIP()

// Get a username, clientKey and appID to be used to create a streaming session.
// You'll want to save these values.
try await session.login(device: "YOURAPP#HERE")

// Load Entertainment Areas configured in the Hue app
let areas = try await session.areas()

// Get an area to stream to
guard let area = areas.first else { return }

// Start a streaming session for the area. This prevents other integrations
// from streaming as well.
try await session.start(area: area)

// Connect via DTLS to the bridge to enable UDP message streaming. Once called,
// you can send messages via `session.connection`
try session.connect()

// Turn on lights in the entertainment area. They'll get set randomly to the
// colors below. The `ramp` value determines how long it takes in seconds
session.on(colors: [Color.red, Color.green, Color.blue, Color.yellow], ramp: 2)

// Turn off lights in the entertainment area.
session.off()

// Stop the streaming session. Important to call this when you're done.
try await session.stop()

Basic usage can be found in Tests/ as the testExample.

Warning

Using this project may potentially trigger seizures for people with photosensitive epilepsy. Use caution if you are going to run the example

hueentertainmentswift's People

Contributors

nakajima avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.