ble-sensors/lib/xiaomi/scale/scale_v1.go
Jeffrey C. Ollie 2095a29c53
All checks were successful
continuous-integration/drone/push Build is passing
update to v2 of influxdb lib
2021-02-27 08:03:43 -06:00

21 lines
724 B
Go

package scale
import (
"time"
"github.com/go-ble/ble"
influxdb2_api "github.com/influxdata/influxdb-client-go/v2/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.Info("xiaomi v1 scale",
zap.String("source", advertisement.Addr().String()),
zap.String("description", description),
zap.String("name", advertisement.LocalName()),
zap.String("uuid", sd.UUID.String()))
}