HASS, ESPEasy, DHT22, 4xRelays and Servo?

So I’m having some grand plans for my Greenhouse this summer :smiley:

So far I’m running ESP-Easy with a DHT22 sensor to monitor temp and humidity but once you get started with automotation it’s hard to stop… the plan so far is to connect
4x relays to control irrigation to the beds
1x servo to open and close a window based on temp.
automating it through HASS

So, seems simple (please say yes…)!?

Found a guide to connect the relays (https://goo.gl/AmH8fz) and it wants the commands to be like this to turn them on and off:
http:///control?cmd=GPIO,,0
http:///control?cmd=GPIO,,1

The relay uses this formatting:
http:///control?cmd=Servo,,,

Can I add functions in HASS to controll these? Is it enough if I add them as regular MQTT entities as I’ve done with the sensors? Guessing that could work with the relays that’s just simple on or off but how to controll the servo that I want different degrees of opened based on temperature?

So, throw in your thoughts, ideas and comments please!

1 Like

Hi Naesstrom

I have 4 relays and 2 DHT11 in my setup working with ESP-Easy and MQTT.
Hope my config can help you :slight_smile:.

You need to configure ESP-Easy MQTT connection to Home Assistant

Configure the relays and DHTs on you ESP

Then you have just to create 4 mqtt switches and sensors:

  • platform: mqtt
    name: “ESP Switch”
    state_topic: “/ESP02/Relay1/Switch”
    command_topic: “/ESP02/gpio/12”
    payload_on: “0”
    payload_off: “1”
    optimistic: true
    qos: 0

    retain: true

  • platform: mqtt
    state_topic: “/ESP02/DHT1/Temperature”
    name: “Temperatura Cameretta”
    qos: 0
    unit_of_measurement: “°C”
    value_template: ‘{{ value }}’

  • platform: mqtt
    state_topic: “/ESP02/DHT1/Humidity”
    name: “Umidità Cameretta”
    qos: 0
    unit_of_measurement: “%”
    value_template: ‘{{ value }}’

I never tried with a servo but reading in ESP forum I think the command could be something like /ESP02/PWM/xx sending the angle as payload.

Hope this help :slight_smile:

3 Likes

Thanks for the help @Ste, that looks really interesting! I’ve got it working with the http command now atleast but I’m unsure about the ESPEasy config you are showing. It looks like I have to add one switch for each gpio relay but I’ll try it and see how it works :smiley: