Need help with automation for dht22

hi! i have a dht22 sensor that read humidity and temp…

I want it so when the humidity dropps to under 30%, start an 230 humidifier i got .
How can i do this?
I found the sutomation for humidity lower or higher tab, but not how to start an other device…

It is not easy to help you as we do not know what your automation looks like.
Have you found a ready-made automation, or have you created your own?

Your humidifier must be connected to a switch in order to be regulated. It is this switch that you must specify in your automation (under THEN DO if you have created your own automation).
Your automation must also have a stop value that switches off the humidifier, for example. Start 30%, Stop 35%.

Under AND IF you can add conditions such as that your automation should only run between 07:00 and 22:00 Monday to Friday.

You can show us your automation by doing this…

Click on your automation to open it in the editor.
Click on the three dots at the top right of the editor.
Click on Edit as YAML.

Copy the code and paste it here (</> as code).

Assuming the humidifier is an entity named something like humidifier.230 and the sensor is something like sensor.humidity, the automation will use sensor going below 30 as a trigger, and the action as being a service call to humidifer.turn_on

Along these lines

alias: Humidifier On
description: Turn humidifier on when humidity below 30
  - platform: numeric_state
    entity_id: sensor.humidity
    below: 30
  - service: humidifier.turn_on
      entity_id: humidifier.230
    mode: single

I think it would be easier to run the automation that turns on the humidifier in home assistant than to have the esphome device make the call through home assistant.

Just put something like this in your esphome device (if you haven’t done so already):

  - platform: dht
    pin: The pin you connected the sensor data to eg. 'D2'
      name: "Outside Temperature"
      id: outside_temp
        - sliding_window_moving_average:
            window_size: 15
            send_every: 15 
      name: "Outside Humidity"
        - sliding_window_moving_average:
            window_size: 15
            send_every: 15
    update_interval: 1min

Then once home assistant has seen the ESPHome device in your network and connected to it, you can make an automation like the commenters above explain.

Alternatively (but this will be harder)
If you want the ESPHome device to turn on the humidifier without home assistant inbetween you have a few options:

  • If you can identify a low voltage switch that turns the humidifier on and off, you could connect a relay to your esp board to turn on the humidifier directly by bipassig said switch with the relay. (I would very strongly recommend against switching mains powered with a DIY device! Only use the relay to control the humidifier if you can somehow connect to a low voltage switch).
  • If your humidifier has some external control mechanism like an IR or RF remote you could connect an RF radio or IR blaster to your esp and turn on (and off) the humidifier that way.

Anyways, as mentioned above, you’ll have to provide more info for us to be able to better help you.