mitv

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mitv talks to the LAN remote API of Xiaomi HyperOS displays and TVs: the HTTP server on port 6095 that switches inputs and changes volume.

Index

Constants

View Source
const Port = 6095

Port is where the remote API listens.

Variables

View Source
var ErrNotFound = errors.New("mitv: no device found")

ErrNotFound means no HyperOS display or TV answered on the local network.

View Source
var ErrRejected = errors.New("mitv: request rejected")

ErrRejected means the device answered but refused the request.

Functions

func Discover

func Discover() (string, error)

Discover returns the IPv4 address of a HyperOS display (preferred) or TV by probing every address of the local /24 subnets for the remote API. (The device answers mDNS only by multicast to port 5353, which the system's own responder holds, so a scan is the portable way.)

Types

type Link struct {
	Host string
	// contains filtered or unexported fields
}

Link is a client for one device.

func New

func New(host string) *Link

func (*Link) DeviceName

func (l *Link) DeviceName() (string, error)

DeviceName answers whether the device is reachable, with its name.

func (*Link) Press

func (l *Link) Press(key string) error

Press sends a remote key such as "volumeup", "volumedown", "home" or "back".

func (*Link) Select

func (l *Link) Select(sourceID int) error

Select switches input. changesource2 takes the numeric id, so it also reaches DP and USB-C, which the name-based changesource rejects.

func (*Link) Sources

func (l *Link) Sources() ([]Source, error)

func (*Link) Volume

func (l *Link) Volume() (int, error)

Volume reads the volume on a 0...100 scale.

type Source

type Source struct {
	ID   int
	Name string
}

Source is an input of the display, such as HDMI1 (23) or DP (29).

Jump to

Keyboard shortcuts

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