Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.
/ lgtv Public archive

Go package for controlling LG Smart TVs

License

Notifications You must be signed in to change notification settings

mjanser/lgtv

Repository files navigation

LGTV

LGTV is a Go package for controlling LG Smart TVs. It uses Gorilla WebSocket for the connection to the TV.

Build Status GoDoc

Installation

go get github.com/mjanser/lgtv

Examples

package main

import (
	"github.com/mjanser/lgtv"
)

func main() {
	ip := "192.168.1.2"
	key := ""

	tv, err := lgtv.NewDefaultClient(ip, key)
	err = tv.Connect()
	defer tv.Disconnect()

	volume, err := tv.GetVolume()
	channel, err := tv.GetCurrentChannel()

	channels, err := tv.GetChannels()
	inputs, err := tv.GetInputs()
	apps, err := tv.GetApps()

	err = tv.SetVolume(10)
	err = tv.SwitchInput("HDMI_1")
	err = tv.SetChannel("1")

	err = tv.SubscribeVolume(func (volume lgtv.Volume) {
	})
	err = tv.SubscribeApp(func (app lgtv.AppInfo) {
	})
	err = tv.SubscribeChannel(func (channel lgtv.Channel) {
	})

About

Go package for controlling LG Smart TVs

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages