yamaha

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2017 License: MIT Imports: 3 Imported by: 0

README

go-yamaha-avr

A Go library for controlling Yahama Audio/Video receivers with network connections through the Yamaha Control API.

Yamaha Control API

Yamaha has a simple API for controlling their receivers over the local network. This library implments a subset of the available network commands and has been tested with a Yamaha RX-V481 receiver.

Usage

Call yamaha.Connect() with the IP address of the Yamaha receiver you'd like control, such as 192.168.1.50. Then call various functions to control the receiver as described in yamaha.go.

	package main

	import (
		"github.com/mgoff/go-yamaha-avr"
		"log"
		"time"
	)

	func main() {

		// open the connection to the Yamaha device
		device, err := yamaha.Connect("192.168.1.50")
		if err != nil {
			log.Fatal(err)
		}

		// power it on
		err = device.PowerOn()
		if err != nil {
			log.Fatal(err)
		}
		time.Sleep(5 * time.Second)

		// set input to HDMI1
		err = device.SetInputHDMI1()
		if err != nil {
			log.Fatal(err)
		}
		time.Sleep(5 * time.Second)

		// set volume to -30dB
		err = device.SetVolume(-300)
		if err != nil {
			log.Fatal(err)
		}
		time.Sleep(5 * time.Second)

		// set input to HDMI2
		err = device.SetInputHDMI2()
		if err != nil {
			log.Fatal(err)
		}
		time.Sleep(5 * time.Second)

		// set volume to -40dB
		err = device.SetVolume(-400)
		if err != nil {
			log.Fatal(err)
		}
		time.Sleep(5 * time.Second)

		// power it on
		err = device.PowerOff()
		if err != nil {
			log.Fatal(err)
		}
	}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Yamaha

type Yamaha struct {
	// contains filtered or unexported fields
}

struct used to hold our Yamaha connection

func Connect

func Connect(address string) (Yamaha, error)

open a connection to the Yamaha device

func (Yamaha) Post

func (r Yamaha) Post(data string) error

common http post method

func (Yamaha) PowerOff

func (y Yamaha) PowerOff() error

power off device, which really just sets it to standby where network functions are still available

func (Yamaha) PowerOn

func (y Yamaha) PowerOn() error

power on device

func (Yamaha) SetInputAirPlay

func (y Yamaha) SetInputAirPlay() error

set input to AirPlay

func (Yamaha) SetInputHDMI1

func (y Yamaha) SetInputHDMI1() error

set input to HDMI1

func (Yamaha) SetInputHDMI2

func (y Yamaha) SetInputHDMI2() error

set input to HDMI2

func (Yamaha) SetVolume

func (y Yamaha) SetVolume(volume int) error

Set volume from a range of 160 (full volume) to -800 (lowest volume before muting) which is displayed as +16.0dB to -80.0dB on the receiver. I never set this higher than -200 (-20.0dB) which is loud enough for my place. Be careful and don't blow out your speaker or ear drums!

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL