ptx2 / gymnasticon

Make obsolete and/or proprietary exercise bikes work with popular cycling training apps like Zwift, TrainerRoad, Rouvy and more.

Home Page:https://ptx2.net/posts/unbricking-a-bike-with-a-raspberry-pi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Raspberry Pi headless config for different bike types

chriselsen opened this issue · comments

Now that Gymnasticon supports more and more bike types, it would be great if the Gymnasticon Raspberry Pi Image could provide headless configuration options:

  • Users would follow the existing steps to create the SD card from the Gymnasticon Raspberry Pi Image
  • If the desired bike is not the standard "Flywheel" bike, users would create a "gymnasticon.json" file within the boot partition of the SD card. That json file indicates the bike type and any other desired non-standard config items.
  • Upon boot a service copies the gymnasticon.json file from /boot to /etc, where it is used via the existing "--config" option parameter by gymnasticon

This would simplify setup and configuration of Gymnasticon for a majority of users.

The service to move the config file could be based on the existing Raspberry Pi service to move the "wpa_supplicant.conf" file:

gymnasticon-mods.service:
[Unit]
Description=Copy user gymnasticon.json
ConditionPathExists=/boot/gymnasticon.json
Before=gymnasticon.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/mv /boot/gymnasticon.json /etc/gymnasticon.json
ExecStartPost=/bin/chmod 600 /etc/gymnasticon.json

[Install]
WantedBy=multi-user.target

The existing gymnasticon service would need to be changed to:

ExecStart=/opt/gymnasticon/node/bin/gymnasticon --config /etc/gymnasticon.json

A sample gymnasticon.json could look like this:

{
  "bike": "ic4"
}