Categorygithub.com/tannerryan/davisweather
repositorypackage
1.0.0
Repository: https://github.com/tannerryan/davisweather.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

davisweather

Build
Status Go Report
Card GoDoc GitHub
license

Real time consumption of weather data from Davis WeatherLink Live.

Table of Contents

About

davisweather is used to consume from a WeatherLink Live (WLL) unit located on a network. It takes advantage of Davis' live transmission protocol, allowing for updates every 2.5 seconds.

Usage

A managed and unmanaged client is available. The managed client automatically discovers the WLL unit on a local network using mDNS. The unmanaged client is used on networks that block mDNS.

An example client may be found in the example directory.

Managed Client

Here is an example of using the managed client with verbose logging disabled.

func main() {
    ctx := context.Background()
    client := davisweather.Managed(ctx, false)

    for {
        <-client.Notify
        report, err := client.Report()
        if err != nil {
            panic(err)
        }
        log.Println(*report.Temperature)
    }
}

Unmanaged Client

Here is an example of using the unmanaged client with verbose logging enabled.

func main() {
    ctx := context.Background()
    client := davisweather.Unmanaged(ctx, false, "10.0.0.2", 80)

    for {
        <-client.Notify
        report, err := client.Report()
        if err != nil {
            panic(err)
        }
        log.Println(*report.Temperature)
    }
}

Client Shutdown

To shutdown the client, send a Done signal on the context provided to the client.

License

Copyright (c) 2020 Tanner Ryan. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

The ZeroConf package is distributed under an MIT license. Copyright (c) 2016 Stefan Smarzly, Copyright (c) 2014 Oleksandr Lobunets. All rights reserved.