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 

  • That is great to hear! In order to prevent wasting future users time, I've documented how to change control modes for various Garmin devices github.com/.../SmartBikeLights

  • Great
    I tested ut 800 and rtl 510 at the same time in the two days. If I select "auto" for ut 800 in garmin light mode, and then go back to smart bike light and select "S" mode, after changing between DAY FLASH and HIGH, smart bike light will return "M" mode, after that I select "off" for headlight and taillight in garmin light mode, then smart bike light can stay at "S" steadily.
    Working correctly, so happy

    thank you for your help

  • If I understand correctly, in your case when the Garmin light mode is set to "Auto", the "S" can switch to "M" by itself? If this is the case, can you please explain what are the steps needed to reproduce the issue?

    I wasn't able to reproduce the issue by doing following steps:
    1. Set Garmin Light mode to "Auto"
    2. Start the activity
    3. On the data field light panel press the "N" button to go into the Smart mode
    4. The "N" button is changed to "S" and it does not change to "M"

    > after changing between DAY FLASH and HIGH, smart bike light will return "M" mode

    What triggers this change, the Garmin "Auto" light mode or a press of the button on the data field panel?

  • when the Garmin light mode is set to "Auto", the "S" can switch to "M" by itself?

    Yes

    What triggers this change, the Garmin "Auto" light mode or a press of the button on the data field panel?

    Is Garmin "Auto" light mode

    Sorry because my english is not good

    At first, wait for the device to connect with the radar (rtl 510) and light network (rtl510 + ut 800). At this time, the headlight mode is "Auto"

    I put SMART BIKE LIGHT in "S" mode and started riding. If the headlight beam automatically changes to "High" or "Medium" at this time, SMART BIKE LIGHT will also automatically change back to "M" mode.

    As long as I set the Override Light mode to "OFF", SMART BIKE LIGHT can stay "S" without changing (Because "SMART BIKE LIGHT" is installed, it is fully automatic, so I uninstalled GARMIN LIGHT MODE), This is perfect

    No problem now

    Thanks again

    During the day and night, the light beam is changed according to the speed, the tunnel lights are automatically turned on, and the room is automatically turned off. The brake lights and radar can detect flashes at various distances, thereby extending battery life

    My code

    #0,73413136#25,9|S35H:3:2:1C>9.72222Es0,r0B<4|S25H:4:3:1C<9.72222C>6.94444Es0,r0B<4|S25L:3:4:1C>6.94444Es0,r0B>4|TUNNEL:2:6:1G<4C>0.27778|INDOOR:2:0:1G<4C<0.27778|DAY:2:7:1Er0,s0C>5.55556|S1H:4:4:1C<6.94444C>0.27778Es0,r0B<4|S1L:4:7:1C<6.94444C>0.27778Es0,r0B>4|:1:0:1D=1#0,73404416#48,18|BRAKE1:2:7:3A<-10C>8.33333|BRAKE2:3:7:3A<-3C<8.33333C>2.77778|BRAKE3:3:7:3A<-20C<2.77778C>0.27778|TUNNEL:2:6:1G<4C>0.27778|INDOOR:2:0:1G<4C<0.27778|NIGHT1:3:5:1Es0,r0C>0.27778B<4|NIGHT2:3:7:1Es0,r0C>0.27778B>4|NIGHT3:2:7:1Es0,r0C<0.27778|RADAR1:3:7:1I<80=2C>0.27778Er0,s0|RADAR2:3:7:1I<50=1C>0.27778Er0,s0|RADAR3:3:7:1I<120=2C>0.27778Es0,r0|RADAR4:3:7:1I<80=1C>0.27778Es0,r0|RADAR5:3:7:1I<60=2C<0.27778Er0,s0|RADAR6:3:7:1I<40=1C<0.27778Er0,s0|RADAR7:3:7:1I<80=2C<0.27778Es0,r0|RADAR8:3:7:1I<60=1C<0.27778Es0,r0|RADAR9:3:0:1I<140>0C<0.27778G<4|:1:0:1D=1#7,6:Varia 800|2,:-1,Off:0|1,強 光:2|1,中 光:3|1,弱 光:4|1,夜 閃:6|1,日 閃:7#5,4:Varia 510|2,:-1,Off:0|1,強 光:4|1,日 閃:7|1,夜 閃:6#B3570#4#2#0#1

  • Thanks for the detailed explanation!

    I put SMART BIKE LIGHT in "S" mode and started riding. If the headlight beam automatically changes to "High" or "Medium" at this time, SMART BIKE LIGHT will also automatically change back to "M" mode.

    This is really strange, when you put the light in "S" mode the data field will override the Garmin "Auto" light mode so the change to "High" or "Medium" should only happen by the defined filters from "Lights Configurator". It seems like that your UT800 works a bit different than my Bontrager Ion Pro RT, as I am not able to reproduce this issue. As you found a workaround for it, I will not try to fix the issue as I am not able to reproduce it.

    Regarding your lights configuration I am really surprised how many filters you've set, I didn't expected such complex configurations :)

    After analyzing your configuration I notice some minor issues and one bigger issue that you need to fix. With your current configuration when the lights will reach a "Low" battery in the night, they will be turned OFF with the current filters! To fix this you need to either fix filter with "Light Battery > Low" to "Light Battery > Bad" so that the Low in included with those filters or change filters with "Light Battery < Low" to "Light Battery < Ok".

    Other minor issues with the configuration:
    - Filter group NIGHT1 has an invalid Light mode
    - Filter groups RADAR3, RADAR4, RADAR7 and RADAR8 will never be activated because of filter groups NIGHT1, NIGHT2 and NIGHT3. These radar filter groups need to be moved before the NIGHT1 filter group in order them to be activated.

    some optimization that can be made:
    - The filter "Speed < 35" inside filter group S25H can be removed as it is addressed in S35H
    - Filter group RADAR9 can be removed, as the "Default mode" for the light is also "Off
    - NIGHT2 and NIGHT3 can be merged into one filter group

    I made two optimizations for the "Lights Configuration" in order to easier edit complex configurations:
    - Added up and down arrow buttons for filters and groups that can be used to move them higher or lower in the stack
    - When parsing a configuration, filters and groups will be collapsed to achieve faster rendering and better readability

    Also with the new "Lights Configuration" version, your configuration won't be parsed anymore as it has an invalid light mode. To fix your configuration replace "NIGHT1:3:5" with "NIGHT1:3:4" or use the following version that addresses the mentioned issues/optimizations:

    #0,73413136#24,9|S35H:3:2:1C>9.72222Es0,r0B<4|S25H:3:3:1C>6.94444Es0,r0B<4|S25L:3:4:1C>6.94444Es0,r0B>3|TUNNEL:2:6:1G<4C>0.27778|INDOOR:2:0:1G<4C<0.27778|DAY:2:7:1Er0,s0C>5.55556|S1H:4:4:1C<6.94444C>0.27778Es0,r0B<4|S1L:4:7:1C<6.94444C>0.27778Es0,r0B>3|:1:0:1D=1#0,73404416#41,16|BRAKE1:2:7:3A<-10C>8.33333|BRAKE2:3:7:3A<-3C<8.33333C>2.77778|BRAKE3:3:7:3A<-20C<2.77778C>0.27778|TUNNEL:2:6:1G<4C>0.27778|INDOOR:2:0:1G<4C<0.27778|RADAR3:3:7:1I<120=2C>0.27778Es0,r0|RADAR4:3:7:1I<80=1C>0.27778Es0,r0|RADAR7:3:7:1I<80=2C<0.27778Es0,r0|RADAR8:3:7:1I<60=1C<0.27778Es0,r0|NIGHT1:3:4:1Es0,r0C>0.27778B<4|NIGHT2:1:7:1Es0,r0|RADAR1:3:7:1I<80=2C>0.27778Er0,s0|RADAR2:3:7:1I<50=1C>0.27778Er0,s0|RADAR5:3:7:1I<60=2C<0.27778Er0,s0|RADAR6:3:7:1I<40=1C<0.27778Er0,s0|:1:0:1D=1#7,6:Varia 800|2,:-1,Off:0|1,強 光:2|1,中 光:3|1,弱 光:4|1,夜 閃:6|1,日 閃:7#5,4:Varia 510|2,:-1,Off:0|1,強 光:4|1,日 閃:7|1,夜 閃:6#B3570#4#2#0#1

    I released a new version of the data field 0.9.3 that fixes the light mode validation so that now you will get an "Error 4" for your configuration. Also in case you experienced random crashes of the data field, I was able to reproduce and fix the issue.

  • First of all thank you for your review and help

    I will not try to fix the issue as I am not able to reproduce it.

    As long as I turn off "Auto" in "GARMIN LIGHT MODE", there will be no problem

    After your explanation, I have roughly understood the logic of the data field. For example, I misunderstood that "Battery state" is linear from 0 to 100, and I will re-modify the lights configuration.

    new "Lights Configuration" version

    The new "Lights Configurator" version is very easy to use

    There is a cycling challenge in Taiwan that is to ride 520 kilometers in 24 hours. Maybe one day I can participate. I hope that my taillight can extend the battery life from 15 hours to 24 hours, and also enhance the performance.

    Thanks again for your help

  • I have roughly understood the logic of the data field. For example, I misunderstood that "Battery state" is linear from 0 to 100, and I will re-modify the lights configuration.

    I will add a note so that it will be more clear.

  • Benefit everyone
    Thanks again

  • I use same Garmin Edge 130 Plus on both regular bike with Bontrager Ion 200 RT and Flare RT; and on stationary bike.

    How do I turn-off lights for indoor-cycling?

    Preferably without relying on GPS signal availability (sometimes I cross a tunnel on my commute); and on speed (prefer my blinker to work when I'm waiting for traffic lights.

  • How do I turn-off lights for indoor-cycling?

    Currently there is no such filter available, but I did some testing on my Edge 1000 and found out that this could be achieved by adding a filter that checks startLocation value. For indoor activities the "startLocation" should always be empty as the device normally cannot acquire the gps location when indoor.

    Preferably without relying on GPS signal availability (sometimes I cross a tunnel on my commute)

    With the "startLocation" filter you could be able to achieve both scenarios, for indoor using a filter group with "startLocation" = "Empty" and for tunnels you would need to add an additional condition "startLocation" != "Empty". Would this work for you or your device is able to acquire the gps location even when indoor?