Socket
Socket
Sign inDemoInstall

github.com/tanaikech/gonetatmo

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/tanaikech/gonetatmo


Version published
Created
Source

gonetatmo

Build Status MIT License

Overview

This is a CLI tool to retrieve data from a personal weather station of Netatmo.

Demo

In this demonstration, at first, it retrieves data from own Netatmo. And then, all values in a square area 50 km on a side are retrieved as centering on Tokyo station, and the average values are displayed.

Description

I have a personal weather station of Netatmo. I check the data of my local environment using it. In most case, I have used my browser to retrieve the data so far. About retrieving data using curl, I have created it before. Recently, I thought that I wanted to create this as a CLI too. So I created this. This tool can retrieve not only the data of own Netatmo, but also the data of specific area using Netatmo APIs. By this, I got to be able to retrieve easily the data of various places. This tool has the following features.

  • Retrieves data from Netatmo.
  • Using Getstationsdata, retrieve data of own Netatmo.
  • Using Getmeasure, retrieve past data of own Netatmo.
  • Using Getpublicdata, retrieve data of various places.

How to Install

Download an executable file of gonetatmo from the release page and import to a directory with path.

or

Use go get.

$ go get -u github.com/tanaikech/gonetatmo

Retrieve tokens

In gonetatmo, data is retrieved using Netatmo API and Google Maps Geocoding API.

For Netatmo API

After download or install gonetatmo, in order to use APIs, please retrieve client ID, client Secret from Netatmo.

  • If you don't have an account of Netatmo, please create an account at https://auth.netatmo.com/.
  • If you have an account of Netatmo, you can retrieve them as follows.
    1. Login to Netatmo.
    2. Access to https://dev.netatmo.com/.
    3. Click "CREATE YOUR APP".
    4. Input each parameters.
    5. Click "CREATE AN APP.".
    6. Copy Client id and Client secret.
    7. Run the following command.
      • email and password are them that you use to login to Netatmo.
$ gonetatmo --clientid ### --clientsecret ### --email ### --password ###

For Google Maps Geocoding API

$ gonetatmo --key ###

By above commands, gonetatmo.cfg is created. You can also set the directory of gonetatmo.cfg using the environment variable of GONETATMO_CFG_PATH. For example, you can set the following script to .bashrc.

export GONETATMO_CFG_PATH=c:/foo/bar

Usage

Help

$ gonetatmo --help

Retrieve data from own Netatmo

$ gonetatmo
  • This can be seen at the demonstration movie.
  • If you want to retrieve the data as JSON object, please run as follows. In this case, the raw data from Netatmo can be retrieved.
  • $ gonetatmo -raw

Retrieve past data from own Netatmo

$ gonetatmo m -di "### your device ID ###" -b 2018-01-01T00:00:00+00:00 -e 2018-01-02T00:00:00+00:00
  • -b 2018-01-01T00:00:00+00:00 and -e 2018-01-02T00:00:00+00:00 mean that the data from 2018-01-01T00:00:00+00:00 to 2018-01-02T00:00:00+00:00.

Retrieve data of a specific area using latitude and longitude

$ gonetatmo p -lat 35.681167 -lon 139.767052 -r 50
  • -r 50 means that all values in a square area 50 km on a side are retrieved as centering on (35.681167, 139.767052), and the average values are displayed.
  • When -raw is used, you can retrieve the raw data from Netatmo.

Retrieve data of a specific area using address and place name

$ gonetatmo p -a "tokyo station" -r 50
About the retrieved area

When you run the command of $ gonetatmo p -a "tokyo station" -r 50, the following flow is run.

  1. "tokyo station" is converted to the coordinate using Google Maps Geocoding API.
    • The converted coordinate means the center of area.
    • It's (35.6811673000, 139.7670516000).
  2. -r 50 means a square area 50 km on a side.
    • The coordinates of North east corner and South west corner are calculated.
    • Those are (35.9064834975, 140.0432177479) and 35.4558511025, 139.4908854521.
  3. All values of the square area 50 km on a side are retrieved using Netatmo API.

You can see above flow as an image. The orange anchor is the center coordinate. The green anchors of upper right and lower left are the calculated points. The values are retrieved from the red colored area.


Licence

MIT

Author

Tanaike

If you have any questions and commissions for me, feel free to tell me.

Update History

  • v1.0.0 (March 1, 2018)

    1. Initial release.
  • v1.0.1 (August 2, 2019)

    1. A bug was removed.
      • When the outer module is not active, an error occurred. In this version, this bug was removed.

  • v1.0.2 (January 3, 2020)

    1. It seems that the specification of github.com/urfave/cli was changed by the update of https://github.com/urfave/cli. By this, when go get -u github.com/tanaikech/gonetatmo is run, an error occurred. So this error was removed.

TOP

FAQs

Package last updated on 03 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc