smartgadget.smart_gadget module

class smartgadget.smart_gadget.SmartGadget(device, interface=None)[source]

Bases: Peripheral

Base class for a Smart Gadget.

Parameters
  • device – A MAC address as a str or a ScanEntry object.

  • interface (int, optional) – The Bluetooth interface to use for the connection. For example, 0 or None means /dev/hci0, 1 means /dev/hci1.

APPEARANCE_CHARACTERISTIC_UUID = <bluepy.btle.UUID object>
BATTERY_LEVEL_CHARACTERISTIC_UUID = <bluepy.btle.UUID object>
DEVICE_NAME_CHARACTERISTIC_UUID = <bluepy.btle.UUID object>
FIRMWARE_REVISION_STRING_CHARACTERISTIC_UUID = <bluepy.btle.UUID object>
HARDWARE_REVISION_STRING_CHARACTERISTIC_UUID = <bluepy.btle.UUID object>
MANUFACTURER_NAME_STRING_CHARACTERISTIC_UUID = <bluepy.btle.UUID object>
MODEL_NUMBER_STRING_CHARACTERISTIC_UUID = <bluepy.btle.UUID object>
PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS_CHARACTERISTIC_UUID = <bluepy.btle.UUID object>
SERIAL_NUMBER_STRING_CHARACTERISTIC_UUID = <bluepy.btle.UUID object>
SOFTWARE_REVISION_STRING_CHARACTERISTIC_UUID = <bluepy.btle.UUID object>
SYSTEM_ID_CHARACTERISTIC_UUID = <bluepy.btle.UUID object>
battery() int[source]

Returns the temperature [degree C].

Attention

The subclass must override this method.

dewpoint(temperature=None, humidity=None) float[source]

Returns the dew point for the specified MAC address.

Parameters
  • temperature (float, optional) – The temperature [degree C]. If None then reads the current temperature value from the Smart Gadget.

  • humidity (float, optional) – The humidity [%RH]. If None then reads the current humidity value from the Smart Gadget.

Returns

float – The dew point [degree C].

humidity() float[source]

Returns the temperature [degree C].

Attention

The subclass must override this method.

info() dict[source]

Returns the temperature [degree C].

Attention

The subclass must override this method.

rssi() Optional[int][source]

Returns the Received Signal Strength Indication (RSSI) for the last received broadcast from the device.

This is an integer value measured in dB, where 0 dB is the maximum (theoretical) signal strength, and more negative numbers indicate a weaker signal.

Returns

int or None – The RSSI value if the SmartGadget was initialized with a ScanEntry object. Otherwise returns None.

temperature() float[source]

Returns the temperature [degree C].

Attention

The subclass must override this method.

temperature_humidity() Tuple[float, float][source]

Returns the temperature [degree C].

Attention

The subclass must override this method.

temperature_humidity_dewpoint() Tuple[float, float, float][source]

Returns the current temperature, humidity and dew point.

Returns

  • float – The temperature [degree C].

  • float – The humidity [%RH].

  • float – The dew point [degree C].