UNPKG

bt-sensors-plugin-sk

Version:

Bluetooth Sensors for Signalk - see https://www.npmjs.com/package/bt-sensors-plugin-sk#supported-sensors for a list of supported sensors

69 lines (55 loc) 1.97 kB
const BTHomeServiceData = require("./BTHome/BTHomeServiceData"); const AbstractBTHomeSensor = require("./BTHome/AbstractBTHomeSensor"); /** * Sensor class representing the Shelly BLU Motion. * * This sensor is publishing data utilising the BTHome format and inherits from {@link AbstractBTHomeSensor}. */ class ShellySBMO003Z extends AbstractBTHomeSensor { static Domain = this.SensorDomains.environmental /** * The shortened local name as advertised by the Shelly BLU Motion. * @type {string} */ static SHORTENED_LOCAL_NAME = "SBMO-003Z"; /** * The local name as advertised by the Shelly BLU Motion after pairing . * @type {string} */ static LOCAL_NAME="Shelly BLU Motion"; static ImageFile="ShellyBLUMotion.webp" getTextDescription(){ return `${!this.isPaired()?"NOTE: Device must be paired with SignalK server machine to operate properly (see: <a href=https://shelly-api-docs.shelly.cloud/docs-ble/common#pairing target=\"_blank\">https://shelly-api-docs.shelly.cloud/docs-ble/common#pairing</a> ":"Device is paired."}).<br><br>For more information about the sensor click here: <a href=https://us.shelly.com/products/shelly-blu-motion target="_blank">Shelly Blu Motion</a>.` } initSchema() { super.initSchema() this.addDefaultParam("zone", true) this.addMetadatum( "motion", "boolean", "motion detected", this.parseMotion.bind(this) ) .default="environment.{zone}.motion" this.addMetadatum( "illuminance", "Lux", "illuminance in zone", this.parseIlluminance.bind(this) ) .default="environment.{zone}.illuminance" this.addDefaultPath( "battery", "sensors.batteryStrength") .read=this.parseBatteryLevel.bind(this) this.addMetadatum( "button", "enum", "button", this.parseShellyButton.bind(this), ) .default="sensors.{macAndName}.button" this._schema.properties.params.properties.noContactThreshold.default=0 } } module.exports = ShellySBMO003Z;