atmosx-tempest-station
v1.1.141
Published
AtmosphericX Tempest Weather Station Polling - Built for standalone and Project AtmosphericX Integration.
Maintainers
Readme
Installation (NPM)
npm install atmosx-tempest-stationExample Usage
const { TempestStation } = require(`atmosx-tempest-station`); // CJS
import { TempestStation } from `atmosx-tempest-station`; // ESM
const tempest = new TempestStation({
api: "api_key_here",
deviceId: 0,
stationId: 0,
journal: true,
})Events and Listeners
Event onForecast
Emitted when forecast data is received. The event provides an object containing weather forecast features.
tempest.on(`onForecast`, (data) => {
console.log(data);
});Event onObservation
Emitted when observation data is received. The event provides an object containing current weather observation features.
tempest.on(`onObservation`, (data) => {
console.log(data);
});Event onRapidWind
Emitted when rapid wind data is received. The event provides an object containing rapid wind features.
tempest.on(`onRapidWind`, (data) => {
console.log(data);
});Event onLightning
Emitted when lightning event data is received. The event provides an object containing lightning features.
tempest.on(`onLightning`, (data) => {
console.log(data);
});Callbacks and Functions
Function getForecast()
Fetches the weather forecast data from the Tempest Weather Station API.
const forecastData = await tempest.getForecast();
console.log(forecastData);Function getClosestStation({ latitude, longitude })
Fetches the closest Tempest Weather Station based on provided latitude and longitude.
const closestStation = await tempest.getClosestStation({ latitude: 37.7749, longitude: -122.4194 });
console.log(closestStation);Function setSettings({})
Updates the TempestStation instance settings with new API key, device ID, and station ID.
tempest.setSettings({ api: "new_api_key", deviceId: 12345, stationId: 67890 });Function stop()
Stops the WebSocket connection to the Tempest Weather Station API.
tempest.stop();References
Acknowledgements
- k3yomi
- Lead developer @ AtmosphericX and maintainer of this module.
- StarflightWx
- For testing and providing feedback (Co-Developer and Spotter @ AtmosphericX)
