Tileboard functions

Hi

I am trying to create a function for my light switches. For example, I want to turn light 2 off when light 1 is off (a simple example). I don’t know where to put this function and how is its syntax. I tried the following in my light switch 1 tile but does not work:

              customStyles:function(){
                          if (this.states['switch.led16'].state=='on'){
                              this.state['switch.led21'].state='on';
                          } 
                          if (this.states['switch.led16'].state=='off'){   
                              this.states['switch.led20'].state='on';
                          }    
              },     

What would be the right way?
Thanks