Code Monkey home page Code Monkey logo

ambient-mqtt's Introduction

ambient-mqtt

This app is designed to subscribe to the AmbientWeather Realtime API and broadcast the messages out over MQTT topics

Usage

cp .env-sample .env
// fill out all the config details
npm install
npm start

Environment Configuration

key description
API_KEY API key from Ambient Weather
APP_KEY Application key from Ambient Weather
MQTT_BROKER_ADDRESS MQTT broker URL (eg. mqtt://localhost:1883)
MQTT_USER Broker user
MQTT_PASSWORD Broker password
MQTT_UPDATE_TOPIC Broker topic for realtime updates from AmbientWeather
MQTT_CONNECT_TOPIC Broker topic for initial connections to the AmbientWeather Realtime socket
MQTT_SUBSCRIBE_TOPIC Broker topic for successful subscription to the realtime API
MQTT_TOPIC_JSON Publish status as JSON to aw/data. true/false (default true)

MQTT_TOPIC_JSON option

By default, the status will be updated to the topic aw/data and the payload will be JSON received from the Ambient Weather query. Setting this to false will split each property in the JSON payload to individual topics, one for property.

Example of default behavior (MQTT_TOPIC_JSON=true or MQTT_TOPIC_JSON=):

{"dateutc":1537282680000,"tempf":85.6,"humidity":92,"hourlyrainin":0,"dailyrainin":0,"weeklyrainin":0,"monthlyrainin":1.83,"yearlyrainin":37.23,"totalrainin":37.23,"tempinf":87.8,"humidityin":63,"baromrelin":31.02,"baromabsin":30.06,"dewPoint":83,"lastRain":"2018-09-14T14:56:00.000Z","deviceId":"5a41138884f9e0000d5a822d","date":"2018-09-18T14:58:00.000Z"}

Example of (MQTT_TOPIC_JSON=false), individual topics with the value as the payload:

aw/data/dateutc
1537282680000

aw/data/tempf
85.6

aw/data/humidity
92

ambient-mqtt's People

Contributors

qbunt avatar billchurch avatar

Watchers

James Cloos avatar Ronald Gouldner avatar

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.