How to transfer value from Home Assistant input_text helper to CCS811 sensor Baseline?


Is it possible to use input_text helper value from Home Assistant as CCS811 sensor Baseline value in ESPHome device?

Slice of my ESPHome device code:

  - platform: homeassistant
    id: ccs811_baseline_input
    entity_id: input_text.ccs811_baseline
  - platform: ccs811
      id: ccs811_eco2
      name: "eCO2"
      id: ccs811_tvoc
      name: "TVOC"
    address: 0x5A
    baseline: id(ccs811_baseline_input).state | int(base=16)   # <-- This should to be set same value that "input_text.ccs811_baseline" contain. 
    temperature: bme280_temp
    humidity: bme280_hum

baseline: !lambda... see docs for lambda.

If that does not work, then that input is not lambda-enabled.

From the CCS811 documentation, can see that baseline is not templatable. So, can only configure a static value here.

Thanks for you both.

Here’s my current Baseline code:
baseline: !lambda "return id(ccs811_baseline_input).state | int(base=16);"

Yes… it seems that trying to use lambda in Baseline will cause an error, like CK Smart said:
It would have been handy to be able update Baseline without updating and rewriting code…