21 lines
722 B
Go
21 lines
722 B
Go
package scale
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/go-ble/ble"
|
|
influxdb2_api "github.com/influxdata/influxdb-client-go/api"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
// XiaomiScaleV1UUID is BLE UUID for Xiaomi Scale V1
|
|
var XiaomiScaleV1UUID ble.UUID = []byte{0x1d, 0x18}
|
|
|
|
// ParseXiaomiScaleV1 parses V1 scale service data
|
|
func ParseXiaomiScaleV1(writeAPI *influxdb2_api.WriteAPI, logger *zap.Logger, timestamp time.Time, detector string, description string, advertisement ble.Advertisement, index int, sd ble.ServiceData) {
|
|
logger.Debug("xiaomi v1 scale",
|
|
zap.String("source", advertisement.Addr().String()),
|
|
zap.String("description", description),
|
|
zap.String("name", advertisement.LocalName()),
|
|
zap.String("uuid", sd.UUID.String()))
|
|
}
|