Skip to content

Repository files navigation

Vantage-Node

Get Data from Vantage Pro Weatherstation from Davis Instruments via telnet connection

Features

  • Telnet Live-Connection (data every 2 seconds)
  • Prometheus Data export
  • MySQL Storage
  • Socket.IO Server
  • Simple REST API
  • MQTT Export
  • InfluxDB Export

Installation

There are two options: Use the docker image, or the plain nodejs script

Nodejs Usage

  • Copy config.example.json to config.json and change your data
  • Create a MySQL / MariaDB Database with user
  • Install dependencies with npm i and compile project with npm run build
  • Start Programm with npm start

Docker Image

  • Download Docker image from Docker Hub (n404/vantage-node)

  • run docker run -p 3010:3010 --name vantage-node -e VANTAGE_URL=123.123.123.123 -e MYSQL_ENABLED=false n404/vantage-node

  • With Custom config.json file: docker run --rm -v $(pwd)/config.json:/config.json -p 3011:3011 n404/vantage-nodeThe Table on the MYSQL Database will be automatically generated if it is not existed

Config

There are two options for the configuration parameter:

  1. a config.json file in the root directory of the project
  2. Configuration with environment variables (mostly for docker / kubernetes)

config.json

{"vantage": {"url": "192.168.178.xxx"//REQUIRED, default ""},"mysql": {"enabled": true|false,//required, default true"ip": "<database-Host>",//default "127.0.0.1""database": "<database>",//default "weather""username": "<databae-User>",//default "weather""password": "<database-Password>"//default ""},"socket": {"enabled": true|false,//default true"port": 3011//default 3010},"influxdb": {"api_token": "<token>","bucket": "<bucket>","organisation": "<org>>","url": "http://<host:port>","enabled": true},"mqtt": {"enable": true|false,"host": "emqx","user": "emqx","password": "","clientid": "mqtt_vantage_node_system_client","topic": "vantage_data"},"saveinterval": 60//default 60, given in seconds}

List of supported environment variables

Environment VariableDescriptionDefault ValueTypeRequired
VANTAGE_URLThe URL to the Vantage-Pro Telnet adapter""stringyes
VANTAGE_PORTThe Port to the Vantage-Pro telnet adapter22222numberno
MYSQL_ENABLEDIf MYSQL should be usedtruebooleanyes
MYSQL_IPThe MYSQL Host (IP or Hostname)127.0.0.1stringno
MYSQL_PORTThe Mysql Port3306numberno
MYSQL_DBThe MYSQL Database nameweatherstringno
MYSQL_USERNAMEThe MYSQL Database userweatherstringno
MYSQL_PASSWORDThe MYSQL database password""stringno
SOCKET_PORTThe Port the websocket-Server should listen on3010numberno
SOCKET_ENABLEDIf websocket should be enabledtruebooleanno
SAVE_INTERVALthe interval the data should be saved in the MYSQL Database60numberno
LOGLEVELstringno
INFLUXDB_ENABLEDbooleanno
INFLUXDB_URLstringno
INFLUXDB_API_TOKENstringno
INFLUXDB_ORGANISATIONstringno
INFLUXDB_BUCKETstringno
EMQX_ENABLEtrue, if mqtt should be usedbooleanno
EMQX_HOSTemqx hoststringno
EMQX_USERemqx usernamestringno
EMQX_PASSWDemqx passwordstringno
EMQX_CLIENTIDemqx clientid - randomstringno
EMQX_TOPICemqx topicstringno
CONFIG_FILEpath of config.json filestringno

Websocket Usage

On the Websocket port there will be sent the packages as soo as they get received from the vantage-pro station. You can use these packages with any socket.io-client (web-client or nodejs-client for example). The Packages have the following structure:

{
"barometer": 986.8407885386599,
"dayrain": 0,
"inhum": 26,
"intemp": 22.722222222222225, "outhum": 82, "outtemp": 9.722222222222221, "rainrate": 0,
"winddir": 258, "windspeed": 0
}

REST API

/test =>

{
"code": 200,
"message": "Test successful"
}

/metrics => returns Prometheus Metrics of the weather data

/healthcheck(used for internal docker checks):

if healthcheck is ok (HTTP Statuscode: 200):

{"message": "Packages are valid","code": 200,"value": 1234// timestamp of last Telnet package in MS}

if healthcheck is not valid: (HTTP Statuscode: 500)

{"message": "Packages are outdated and invalid!","code": 500,"value": 1234//timestamp of last Telnet package in MS}

/lastdata:

Values are -1 if not set (for example after program restart) (like in barometer)

{
"value": {
"barometer": -1,
"dayRain": 0,
"inHumidity": 29,
"outHumidity": 71,
"outTemperature": 17.055555555555557,
"inTemperature": 22.944444444444443,
"rainRate": 0,
"windDirection": 147,
"windSpeedMax": 0,
"windSpeed": 0
},
"message": "Last Dataset of Weatherstation",
"code": 200
}

If your have any problems, fell free to create an issue to contact me

About

Get Data of WeatherStation "Vantage" & Vantage Pro (2)" by Davis instruments via Telnet

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages