adafruit_ble_broadcastnet

Basic IOT over BLE advertisements.

  • Author(s): Scott Shawcroft

class adafruit_ble_broadcastnet.AdafruitSensorMeasurement(*, entry=None, sequence_number=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.

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.

split(max_packet_size=31)

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, *, broadcast_time=0.1, extended=False)

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.