itd is a daemon that uses my infinitime library to interact with the PineTime snartwatch running InfiniTime.
Go to file
Elara 6da03181a9 Remove version.txt on clean 2022-05-01 21:22:15 -07:00
api Remove replace directive and fix firmware upgrade error 2022-05-01 20:40:30 -07:00
cmd Fix bug where itctl could not be killed 2022-05-01 20:32:59 -07:00
translit Fix typo in code (Czeck -> Czech) 2022-04-16 10:15:55 -07:00
.gitignore Implement weather via MET Norway 2022-02-21 16:18:52 -08:00
.gitm.toml Add gitm for mirroring 2021-08-21 15:59:19 -07:00
LICENSE Initial Commit 2021-08-21 01:19:49 -07:00
Makefile Remove version.txt on clean 2022-05-01 21:22:15 -07:00
README.md Update README to reflect recent changes 2022-05-01 21:16:47 -07:00
calls.go Allow multiple call notification responses 2021-11-25 12:41:36 -08:00
config.go Switch from viper to koanf 2022-02-21 11:20:02 -08:00
dbus.go Switch calls to use dbus library and add helpers for private connections 2021-11-24 11:36:36 -08:00
go.mod Remove replace directive and fix firmware upgrade error 2022-05-01 20:40:30 -07:00
go.sum Remove replace directive and fix firmware upgrade error 2022-05-01 20:40:30 -07:00
itd.service Initial Commit 2021-08-21 01:19:49 -07:00
itd.toml Add debug logs 2022-04-23 20:20:13 -07:00
main.go Switch to lrpc and use context to handle signals 2022-05-01 11:36:28 -07:00
music.go Transliterate song metadata (Fixes #13) 2022-03-11 13:14:23 -08:00
notifs.go Switch from viper to koanf 2022-02-21 11:20:02 -08:00
socket.go Remove debug print 2022-05-01 20:56:14 -07:00
weather.go Remove debug code 2022-03-15 19:25:37 -07:00

README.md

ITD

InfiniTime Daemon

itd is a daemon that uses my infinitime library to interact with the PineTime running InfiniTime.

Build status Binary downloads AUR package


Features

  • Notification relay
  • Notification transliteration
  • Call Notifications (ModemManager)
  • Music control
  • Get info from watch (HRM, Battery level, Firmware version, Motion)
  • Set current time
  • Control socket
  • Firmware upgrades
  • Weather
  • BLE Filesystem

Socket

This daemon creates a UNIX socket at /tmp/itd/socket. It allows you to directly control the daemon and, by extension, the connected watch.

The socket uses my lrpc library for requests. This library accepts requests in msgpack, with the following format:

{"Receiver": "ITD", "Method": "Notify", "Arg": {"title": "title1", "body": "body1"}, "ID": "some-id-here"}

It will return a msgpack response, the format of which can be found here. The response will have the same ID as was sent in the request in order to allow the client to keep track of which request the response belongs to.


Transliteration

Since the PineTime does not have enough space to store all unicode glyphs, it only stores the ASCII space and Cyrillic. Therefore, this daemon can transliterate unsupported characters into supported ones. Since some languages have different transliterations, the transliterators to be used must be specified in the config. Here are the available transliterators:

  • eASCII
  • Scandinavian
  • German
  • Hebrew
  • Greek
  • Russian
  • Ukranian
  • Arabic
  • Farsi
  • Polish
  • Lithuanian
  • Estonian
  • Icelandic
  • Czech
  • French
  • Armenian
  • Korean
  • Chinese
  • Romanian
  • Emoji

Place the desired map names in an array as notifs.translit.use. They will be evaluated in order. You can also put custom transliterations in notifs.translit.custom. These take priority over any other maps. The notifs.translit config section should look like this:

[notifs.translit]
    use = ["eASCII", "Russian", "Emoji"]
    custom = [
        "test", "replaced"
    ]

itctl

This daemon comes with a binary called itctl which uses the socket to control the daemon from the command line. As such, it can be scripted using bash.

This is the itctl usage screen:

Control the itd daemon for InfiniTime smartwatches

Usage:
  itctl [flags]
  itctl [command]

Available Commands:
  firmware    Manage InfiniTime firmware
  get         Get information from InfiniTime
  help        Help about any command
  notify      Send notification to InfiniTime
  set         Set information on InfiniTime

Flags:
  -h, --help                 help for itctl
  -s, --socket-path string   Path to itd socket

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

itgui

In cmd/itgui, there is a gui frontend to the socket of itd. It uses the fyne library for Go. It can be compiled by running:

go build ./cmd/itgui

Screenshots

Info tab

Notify tab

Set time tab

Upgrade tab

Upgrade in progress


Interactive mode

Running itctl by itself will open interactive mode. It's essentially a shell where you can enter commands. For example:

$ itctl                        
itctl> fw ver
1.3.0
itctl> get batt
81%
itctl> get heart
92 BPM
itctl> set time 2021-08-22T00:06:18-07:00
itctl> set time now
itctl> exit

Installation

To install, install the go compiler and make. Usually, go is provided by a package either named go or golang, and make is usually provided by make. The go compiler must be version 1.16 or newer for the io/fs module.

To install, run

make && sudo make install

Starting

To start the daemon, run the following without root:

systemctl --user start itd

To autostart on login, run:

systemctl --user enable itd

Cross compiling

To cross compile, simply set the go environment variables. For example, for PinePhone, use:

make GOOS=linux GOARCH=arm64

This will compile itd and itctl for Linux aarch64 which is what runs on the PinePhone. This daemon only runs on Linux due to the library's dependencies (dbus, and bluez specifically).


Configuration

This daemon places a config file at /etc/itd.toml. This is the global config. itd will also look for a config at ~/.config/itd.toml.

Most of the time, the daemon does not need to be restarted for config changes to take effect.


Attribution

Location data from OpenStreetMap Nominatim, © OpenStreetMap contributors

Weather data from the Norwegian Meteorological Institute