I'm using the Pi3 and the last jessie-lite OS, and  I want to manage the brightness of the screen like Kodi does with the dim screensaver. 
After some google searching I found some tips but nothing works.
I'll be using an external light sensor and I want to manage the brightness proportionally at the value sent by the light sensor.
For the moment, I develop in Python2.7 but the issue can use another language or by shell.
Thank you very much!
ideally what you want would have been for the Kodi json api to support setting the screensaver, from what I understand it doesn't.
that said if your familiar with Python, and I'm not, you can develop a plug in that opens a socket (or communicates otherwise) with your program running on your pi, because from what I understand plugins have the ability to set the screensaver.
in other words, make a plug in that sends and receives message to and from the pi. 
this is not really an answer because im not familiar with creating Kodi plugins, but I know it's possible because there are other plugins that do it...
Dim a display with a raspberry