New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pyweatherflowudp

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyweatherflowudp

An event-based asynchronous library to read UDP packets from Weatherflow weather systems on a local network without any reliance on the cloud.

  • 1.4.5
  • PyPI
  • Socket score

Maintainers
2

pypi downloads Buy Me A Coffee/Beer

pyweatherflowudp

An event-based asynchronous library to read UDP packets from Weatherflow weather systems on a local network without any reliance on the cloud.

The atomic data provided by WeatherFlow sensors is all natively metric. To help facilitate transformations to other units or to perform calculations and comparisons, this module utilizes Pint's Quantity class as the type of most properties which have a unit of measurement. See the Quantity section below for more details.

This module utilizes PsychroLib to help with additional weather calculations that are derived from the various data points provided by the actual WeatherFlow sensors. While WeatherFlow has these additional data points available via the app and rest API, they are unavailable via the low-level UDP packet data. And while a list of derived metrics and the associated equations has been posted, they can be quite complex to implement, such as calculating wet bulb temperature. As such, PsychroLib is an invaluable resource since the work has already been done and it eliminates the need to write all the equations in this module (and potentially get them wrong). You may notice that some of these values aren't an exact match with what is shown in the WeatherFlow app because there are different formulas (some simpler, some more complex) to calculate derived weather metrics. This is because WeatherFlow and PsychroLib may have chosen one of the sometimes many different formulas to get the result desired. They should still be relatively close, however.

DOI DOI

Supported Devices

  • Tempest
  • Air (untested)
  • Sky (untested)

Usage

The primary way of interacting with this module, and the devices that are found with it, is via event subscriptions.

The classes and events which they currently support are outlined below, but you can also see an example tying this altogether in demo.py.

Client

WeatherFlowListener
  • EVENT_DEVICE_DISCOVERED - emitted when a new device (Hub, Air, Sky or Tempest) is disovered for the first time

The classes and events in this section can be imported from pyweatherflowudp.client.

Devices

HubDevice
  • EVENT_LOAD_COMPLETE - emitted once when the hub has finished parsing a status update for the first time
  • EVENT_STATUS_UPDATE - emitted each time a status update has been parsed by the hub, including immediately following an EVENT_LOAD_COMPLETE
WeatherFlowSensorDevice (base class for AirDevice, SkyDevice and TempestDevice)
  • EVENT_LOAD_COMPLETE - emitted once when the sensor has finished parsing one status update and one observation for the first time
  • EVENT_OBSERVATION - emitted each time an observation has been parsed by the sensor
  • EVENT_STATUS_UPDATE - emitted each time a status update has been parsed by the sensor
AirSensorType (AirDevice / TempestDevice)
  • EVENT_STRIKE - emitted when a lightning strike has been detected
SkySensorType (SkyDevice / TempestDevice)
  • EVENT_RAIN_START - emitted when rain has been detected
  • EVENT_RAPID_WIND - emitted every 3 seconds (or less frequently depending on battery voltage) to inform about current wind condtions

The classes and events in this section can be imported from pyweatherflowudp.device.

Properties and Methods

WeatherFlowListener

propertytypedescription
deviceslistThe known devices.
hubslistThe known hubs.
is_listeningboolTrue if the listener is currently monitoring UDP packets on the network, else False.
sensorslistThe known sensors.

WeatherFlowDevice

Base for hubs and sensors.

propertytypedescription
firmware_revisionstrThe current firmware revision of the device.
load_completeboolTrue if the device has parsed all initial updates, else False.
modelstrThe model of the device ("Hub", "Air", "Sky", "Tempest").
rssiQuantityThe signal strength of the device in decibels.
serial_numberstrThe serial number of the device.
timestampdatetimeThe UTC timestamp from the last status update.
up_sincedatetimeThe UTC timestamp the device started up and has since been running.
uptimeintThe number of seconds the device has been up and running.

HubDevice

propertytypedescription
reset_flagslistThe current reset flags of the hub.

