ble-sensors/lib/xiaomi/scale/scale_v1.go

22 lines
722 B
Go
Raw Normal View History

2020-08-08 19:00:41 -05:00
package scale
import (
"time"
2020-08-09 07:23:47 -05:00
"github.com/go-ble/ble"
2020-08-08 19:00:41 -05:00
influxdb2_api "github.com/influxdata/influxdb-client-go/api"
2020-08-09 07:23:47 -05:00
"go.uber.org/zap"
2020-08-08 19:00:41 -05:00
)
// XiaomiScaleV1UUID is BLE UUID for Xiaomi Scale V1
var XiaomiScaleV1UUID ble.UUID = []byte{0x1d, 0x18}
// ParseXiaomiScaleV1 parses V1 scale service data
2020-08-09 07:23:47 -05:00
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()))
2020-08-08 19:00:41 -05:00
}