obniz Parts Library

Switchbot_IOSensorTH

GitHub
Switchbot_IOSensorTH
Usable Devices :
obniz_board
m5stickc
obnizble
esp32
esp32gateway
m5stackbasic
ak-030
obnizble_lte
obniz_plc

Switchbot_WoIOSensorTH

Switchbot Indoor/Outdoor Thermo-Hygrometer (WoIOSensorTH) module

getData()

  • temperature: number;
  • fahrenheit: boolean;
  • humidity: number;
  • battery: number;

Example

// Javascript
const Switchbot_IOSensorTH = Obniz.getPartsClass("Switchbot_IOSensorTH");
await obniz.ble.initWait();
obniz.ble.scan.onfind = async (peripheral) => {
  if (Switchbot_IOSensorTH.isDevice(peripheral)) {
    console.log(Switchbot_IOSensorTH.getData(peripheral));
  }
};
await obniz.ble.scan.startWait(null, {duplicate: true, duration: null});

Supported from: obniz.js 3.30.0