WeatherFlowSensorDevice

Base for sensors.

propertytypedescription
batteryQuantityThe current battery voltage.
hub_rssiQuantityThe signal strength of the hub in decibels.
hub_snstrThe serial number of the hub the sensor belongs to.
last_reportdatetimeThe UTC timestamp from the last observation.
sensor_statuslistThe list of issues the sensor is currently reporting.
report_intervalQuantityThe report interval in minutes.
reset_flagslistThe current reset flags of the hub.

AirSensorType

Base for "air" sensor measurements (Air/Tempest).

propertytypedescription
air_temperatureQuantityThe current air temperature in degrees Celsius.
last_lightning_strike_eventLightningStrikeEventThe last lightning strike event.
lightning_strike_average_distanceQuantityThe average distance for lightning strikes in kilometers.
lightning_strike_countintThe number of lightning strikes.
relative_humidityQuantityThe relative humidity percentage.
station_pressureQuantityThe observed station pressure in millibars.
air_density*QuantityThe calculated air density in kilograms per cubic meter.
delta_t*QuantityThe calculated Delta T in delta degrees Celsius.
dew_point_temperature*QuantityThe calculated dew point temperature in degrees Celsius.
heat_index*QuantityThe calculated heat index in degrees Celsius.
vapor_pressure*QuantityThe calculated vapor pressure in millibars.
wet_bulb_temperature*QuantityThe calculated wet bulb temperature in degrees Celsius.

* Indicates derived properties

methodinput (type)returndescription
calculate_cloud_basealtitude (Quantity)QuantityCalculate the estimated altitude above mean sea level (AMSL) to the cloud base.
calculate_freezing_levelaltitude (Quantity)QuantityCalculate the estimated altitude above mean sea level (AMSL) where the temperature is at the freezing point (0°C/32°F).
calculate_sea_level_pressurealtitude (Quantity)QuantityCalculate the sea level pressure in millibars (mbar).

SkySensorType

Base for "sky" sensor measurements (Sky/Tempest).

propertytypedescription
illuminanceQuantityThe current illuminance in Lux.
last_rain_start_eventRainStartEventThe last rain start event.
last_wind_eventWindEventThe last wind event.
precipitation_typePrecipitationTypeThe current precipitation type: (NONE, RAIN, HAIL or RAIN_HAIL).
rain_accumulation_previous_minuteQuantityThe rain accumulation from the previous minute in millimeters.
rain_rate*QuantityThe rain rate in millimeters per hour (based on the previous minute accumulation).
solar_radiationQuantityThe solar radiation in Watts per cubic meter.
uvintThe current UV index.
wind_averageQuantityThe wind speed average over the report interval in meters per second.
wind_directionQuantityThe wind direction over the report interval in degrees.
wind_direction_cardinalstringThe wind direction cardinal (16-wind compass rose).
wind_gustQuantityThe wind gust (maximum 3 second sample) in meters per second.
wind_lullQuantityThe wind lull (minimum 3 second sample) in meters per second.
wind_sample_intervalQuantityThe wind sample interval in seconds.
wind_speedQuantityThe wind speed in meters per second.

* Indicates derived properties

TempestDevice

propertytypedescription
feels_like_temperature*QuantityThe calculated "feels like" temperature in degrees Celsius.
wind_chill_temperature*QuantityThe calculated wind chill temperature in degrees Celsius.

* Indicates derived properties

Quantity

The pint.Quantity class has been utilized for device properties which are associated with a unit of measurement. This allows a conversion from the native metric unit to another of the user's choice such as degrees Celsius to degrees Fahrenheit, which produces another pint.Quantity:

device.air_temperature.to("degF")

To retrieve only the numeric value of a property, you can just append a .magnitude (or .m short form) like:

device.air_temperature.m

You can also retrieve only the units portion of a property with .units (or .u short form) like:

device.air_temperature.u

Check out the Pint docs for more tips.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc