Newbee needs help in esphome

Hello everybody,

I’m really new to ESPHOME and Home assistant, but I already have 3 ESPs running at home on fairly simple things.

To finish describing myself, I am not an English speaker but French, so please excuse my somewhat clumsy English.

I am continuing my oil boiler monitoring project and more specifically on measuring the level of fuel oil in the tank.

I abandoned the ultrasonic measurement which sends me back anything, probably because of the shape of the tank, for lack of a sensor with a very low reading angle.

So I tinkered with a system using the original gauge (by hydrostatic pressure) by including a pressure sensor.

It works pretty well, but there are leaks so you have to “inflate” the system before taking the measurement, so I installed an aquarium air pump to “inflate” the circuit before I could read the sensor. pressure.

On the other hand, there is no point in running this pump permanently, because there is no point in measuring the level all the time. Once a day will be enough.

Still the same, I struggle with the ESPHOME docs, and I tried a script.

I launch it with an “on_interval”, and I manage to start the pump for the time necessary to reinflate the system, but I do not see how to trigger and save the pressure measurement when stopping the pump. This measurement remains the only valid one before the next measurement.
So here is my script and the definition of the sensor that works, my question is how to put them end to end.

I also tried with a global variable but failed!..

# trigger for the script  (10 s it's for trials !, will be much more in future)  

- interval: 10s
      - script.execute: mesure_niveau_cuve

# the script 
  - id: mesure_niveau_cuve
      - switch.turn_on: pompe
      - delay: 5s
      - switch.turn_off: pompe
      - delay: 0.5s
# Now itis time to read the sensor and to freeze the value for the day  !

# The Pressure sensor  (here it take one mesure each 10 secondes but I struggle to integrate this mesure in the script up there.

  - platform: hx711
    name: "Pression"
    id: "pression_fioul"
    dout_pin: 26
    clk_pin: 27
    gain: 128
    update_interval: 10s
      - calibrate_linear:
          - 180000 -> 0
          - 8000000-> 100
    unit_of_measurement: "%"
    accuracy_decimals: 0    

Anyway I tried, variable globals, lambda etc , either I have compilation errors or the return value remains at zero.

If anyone has done or seen this before, I’m all ears.

Thanks in advance.



What you could do is have it in deep sleep and wake it once a day to do the actions/measurements.

You can have some on boot actions which call the sensor updates manually.

If you dig into my config here you will see the way to do it.

Thanks a lot Mahko_Mahko, I will have a look to your project.

The ESP do a lot of thing by side of this level measurement, like temperature and fault monitoring, So I wasn’t go with the idea of deep sleep.

May be to split to another ESP if I dont find the way to do.


1 Like

You could also turn off the auto updates and call the update manually as part of your script…

Clearly I was looking in your impresive job and I think the same.

I will work on it this week.



I find a solution going in your files Mahko_Mahko.

In fact, I take the solution with : " component.update:" for read the sensor when I need., and overall, the “update_interval: never” to block any update of the sensor at not need time.

Thanks a lot. I learn a lot this afternoon !

A+ Philippe