fritzbox

package
v0.0.0-...-059f13f Latest Latest
Warning

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

Go to latest
Published: May 3, 2018 License: MIT Imports: 11 Imported by: 0

README

Use the switch functions of the FRITZ!DECT 200.

package main

import (
	"flag"
	"fmt"
	"github.com/ujanssen/learning-go-lang/fritzbox"
)

func main() {
	var (
		host     = flag.String("host", "", "fritzbox host or ip address")
		password = flag.String("password", "", "fritzbox screen password")
		username = flag.String("username", "", "fritzbox screen username")
		command  = flag.String("command", "list", "list, on, off, state")
		ain      = flag.String("ain", "", "ain")
	)
	flag.Parse()
	
	box := fritzbox.NewFritzbox(*host, *username, *password)
	fmt.Printf("box -> %v\n", box)

	switch *command {
	case "list":
		box.Switchlist()
	case "on":
		box.SwitchOn(*ain)
	case "off":
		box.SwitchOff(*ain)
	case "state":
		box.SwitchState(*ain)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fritzbox

type Fritzbox struct {
	Host, Username, Password string

	LoginURL, CommandURL string
	// contains filtered or unexported fields
}

func NewFritzbox

func NewFritzbox(host, username, password string) *Fritzbox

func (*Fritzbox) SwitchOff

func (box *Fritzbox) SwitchOff(ain string)

func (*Fritzbox) SwitchOn

func (box *Fritzbox) SwitchOn(ain string)

func (*Fritzbox) SwitchState

func (box *Fritzbox) SwitchState(ain string)

func (*Fritzbox) Switchlist

func (box *Fritzbox) Switchlist()

type SessionInfo

type SessionInfo struct {
	SID       string `xml:"SID"`
	Challenge string `xml:"Challenge"`
	BlockTime string `xml:"BlockTime"`
}

SessionInfo has SID

Jump to

Keyboard shortcuts

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