Smart Bike Lights (Data Field) / Bike Lights Control (Widget)

I've made two open source CIQ applications to control ANT+ lights:

- Smart Bike Lights (data field): https://apps.garmin.com/en-US/apps/0d9fd828-c932-4470-9c37-fd2828881888 

      Configurator: https://maca88.github.io/SmartBikeLights/ 

- Bike Lights Control (widget): https://apps.garmin.com/en-US/apps/fa3c2332-76e3-4ba1-8528-32a0fd617ab1 

     Configurator: https://maca88.github.io/BikeLightsControl/ 

Smart Bike Lights features:
- Automatic light control (Smart mode) based on the configured filters (sunset, sunlight, speed, ...)
- Manual light control (only for Edge devices with a touch screen or devices with CIQ 3.2 and more than 32KB memory)
- Records lights modes that are displayed in Garmin Connect

Bike Lights Control features:
- Manual light control (available to all devices)

Both applications can be installed on the same device, which can be useful for low end devices (e.g. Edge 520) where "Bike Lights Control" can be used to change light modes manually and "Smart Bike Lights" for automatic light control.

Currently registered ANT+ lights:
- Bontrager Ion Pro RT
- Bontrager Ion 200 RT
- Bontrager Flare RT
- Garmin Varia RTL500
- Garmin Varia RTL510
- Garmin Varia RTL515
- Garmin Varia HL500
- Garmin Varia UT800

in case your ANT+ light is not on the list you can help by doing the following:

1. Install Bike Lights Control
2. Pair your bike light with your Garmin device
3. Open the widget:
- Edge with a touch screen: post which numbers are displayed on the buttons and what mode each button represents when pressed
- Other devices: Select the "Light modes" menu and post which numbers are displayed in the menu and what mode each menu item represents when selected

Example for Bontrager Ion Pro RT:


1 -> High steady beam
2 -> Medium steady beam
5 -> Low steady beam
63 -> Day flash
62 -> Night flash

There are some features that could be possible to add in the future, but would require Garmin to add them to the CIQ api. In case you are interested in any of the below features, consider upvoting their feature request thread:

