How to pullup pin

I need to turn on led then co2 sensor is above 1000. How can I set some pin to HIGH or LOW state?

sensor:
  - platform: mhz19
    id: co2_living_room
    co2:
      name: "MH-Z19 CO2 Value"
    temperature:
      name: "MH-Z19 Temperature"
      on_value_range: 
        above: 1000
        then: 
            pinMode(10, OUTPUT);
            digitalWrite(10, HIGH);

Create a GPIO switch:

Then use this action:

    temperature:
      name: "MH-Z19 Temperature"
      on_value_range: 
        above: 1000
        then: 
          - switch.turn_on: your_switch_id_here

You will also have to define an action to turn off the switch.

1 Like

Thanks for your help! It works now.

sensor:
  - platform: mhz19
    id: co2_living_room
    co2:
      name: "MH-Z19 CO2 Value"
      on_value_range:
      - above: 1000
        then:
          - switch.turn_on: RED_LED
      - below: 1000
        then:
          - switch.turn_off: RED_LED