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 

  • Just updated to the new version & loaded the your modified configuration. Thank you for looking into it,Thumbsup

    No crashes so you've nailed that one. I'll try the light on my ride tomorrow & feed back. 

  • The minimum time and radar in version 0.9.1 are my most anticipated features. This app makes my expensive bike lights even better.
    Below is the filter configuration that I changed, I will find time to ride a test

    Thank you so much,

    ###0,73535488#6,5|BRAKE:2:7:3A<-3C>2.22222|TUNNEL:1:6:1G<4|RADAR:1:7:1I<60>0|NIGHT:1:6:1Es1800,r-1800|:1:0:1D=1##6,5:Varia 515|2,:-1,Off:0|1,Solid:4|1,Peloton:5|1,Day Flash:7|1,Night Flash:6#B3570##3#0#1
  • I just drove to test your app, it runs well and there is no problem, but the device cpu is not fast enough, so I set the acceleration filter <-3, which can make the brake lights react faster. I am very satisfied
    I found that some devices have acceleration sensor (such as edge 1030 plus). Is it possible to obtain this data and apply it to "smart bike light" app?
    Thanks again for your hard work and help

  • I am glad that it works.

    For the accelerometer, I did some testing and find out that it is not possible to retrieve the its data in a data field application with a 1Hz refresh rate or higher. As far as I understand, the only way to get the accelerometer data in a data field application is within a background process that be spawn only every 5 minutes which is not suitable for this case. Even if it would be possible there would still be a delay as the application needs to send a message to the light to switch the light mode.

  • Thanks for your explanation
    I am very satisfied with the features that the app brings

    Thank you again

  • Hi. I tested the new configuration on a short ride yesterday. The switch between light modes on vehicle detection worked perfectly....You are a geniusHeart eyes

    A small observation but not really an issue was that when you first switch to the data screen after loading the activity profile, the datascreen shows 'No Networ' for a few seconds before displaying the layout. I guess this should have a 'K' on the end. I'm also guessing here that you've configured this message to be displayed while the datascreen first initialises would you expect it to be displayed even though the Radar/Light network has already formed when the datascreen is accessed?

  • Thanks for the feedback! I can now remove the experimental note :)

    > the datascreen shows 'No Networ'

    Can you make a screenshot/picture as in the simulator the "No Network" message looks like this:

    > shows 'No Networ' for a few seconds before displaying the layout

    This message is displayed when the lights are not connected or when the Connect IQ api is initializing, which occurs in your case. Even if the lights are connected, the message will still be displayed as Connect IQ api has its own initialization process. The message is removed when the Garmin Connect api calls onLightNetworkStateUpdate (https://developer.garmin.com/connect-iq/api-docs/Toybox/AntPlus/LightNetworkListener.html#onLightNetworkStateUpdate-instance_function) event registered by the data field with state LIGHT_NETWORK_STATE_FORMED.

  • Interesting, I am not sure how is this even possible, looks like that the code on your device is somehow different. I am not able to reproduce the issue on my Edge 1000 or on the simulator, the name in the code is correct:
    https://github.com/maca88/SmartBikeLights/blob/master/Source/SmartBikeLights/source-common/BikeLightsView.mc#L291

    so I have no cue why the "k" character is missing on your device. For developers: In case anyone knows what could be the problem I would appreciate your help.
    Did the "k" character disappear in a recent release or it was missing from the beginning (first install)?

  • That's very bizarre. Unless there's a CIQ font issue on the 1030 I can't think what it would be. Are there any graphical elements that could possibly be covering the character?

    The missing 'k' has been like that since I first installed the datafield. I didn't think it was worth troubling anyone with by reporting such an insignificant thing, which wasn't stopping the datafield from working