Controlling the Varia UT-800

Hi,

  I'm contemplating light control of the Varia UT-800 headlight connected to a Edge 530 device. Factors I'm trying thinking of using for the automatic light level is

  • Ambient light (apparently the Edge 530 has some sort of meter since it can adjust the brightness automatically but can this be read programmatically?)
  • If Ambient light can't be read, try to determine darkness based on sunset calculation through a web API with GPS coordinates and cloudiness factor from a weather service
  • Available battery level and route length
  • Speed (more light for higher speeds, or just when going downhill(?))
  • Perhaps one could add "light factors" to specific route segments if you know that there are no streetlight etc?

Has anyone else done anything like this for a standalone app?