Creates a new basic realtime data container.
It is not recommended to use the constructor directly, it is better to use the .createBasicRealtimeDataContainer()
method of
the weather station as this avoids multiple instances (singleton).
your desired settings
the realtime data container
const realtime = WeatherStation.connectBasicRealtimeDataContainer({
updateInterval: 1,
});
await realtime.waitForUpdate();
console.log(`It's ${realtime.tempOut}°F outside!`);
realtime.pause();
Measured evapotranspiration (ET) of the day
Holds daily, monthly and yearly highs and lows for all weather elements / sensors.
Current inside humidity in percent
Current outside humidity in percent
Current pressure
The pressure's trend. There are five possible trends:
The pressure's trend encoded as number.
-60
stands for Falling Rapidly-20
stands for Falling Slowly0
stands for Steady20
stands for Rising Slowly60
stands for Rising RapidlyThe amount of rain that fell today
The current rain rate
Readonly
settingsThe realtime interface's settings. Immutable.
Currently measured solar radiation
The most recent rainstorm's amount of rain
The most recent rainstorm's start date (without time)
Current inside temperature (the console's temperature)
Current outside temperature
The time the record was created
Currently measured UV index
Currently measured wind speed
Average wind speed in the recent ten minutes
Currently measured wind direction encoded as string. Possible values are:
The wind speed direction in degrees (from 1
to 360
).
90°
is East, 180°
is South, 270°
is West and 360°
is North.
Static
defaultBy default, a maximum of 10 listeners can be registered for any single event. This limit can be changed for individual realtime interface instances using the setMaxListeners method.
To change the default for all instances, this property can be used. If this value is not a positive number, a RangeError is thrown.
Adds an event listener. Possible events are described here.
The event to listen for
The listener to add
this (for chaining calls)
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<RealtimeInterfaceEvents[U]>whether the event had listeners
Returns an array listing the events for which the realtime interface has registered listeners.
an array listing the events for which the realtime interface has registered listeners
Returns the current max listener value for the realtime interface which is either set by setMaxListeners or defaults to defaultMaxListeners.
the current max listener value for the current realtime interface instance
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)
Removes all listeners, or those of the specified eventName
.
Optional
eventName: keyof RealtimeInterfaceEventsthis (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)
By default, a maximum of 10 listeners can be registered for any single event. This limit can be changed for individual realtime interface 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 realtime interface instance
this (for chaining calls)
Waits for the next update on the realtime interface. If an error occurrs while updating an error is returned (not thrown!). This can be used to handle errors optionally. See RealtimeInterfaceEvents.
const err = await container.waitForUpdate();
Waits for the next valid update on the realtime interface. See RealtimeInterfaceEvents.
Generated using TypeDoc
The smaller version of the realtime data container providing HighsAndLows and BasicRealtimeData. Works on any Vantage Vue, Pro and Pro 2.
What are realtime containers?
Realtime interfaces provide another level of abstraction to interact with your weather station. Instead of manually calling methods like WeatherStationAdvanced.getHighsAndLows or WeatherStationAdvanced.getDetailedRealtimeData, you just access the attributes of an instance of this class. E.g. to get the current outside temperature you just create a realtime interface and access it using
realtime.tempOut
.Internally this works via an update cycle. Every
container.settings.updateInterval
seconds the interface requests data from your weather station to update its attributes. As the realtime interface is an EventEmitter, you can listen to the"update"
event. Additionally there is the"valid-update"
event which only fires if no error occurrs.