Nextion, change color button

Hello everyone! For a while I have been looking to migrate my nextion jeedom to HA! Uploading data from HA to NEXTION is ok Create 2 buttons under NEXTION to activate a relay under HA, it’s ok There I’m stuck, I’ve done lots of tests but with no results… I have a b0 button on NEXTION, and I would like the color of the button to change depending on the state of the button. I can’t even make a color change without depending on a state using directly: it.set_component_background_color(“b0”,“63488”); without condition… ditto for this line which should change the gauge value (unconditionally) it.set_component_value(“z0”, 100);


display:
  - platform: nextion
    id: nextion3
    uart_id: uart_0
    update_interval: 6s   # Pas de réel besoin de rafraichissement
    #touch_sleep_timeout: 15
    wake_up_page: 0
    brightness: 95%
    lambda: |-
      it.set_component_background_color("b0","63488");
      it.set_component_value("z0", 100);
      if(id(bilot).state){
        it.set_component_background_color("b1","1024");
      } else{
          it.set_component_background_color("b1","63488");
      }
    

Thanks you !

Please please format your code properly.

hello, excuse me, but yesterday I only had access to my tablet and I could not format my code :wink:

Cheers. I think it might be because you are sending text ( “1024” ) instead of a number ( 1024 )