1. Control lights based on the ambient light sensor available on some devices:
https://forums.garmin.com/developer/connect-iq/i/bug-reports/ambient-light-sensor-api-access 

  • Thanks for the mappings! The light is now available in the Lights Configurator.

  • That’s the point. We need to push tyrewiz app designer.

  • Good to know, thanks for the info.

    Cool, using Magene app I can create 2 my custom light modes - which will have 59 or 60 ID Slight smile, and then I can use these lights with your app automations - awesome Slight smile.

    I really impressed with Magene AT1600 - it even support power pash-thrue. I hope they will release also L308 with ANT+ version Slight smile


    Btw, I send to Magene support with ask: allow 62 & 63 use with custom light modes, and also that these ID I could change in the app.
    As, I understand Garmin have predefined list, and we can have only max 5 custom modes:

    https://developer.garmin.com/connect-iq/api-docs/Toybox/AntPlus.html#LightMode-module

    I am not really sure why a background service is required to retrieve data from Quarq TyreWiz

    I see in Garmin Connect charts - tyre pressure graph (front & back), not sure maybe that's why it requires background service, OR because TyreWiz 2.0 is not connected to Garmin sensors (Garmin do not support), but this app connect directly to ANT+ TyreWiz sensors (I need to provide ID).
    Maybe the same way you could connect to Di2 - and use as remote control bike lights with D-Fly buttons??? Slight smile 

    I hope it's possible to have both apps Slight smile, not sure why it have conflict...
    Or maybe you can create new app for the TyreWiz Slight smile, which is compatible with Smart Bike Lights

    When enabled, it will record the light modes during an activity and you will be able to see the light modes in Garmin Connect as a graph. The only thing to note is that the light modes are recorded as numbers (1, 5, 61, 63, ...), as this is the only way to create a graph in Garmin Connect.

    Now it's clear, at first this short sentence in github didn't ring the bell Slight smile. You should add this explanation to the documentation

    this is a Smart Bike Lights feature which will automatically groups lights of the same type, when serial number is not set
    if you do not want do have dependencies, then you will need to install Smart Bike Lights #2

    I would prefer pages - like lap summary page. Why?, becauseI I want to have min pages on my Garmin, easy navigation when riding, also because when one light is not connected (maybe I left it home, or battery dead) - I do not get empty screen, which looks ugly :)

    Other option would be: show this page if sensor connected. Garmin have these pages which visible only on some conditions. For example: e-bike, when Garmin connect to e-bike sensor, only then it will show data page with fields and controls, if it not connected you will not see this page. Maybe you can also do that?

    In short, if you do not want do have dependencies, then you will need to install Smart Bike Lights #2

    This is what I did now, I have #1 (AT1600 & Flare RT) & #2 (Varia 515)  Slight smile, thanks

    Done, now there is a separate option for AT1600 in the Lights Configurator

    Thanks!

    What do you mean is is not working, do you get an error X or No network? If yes, please provide the both the unknown config that does not work and the one that does work.

    I didn't save that :( I could try later to reproduce. But when you have three lights connected AT1600, Flare RT, Varia 515 - if I select Unknown for the Taillight (and set 5, 7 - combined modes), works fine, but if I select Unknown for the Headlight (and set exactly the same modes like AT1200, except 63 I replace with 61) - it do not work, there is no errors - nothing, I see only Taillight controls (combined Flare RT & Varia 515), missing Headlight. Then only thing that I change - instead of Unknown I switch to AT1200 - and then it works.

    ---
    Now I found config which for me works more or less as I desire... (with a few workarounds)
    But to be perfect I'm missing a few things:

    - Di2 remote control
    - TyreWiz compatibility (probably it's not on your side, but if you can think of any solution would be nice, or include TyreWiz sensors into your app :) )
    - Data page - I would prefer multiple lights in the same page, where you can scroll/list to right & left. Or if not possible, to have multiple data pages - but then with visibility conditions (visible only when sensor connected)

    Maybe you will consider to add these features Slight smile


    Cheers

  • Other question: how to make two lines button text?

    I tried "\n" without luck Slight smile

    I want to add text (it could be smaller) - with lumens and run time:


      Very High
    1600lm-1.5h


    So, I don't need to memorise what are expected runtime and brightness levels for each mode

    P.S> in some case it auto moves to second line, but sometimes not, so is there any way to force go to second line

  • I see in Garmin Connect charts - tyre pressure graph (front & back), not sure maybe that's why it requires background service, OR because TyreWiz 2.0 is not connected to Garmin sensors (Garmin do not support), but this app connect directly to ANT+ TyreWiz sensors (I need to provide ID).

    Background service is not required for Garmin Connect charts or for connecting to ANT+ sensors not supported by Garmin. Usually background service in a data field are used to send HTTP requests to a remote endpoint or to get data from natively supported ANT+ sensors.

    Maybe the same way you could connect to Di2 - and use as remote control bike lights with D-Fly buttons???

    Di2 uses a private ANT network (with private keys), so it is not possible to connect to it unless you know both 64, and 128 bit private network keys. Quarq TyreWiz on the other hand, is using the TPMS (Type Pressure Monitor Sensor) ANT+ profile (ANT+ uses public keys) based on my understanding.

    Or maybe you can create new app for the TyreWiz

    In order to implement such a data field, I would need to purchase a TyreWiz sensor and obtain access to the TPMS ANT+ profile specification. Unfortunately, this profile is not publicly available because it was never finalized. It is only accessible through the "Member Early Release" program, which I do not have access to. Since I do not plan to use a TyreWiz sensor in the near future, I am not currently interested in implementing a new data field for it.

    I would prefer pages - like lap summary page. Why?, becauseI I want to have min pages on my Garmin, easy navigation when riding, also because when one light is not connected (maybe I left it home, or battery dead) - I do not get empty screen, which looks ugly :)

    With a CIQ data field, user interactions are very limited. Data fields cannot capture user input such as swiping left/right or scrolling, so implementing something like a summary page is not possible. The only interaction a data field can detect is a tap, and even that only works on Edge devices with touchscreens (does not apply to touchscreen watches like the Fenix 7 or Fenix 8).

    Other option would be: show this page if sensor connected. Garmin have these pages which visible only on some conditions. For example: e-bike, when Garmin connect to e-bike sensor, only then it will show data page with fields and controls, if it not connected you will not see this page. Maybe you can also do that?

    This is not possible with a CIQ data field.

  • Other question: how to make two lines button text?

    Currently, this is not possible, but it could be supported in a future release.

  • What do you mean is is not working, do you get an error X or No network? If yes, please provide the both the unknown config that does not work and the one that does work. I would like to see what could be the issue. In theory, you should be able to use Unknown to configure any light. The only thing that will not work with Unknown are the light icons, where you will always see "?" for each light mode.

    I recreated failing config, when Taillight model selected as Unknown - it will not show (no errors, no nothing, just missing Headlight). If I switch back to AT1600 - all works.

    Not working config:

    #:1,2147483647:1:#7,4!HIGH:2:3:20:0C]6.66667Es0,r0!NIGHT:2:5:60:0Es0,r0H]2!DAY:2:0:60:0Er0,s0H]2!:1:0:0:0D=1#6291461,1409482753:0,889104606:1:#11,5!BreakD:3:1:5:0Er0,s0H]2A[-20!BreakN:3:5:5:0Es0,r0H]2A[-20!Day:2:8:60:0Er0,s0H]2!Night:2:63:60:0Es0,r0H]2!:1:0:0:0D=1#11,10:AT 1600:0:16777215!2,:-1,Off:0!1,Very High 1600lm-1.5h:1!1,High 1200lm-2h:2!1,Medium 800lm-3h:3!1,Medium-Low 600lm-4.5h:4!1,Low 400lm-6h:5!1,Slow Flash:6!1,Fast Flash:7!1,Preset 9:59!1,Preset 10:60#8,7:Flare RT:0:16777215!2,:-1,Off:0!1,Day Steady 25lm-4.5h:1!1,Night Steady 5lm-13.5h:5!1,Day Flash 90lm-6h:7!1,All-Day Flash 45lm-12h:8!1,Night Flash 5lm-15h:63!1,:-2#0::#0:0#123!:123!#0#0#B3843#99#1#0#0

    Working config:

    #16384,90382865:1,2147483647:1:#7,4!HIGH:2:3:20:0C]6.66667Es0,r0!NIGHT:2:5:60:0Es0,r0H]2!DAY:2:0:60:0Er0,s0H]2!:1:0:0:0D=1#6291461,1409482753:0,889104606:1:#11,5!BreakD:3:1:5:0Er0,s0H]2A[-20!BreakN:3:5:5:0Es0,r0H]2A[-20!Day:2:8:60:0Er0,s0H]2!Night:2:63:60:0Es0,r0H]2!:1:0:0:0D=1#9,8:AT 1600:0:16777215!2,:-1,Off:0!1,Very High 1600lm-1.5h:1!1,High 1200lm-2h:2!1,Medium 800lm-3h:3!1,Medium-Low 600lm-4.5h:4!1,Low 400lm-6h:5!1,Slow Flash:6!1,Fast Flash:7#8,7:Flare RT:0:16777215!2,:-1,Off:0!1,Day Steady 25lm-4.5h:1!1,Night Steady 5lm-13.5h:5!1,Day Flash 90lm-6h:7!1,All-Day Flash 45lm-12h:8!1,Night Flash 5lm-15h:63!1,:-2#0::#0:0#123!:123!#0#0#B3843#14#1#0#0

    This create for me a problem, because I want to add custom modes: 59 & 60,and only way I can do that is to use 'Unknown'. Maybe you can allow to add buttons to existing models - and write ID? (now only list of available friendly names)

    OR, add to AT1600 two modes: Preset 9 = 59, and Preset 10 = 60

  • Currently, this is not possible, but it could be supported in a future release.

    Just an other idea: add lumens and runtime as separate fields in your configurator, and show them below text (or some graphics).

    And when you know max runtime for selected light mode and battery level - you could predict how much time left with selected mode. And visualise this on button - fill button background with colour (bar)

    I think that would be awesome Slight smile

  • With a CIQ data field, user interactions are very limited. Data fields cannot capture user input such as swiping left/right or scrolling, so implementing something like a summary page is not possible. The only interaction a data field can detect is a tap

    Take a look on default data screen: Lap Summary. There is on the top corners buttons, left & right - '<' & '>', which you can press and change inside pages: 'Avg Speed', 'Calories', Grit', 'Flow' .... etc. There is a lot more inside pages. (I guess you can control these with buttons also).
    Maybe you could implement the same, just in your case these buttons <' & '>' will swipe to different light pairs if you have multiple.

    Then on the header line, where would be buttons on corners <' & '>', on the Center I would like to have 'Smart" button - when pressed it will apply this mode to All lights (now I need to do that on each light, and on different data screens, now it's a little pain).

  • With the latest version 0.29.0 it is possible to use /n to force new lines inside light panel buttons
    In addition, a new option was added to display the group name in the light panel (requested by others):

    > I recreated failing config, when Taillight model selected as Unknown - it will not show (no errors, no nothing, just missing Headlight). If I switch back to AT1600 - all works.

    Thanks for this. I was able to identify and fix the issue. The fix is included in version 0.29.0

    > OR, add to AT1600 two modes: Preset 9 = 59, and Preset 10 = 60

    Added these two modes to the light configuration.

    > Just an other idea: add lumens and runtime as separate fields in your configurator, and show them below text (or some graphics). And when you know max runtime for selected light mode and battery level - you could predict how much time left with selected mode.

    Do note that the battery level reported by the light via ANT represents a range, where the range is not documented. For example, when a light shows 4 bars (BATT_STATUS_GOOD), we can assume that the battery is at around 70%. However, the actual level could be anywhere between 60% and 80%, assuming each status represents a 20% range. In short, I'm not sure how useful this information is, given the limited detail provided by the light's battery reporting.

    > Then on the header line, where would be buttons on corners <' & '>', on the Center I would like to have 'Smart" button - when pressed it will apply this mode to All lights (now I need to do that on each light, and on different data screens, now it's a little pain).

    I see what you mean, but implementing something like this would require a redesign of both the configurator and the data field. When I initially developed the data field, I limited it to one headlight and one taillight for simplicity, as most people (myself included) don’t use multiple lights during a ride.

    At this point, adding support for multiple lights would be quite challenging without introducing breaking changes and incompatible configurations. It would also require a significant development effort. I’ll add this to my TODO list, but I wouldn’t count on it happening anytime soon.

    For your case, I think that when the configuration of the external light mode change (e.g. by Di2 button) will be implemented, it should satisfy most of your requirements:

    Smart Bike Lights
    Magene AT1600 + Bontrager Flare RT
    Ignore external light mode changes

    Smart Bike Lights #2 (Helmet)
    Trek Commuter Pro RT
    Configure external light mode changes (Lights On/Off, Lights Change Mode)

    If you want to control only the helmet light with Di2 buttons, then you can achieve that with the current version by using Individual Light Network for Magene AT1600 + Bontrager Flare RT. When moving the two main lights to the Individual Light Network, you will have only Trek Commuter Pro RT light paired with the native Garmin Light Network, which means that the Di2 button will affect only Trek Commuter Pro RT light.