Action calibrate esphome

Hello,
I’m starting on esphome platform, and I just want to say : Wahoo ! In 2 minuts, you add a new sensor, in my case a Senseair (CO2 sensor).

But, I think (or I hope :wink: ) it isn’t calibrate, and I can see on the howto, I have to launch an action to start the calibrate. But my I just connect my senseair to an ESP8266, without button or other thing to launch an action.
Do you know if it’s possible to start a calibrate without create an automation in esphome to do that ? With Home assistant ? or with the web interface maybe ?

Thank you !

Add a template switch.

Then you can trigger the calibration on the turn on action.
Document action.

The switch will be availible in HA.
/Mattias

Hello, I don’t know if I did something wrong, but, my action seems work, but the calibration doesn’t work… Have I forgotten something ?

And how can I show the result with the “background_calibration_result” action ?

esphome:
  name: sensair-s8
  platform: ESP8266
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:

# Enable Web server
web_server:
  port: 80

ota:
  password: "xxxx"

wifi:
  ssid: "xxxx"
  password: "xxxxxxx"

uart:
  rx_pin: D5
  tx_pin: D6
  baud_rate: 9600

sensor:
  - platform: senseair
    co2:
      name: "sensair_s8"
    update_interval: 60s
    id: sensair_s8

switch:
  - platform: template
    name: "Calibrate Sensair S8"
    id : "calibrate_s8"
    turn_on_action:
        - senseair.background_calibration: sensair_s8
        - logger.log: "Switch Turned On!"
        
  - platform: template
    name: "Result Calibrate Sensair S8"
    id : "result_calibrate_s8"
    turn_on_action:
        - senseair.background_calibration_result: sensair_s8

Nobody can help me ? I don’t know what is wrong in my code … :neutral_face:

or you could set up a HA service:

api:
  services:
    - service: sensair_background_calibrate
      then:
        - senseair.background_calibration: sensair_s8
1 Like

I think it should be shown in the logs ? Make sure you leave some time between the calibration and requesting the result - see below

senseair.background_calibration_result Action

This action requests the result of the background calibration procedure from the sensor with the given ID. The value will be printed in ESPHome logs.

Wait at least one sensor lamp cycle after having triggered the background calibration before requesting its result.

Thanks, Sensair S8 was successfully calibrated after joining