Readonly
settingsThe used interface settings. These control the addressed serialport, the baud rate, the used units, etc. They are immutable.
WeatherStationSettings
Static
defaultBy default, a maximum of 10 listeners can be registered for any single event. This limit can be changed for individual WeatherStation instances using the setMaxListeners method.
To change the default for all EventEmitter instances, this property can be used. If this value is not a positive number, a RangeError is thrown.
Static
Readonly
defaultThe WeatherStation's default settings.
Whether the interface is currently connected to the weather station.
Adds an event listener. Possible events are described here.
The event to listen for
The listener to add
this (for chaining calls)
Creates a basic realtime data container. If there already is a basic realtime container this function returns the existing one and ignores the passed settings.
This basic realtime data container repeatedly calls .getBasicRealtimeData()
(and .getHighsAndLows()
) in the background
to update it's properties. On every (valid) update the (valid-)update
is emitted.
You can listen to them using standard event listeners:
realtime.on("update", (err?) => console.log(`It's ${realtime.tempOut}°F outside!`))
or wait for them asynchroniously:
await realtime.waitForUpdate();
console.log(`It's ${realtime.tempOut}°F outside!`);
your desired settings
the new or existing realtime data container
const realtime = WeatherStation.connectBasicRealtimeDataContainer({
updateInterval: 1,
});
await realtime.waitForUpdate();
console.log(`It's ${realtime.tempOut}°F outside!`);
realtime.pause();
Creates a detailed realtime data container. If there already is a detailed realtime container this function returns the existing one and ignores the passed settings.
This detailed realtime data container repeatedly calls .getDetailedRealtimeData()
(and .getHighsAndLows()
) in the background
to update it's properties. On every (valid) update the (valid-)update
is emitted.
You can listen to them using standard event listeners:
realtime.on("update", (err?) => console.log(`It's ${realtime.tempOut}°F outside!`))
or wait for them asynchroniously:
await realtime.waitForUpdate();
console.log(`It's ${realtime.tempOut}°F outside!`);
your desired settings
the new or existing realtime data container
const realtime = WeatherStation.connectDetailedRealtimeDataContainer({
updateInterval: 1,
});
await realtime.waitForUpdate();
console.log(`It's ${realtime.tempOut}°F outside!`);
realtime.pause();
Closes the connection to the weather station (if it's open). Throws no error if the connection is already closed.
a SerialPortError if an error occurrs while closing the connection
Synchronously calls each of the listeners registered for the event eventName
, in the order they were registered, passing the supplied arguments to each.
Returns true
if the event had listeners, false
otherwise.
Rest
...args: Parameters<WeatherStationEvents[U]>whether the event had listeners
Returns an array listing the events for which the WeatherStation has registered listeners.
an array listing the events for which the WeatherStation has registered listeners
Gets a handful of useful realtime weather data (see BasicRealtimeData). This includes temperature (in and out), pressure, humidity, wind speed, rain, ...
Optional
timeout: numbera handful of useful realtime weather data (a simple realtime record)
Following errors are possible:
Gets the basic realtime data container that has been created before using .createBasicRealtimeDataContainer()
.
the existing basic realtime data container
Gets the default (restructured) LOOP package. The return value is dependent on the weather station's model.
This might be either a LOOP1 or a LOOP2 package (or null
if an error occurrs).
Optional
timeout: numberthe default LOOP package
Following errors are possible:
Gets detailed weather information from all sensors (internally combining LOOP1 and LOOP2 packages). Only works if your weather station supports LOOP2 packages. This can be checked by calling isSupportingLOOP2Packages.
Optional
timeout: numberdetailed weather information
Following errors are possible:
Gets the detailed realtime data container that has been created before using .createDetailedRealtimeDataContainer()
.
the existing detailed realtime data container
Gets the console's firmware date code in the "Month dd yyyy"
format (e.g. "Sep 12 2017"
).
Optional
timeout: numberthe console's firmware date code
Following errors are possible:
Gets the console's firmware version in the "vX.XX"
format (e.g. "v3.80"
).
Optional
timeout: numberthe console's firmware version
Following errors are possible:
Gets the highs and lows from the console.
Optional
timeout: numberthe highs and lows HighsAndLows
Following errors are possible:
Gets the LOOP1 package.
Optional
timeout: numberthe LOOP1 package
Following errors are possible:
Gets the LOOP2 package. Requires firmware dated after April 24, 2002 (v1.90 or above). To check if your weather station supports the LOOP2 package call isSupportingLOOP2Packages.
Optional
timeout: numberthe LOOP2 package
Following errors are possible:
Returns the current max listener value for the WeatherStation which is either set by setMaxListeners or defaults to defaultMaxListeners.
the current max listener value for the current WeatherStation instance
Gets the backwards compatible weather station type as string.
null
(an error occurred)Optional
timeout: numberthe backwards compatible weather station type
Following errors are possible:
Gets the backwards compatible weather station type. Use getWeatherstationType to get the type as string.
0
=> Wizard III1
=> Wizard II2
=> Monitor3
=> Perception4
=> GroWeather5
=> Energy Enviromontor6
=> Health Enviromonitor16
=> Vantage Pro / Pro 217
=> Vantage Vuenull
=> An error occurredOptional
timeout: numberthe backwards compatible weather station type
Following errors are possible:
Checks whether the connected weather station is supporting LOOP2 packages. This is done using the firmware's date code.
Optional
timeout: numberwhether the connected weather station is supporting LOOP2 packages
Following errors are possible:
Returns the number of listeners listening to the event named eventName
.
the number of listeners listening to the event
Returns a copy of the array of listeners for the event named eventName
.
a copy of the array of listeners for the passed event
Alias for removeListener.
this (for chaining calls)
Alias for addListener.
this (for chaining calls)
Adds a one-time listener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.
this (for chaining calls)
Adds the listener function to the beginning of the listeners array for the event named eventName
.
No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
this (for chaining calls)
Adds a one-time listener function for the event named eventName
to the beginning of the listeners array.
The next time eventName
is triggered, this listener is removed, and then invoked.
this (for chaining calls)
Reconnects to the weather station (opens the serial connection and wakes the station up).
Optional
timeout: numberFollowing errors are possible:
Removes all listeners, or those of the specified eventName
.
Optional
eventName: keyof WeatherStationEventsthis (for chaining calls)
Removes the specified listener from the listener array for the event named eventName
.
the event the listener listens to
the listener to remove
this (for chaining calls)
Turns the console's background light off / on. Returns whether the command was executed successful.
whether the background light should be on
Optional
timeout: numberwhether the command was executed successful
Following errors are possible:
By default, a maximum of 10 listeners can be registered for any single event. This limit can be changed for individual WeatherStation instances using this method.
To change the default for all EventEmitter instances, change defaultMaxListeners.
new limit for the amount of listeners for any single event on this WeatherStation instance
this (for chaining calls)
Static
connectCreates an interface to your vantage weather station using the passed settings. The device should be connected serially.
the settings
const station = await WeatherStationAdvanced.connect({ path: "COM3", rainCollectorSize: "0.2mm" });
const [data, err] = await station.getBasicRealtimeData();
console.log(`It's ${data.tempOut}°F outside!`);
await station.disconnect();
Following errors are possible:
Generated using TypeDoc
More feature rich interface to any Vantage Pro 2 or Vantage Vue weather station with firmware dated after April 24, 2002 (v1.90 or above). Is built on top of the WeatherStation.
Offers station dependent features like WeatherStationAdvanced.getDetailedRealtimeData, WeatherStationAdvanced.getLOOP1, WeatherStationAdvanced.getLOOP2, WeatherStationAdvanced.isSupportingLOOP2Packages and WeatherStationAdvanced.getFirmwareVersion.