adafruit_ble_broadcastnet
¶
Basic IOT over BLE advertisements.
Author(s): Scott Shawcroft
- class adafruit_ble_broadcastnet.AdafruitSensorMeasurement(*, entry: ScanEntry | None = None, sequence_number: int = 0)¶
A collection of sensor measurements.
- TVOC¶
Total Volatile Organic Compounds as a float in parts per billion.
- acceleration¶
Acceleration as (x, y, z) tuple of floats in meters per second per second.
- battery_voltage¶
Battery voltage in millivolts. Saves two bytes over voltage and is more readable in bare packets.
- color¶
Color as RGB integer.
- current¶
Current as a float in milliamps.
- distance¶
Distance as a float in centimeters.
- duty_cycle¶
16-bit PWM duty cycle. Independent of frequency.
- eCO2¶
Equivalent CO2 as a float in parts per million.
- frequency¶
As integer Hertz
- gyro¶
Gyro motion as (x, y, z) tuple of floats in radians per second.
- light¶
Brightness as a float without units.
- lux¶
Brightness as a float in SI lux.
- magnetic¶
Magnetism as (x, y, z) tuple of floats in micro-Tesla.
- match_prefixes = (b'\xff"\x08\x03\x03\x00',)¶
For Advertisement,
match_prefixes
will always returnTrue
. Subclasses may override this value.
- orientation¶
Absolution orientation as (x, y, z) tuple of floats in degrees.
- pressure¶
Pressure as a float in hectopascals.
- relative_humidity¶
Relative humidity as a float percentage.
- sequence_number¶
Sequence number of the measurement. Used to detect missed packets.
- sound_level¶
Sound level as a float
- split(max_packet_size: int = 31) AdafruitSensorMeasurement ¶
Split the measurement into multiple measurements with the given max_packet_size. Yields each submeasurement.
- temperature¶
Temperature as a float in degrees centigrade.
- value¶
16-bit unit-less value. Used for analog values and for booleans.
- voltage¶
Voltage as a float in Volts.
- weight¶
Weight as a float in grams.
- adafruit_ble_broadcastnet.broadcast(measurement: AdafruitSensorMeasurement, *, broadcast_time: float = 0.1, extended: bool = False) None ¶
Broadcasts the given measurement for the given broadcast time. If extended is False and the measurement would be too long, it will be split into multiple measurements for transmission, each with the given broadcast time.