GithubHelp home page GithubHelp logo

homehub-client's Introduction

Home Hub Client

Build license

A golang client that can interact with BT Home Hub routers. Refer to the compatibility matrix to see the firmware versions supported by each release. The master branch is currently proven against firmware versions SG4B1000B540 and SG4B1A006100.

At present, only a small set of the available APIs have been implemented.

If you're looking for a command line implementation of this library, check out my Home Hub CLI. There's also a Prometheus exporter that's loosely based on this client code.

Usage

package main

import (
	"fmt"
	"github.com/jamesnetherton/homehub-client"
)

func main() {
	hub := homehub.New("http://192.168.1.254", "admin", "p4ssw0rd")
	hub.Login()

	version, err := hub.Version()
	if err == nil {
		fmt.Printf("Home Hub Version = %s", version)
	}
}

homehub-client's People

Contributors

jamesnetherton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

homehub-client's Issues

Improve error handling

Some of the response handlers make the assumptions that all of the relevant bits of the JSON response will be available. This may not always be the case and it can lead to a nil pointer dereference.

The library modifies the global "log" config

I noticed that this library, when included, will modify the global "log" object, meaning I'm not able to log anything after calling homehub.New.

I think a better idea is to have a public global variable e.g. var Debug bool which determines whether debug prints are logged.

Paginated event log

Right now EventLog returns the entire log. It'd be nice if chunks of it could be returned either by line number or event timestamp.

All the methods return strings

I wanted to use this library for a small project, but I find it a bit strange all the methods actually return string instead of something more structured. It would be far more useful if e.g. ConnectedDevices returned a slice of structs that I could enumerate in order to get information about a particular device.

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.