GithubHelp home page GithubHelp logo

davidkroell / bodycomposition Goto Github PK

View Code? Open in Web Editor NEW
32.0 7.0 3.0 101 KB

Bodycomposition is a program to manage your body measurements and composition stored in Garmin Connect from your beloved commandline.

License: Apache License 2.0

Go 100.00%
go fit fitness garmin garmin-connect

bodycomposition's Introduction

GitHub Workflow Status GitHub release (latest SemVer) GitHub go.mod Go version (subdirectory of monorepo) Go Report Card Go Reference GitHub all releases GitHub license

bodycompostion

Bodycomposition is a program to manage your body measurements and composition stored in Garmin Connect Cloud (https://connect.garmin.com) from your beloved commandline.

For now, you can just add body composition values. Any other thing should be done in Garmin Connect.

Download

Releases can be found in release tab.

Usage

Uploading weight to Garmin connect. If you do not provide a password (--password), it will be prompted from stdin.

$ ./bodycomposition upload --weight 80 --bone 14 --fat 13 --hydration 58 --muscle 42 --email [email protected]

General usage

$ ./bodycomposition -h
Bodycomposition is a program to manage your body measurements and composition stored in
Garmin Connect Cloud (https://connect.garmin.com) from your beloved commandline.

For now, you can just add body composition values. Any other thing should be done in Garmin Connect.
Version v2.0.0

Usage:
  bodycomposition [command]

Available Commands:
  help        Help about any command
  upload      Upload your body composition values to Garmin Connect

Flags:
  -h, --help   help for bodycomposition

Use "bodycomposition [command] --help" for more information about a command.

Upload command usage

$ ./bodycomposition upload -h
Upload your body composition values to Garmin Connect

Usage:
  bodycomposition upload [flags]

Aliases:
  upload, u, add

Flags:
      --bmi float               Set your BMI - body mass index
  -b, --bone float              Set your bone mass in percent
      --bone-mass float         Set your bone mass in kilograms (use --bone or --bone-mass)
  -c, --calories float          Set your caloric intake
  -e, --email string            Email of the Garmin account
  -f, --fat float               Set your fat in percent
  -h, --help                    help for upload
      --hydration float         Set your hydration in percent
      --metabolic-age float     Set your metabolic age
  -m, --muscle float            Set your muscle mass in percent
      --muscle-mass float       Set your muscle mass in kilograms (use -muscle or --muscle-mass)
  -p, --password string         Password of the Garmin account
      --physique-rating float   Set your physique rating (valid values: 1-9)
  -t, --unix-timestamp int      Set the timestamp of the measurement (default -1)
      --visceral-fat float      Set your visceral fat rating (valid values: 1-60)
  -w, --weight float            Set your weight in kilograms (default -1)

bodycomposition's People

Contributors

davidkroell avatar dependabot[bot] avatar ivanfor avatar lswiderski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bodycomposition's Issues

Problem with cobra library ?

panic: social profile not found in HTML

goroutine 1 [running]:
github.com/davidkroell/bodycomposition.BodyComposition.uploadFitFile(0x0, 0xed6e53c22, 0xc9f1c0, 0x404cc66666666666, 0x402a8a3d70a3d70a, 0x404dc00000000000, 0x4012000000000000, 0x40548f5c28f5c28f, 0x4013eb851eb851ec, 0x4018000000000000, ...)
/home/davidk/go/src/github.com/davidkroell/bodycomposition/main.go:78 +0x1c4
github.com/davidkroell/bodycomposition.BodyComposition.UploadWeight(0x0, 0xed6e53c22, 0xc9f1c0, 0x404cc66666666666, 0x402a8a3d70a3d70a, 0x404dc00000000000, 0x4012000000000000, 0x40548f5c28f5c28f, 0x4013eb851eb851ec, 0x4018000000000000, ...)
/home/davidk/go/src/github.com/davidkroell/bodycomposition/main.go:97 +0x21d
github.com/davidkroell/bodycomposition/cmd.glob..func1(0xc12e80, 0xc000084b00, 0x0, 0x16)
/home/davidk/go/src/github.com/davidkroell/bodycomposition/cmd/upload.go:47 +0x4a6
github.com/spf13/cobra.(*Command).execute(0xc12e80, 0xc0000849a0, 0x16, 0x16, 0xc12e80, 0xc0000849a0)
/home/davidk/go/src/github.com/spf13/cobra/command.go:845 +0x2ae
github.com/spf13/cobra.(*Command).ExecuteC(0xc12be0, 0xc000080100, 0xc000080100, 0xc000080100)
/home/davidk/go/src/github.com/spf13/cobra/command.go:946 +0x318
github.com/spf13/cobra.(*Command).Execute(...)
/home/davidk/go/src/github.com/spf13/cobra/command.go:886
github.com/davidkroell/bodycomposition/cmd.Execute()
/home/davidk/go/src/github.com/davidkroell/bodycomposition/cmd/root.go:24 +0x32
main.main()
/home/davidk/go/src/github.com/davidkroell/bodycomposition/cmd/bodycomposition/main.go:8 +0x20

Authentication error

When I try to send I have such an error:
"... uploading weight
Error uploading file to Garmin Connect: social profile not found in HTML
exiting after 1 tries"

Lates version 1.1.3 not working :(

In both Windows and Linux, the sending attempt ends with such errors:

panic: username and/or password not recognized

goroutine 1 [running]:
github.com/davidkroell/bodycomposition.BodyComposition.uploadFitFile(0x54248e37, 0xbfba4f5c, 0xd82bf, 0x0, 0x877f200, 0x33333333, 0x404d3333, 0x33333333, 0x402b3333, 0x9999999a, ...)
/home/davidk/go/src/github.com/davidkroell/bodycomposition/main.go:74 +0xc2
github.com/davidkroell/bodycomposition.BodyComposition.UploadWeight(0x54248e37, 0xbfba4f5c, 0xd82bf, 0x0, 0x877f200, 0x33333333, 0x404d3333, 0x33333333, 0x402b3333, 0x9999999a, ...)
/home/davidk/go/src/github.com/davidkroell/bodycomposition/main.go:92 +0x185
github.com/davidkroell/bodycomposition/cmd.glob..func1(0x8738fa0, 0x9012280, 0x0, 0x14)
/home/davidk/go/src/github.com/davidkroell/bodycomposition/cmd/upload.go:45 +0x3a5
github.com/spf13/cobra.(*Command).execute(0x8738fa0, 0x90121e0, 0x14, 0x14, 0x8738fa0, 0x90121e0)
/home/davidk/go/src/github.com/spf13/cobra/command.go:845 +0x1f1
github.com/spf13/cobra.(*Command).ExecuteC(0x8738e40, 0x903e070, 0x0, 0x1)
/home/davidk/go/src/github.com/spf13/cobra/command.go:946 +0x270
github.com/spf13/cobra.(*Command).Execute(...)
/home/davidk/go/src/github.com/spf13/cobra/command.go:886
github.com/davidkroell/bodycomposition/cmd.Execute()
/home/davidk/go/src/github.com/davidkroell/bodycomposition/cmd/root.go:24 +0x24
main.main()
/home/davidk/go/src/github.com/davidkroell/bodycomposition/cmd/bodycomposition/main.go:8 +0x17

Some parameters are not synchronizing

Some parameters are not synchronizing:
--physiqueRating
--visceralFat
--physiqueRating
--metabolicAge

These parameters are synchreonized incorrectly:
--bone - for example it should be 2.6 and it is 1.5
err

Missing function

Missing function:
Physique Rating
Visceral Fat
Metabolic Age
Caloric Intake

Please, add them.

Best Regards,
Robert

New Api in dependent library

The maintainer of a dependency released a new feature to create .fit-files from scratch to his library. Needed functionality added in tormoder/fit#49

bodycomposition/main.go

Lines 24 to 68 in 42fecfc

func (bc BodyComposition) writeFitFile(writer io.Writer) error {
weightfile := fit.WeightFile{
UserProfile: nil,
WeightScales: []*fit.WeightScaleMsg{
{
Timestamp: bc.TimeStamp,
Weight: fit.Weight(bc.Weight * 100),
PercentFat: uint16(bc.PercentFat * 100),
PercentHydration: uint16(bc.PercentHydration * 100),
BoneMass: uint16(bc.Weight * bc.PercentBone),
MuscleMass: uint16(bc.Weight * bc.PercentMuscle),
VisceralFatRating: uint8(bc.VisceralFatRating),
PhysiqueRating: uint8(bc.PhysiqueRating),
MetabolicAge: uint8(bc.MetabolicAge),
},
},
}
fitfile := fit.File{
FileId: struct {
Type fit.FileType
Manufacturer fit.Manufacturer
Product uint16
SerialNumber uint32
TimeCreated time.Time
Number uint16
ProductName string
}{Type: fit.FileTypeWeight, Manufacturer: fit.ManufacturerTanita},
Header: struct {
Size byte
ProtocolVersion byte
ProfileVersion uint16
DataSize uint32
DataType [4]byte
CRC uint16
}{Size: 14, ProtocolVersion: 16, ProfileVersion: 2092, DataType: [4]byte{46, 70, 73, 84}},
}
err := fitfile.SetWeight(&weightfile)
if err != nil {
panic(err)
}
return fit.Encode(writer, &fitfile, binary.BigEndian)
}

Tasks:

  • re-implement using the new version of the package

BMI parameter

Hi,

I miss the BMI parameter transfer to Garmin Connect.
Can you check if there is such a possibility?

Best Reagards,
Robert

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.