@dubya You do not need to disable the logger to use UART. ESP-01 has 1 UART modes, read the docs. You could set the Logger on UART 1 if you think you are using the Tx & RX pins for UART 0
First of all I would like to say thank you to everyone who worked on this. Great work by all!!!
I purchased the 12v unit from Banggood and the other hardware mentioned by @via2326 . I followed the instructions and flashed the board which worked like a charm. However I was unable to trigger the relays using Home Assistant. Every time I tried the replay wouldn’t switch. However I got it working in the end, using the configuration supplied by @TheDoC . However I should mention that it was only on my second attempt of using the configuration from @TheDoC did everything start working. The only thing I did differently the second time around was after I uploaded the configuration, I powered down the unit, waited about 10 seconds, held down the S2 button and powered on. I continued to hold down the S2 button for about 10 seconds after I powered on the device and now I can hear the relay click when I click the entry in home assistant. Fantastic!
Now i can interface this with the already existing in ground watering system for the grass, which will compliment (or maybe replace) the vegetable garden watering setup that I have working with a 2 x esp32 and the Orbit B-Hyve system.
I should do a post about how I have it all configured, however in a nutshell I have several Xiaomi Mija Flowers And Plants Grass Detectors that are reporting back to Home Assistant with the nutrient, moisture, temperature and light details of the soil. If the soil moisture drops below 25% (why 25%…dunno, everything seems to be growing sweet) then it will turn on the Orbit B-Hyve for 10 mins in the morning.
Now I’ll be able to use the same trick but turn on the in ground watering system for the lawn. Awesome!
Ok, finally got it working… Should have read comments more carefully and use @TheDoC settings right away. For flashing I used instructions on this link: Flashing_instructions Flashing sw I used, ESPHome-Flasher.
Difference to instructions was that on my case, GPIO0 has to be “low” all time during flashing.
Below the code I used:
Its a long time ago, but could you share your final code, that worked for you? I have the exactly same product, but can’t get it to work…
How did you wire your relay? Is this right?
@vaughancoke & @TheDoC thanks for the code, suggestions and tips. I believe I can add some small tips for using the 2 Relay version.
First, I recommend using Open-Smart ESP01 for flashing solves lots of headaches.
Secondly, pressing the S2 button is crucial, at least it was for me. I would suggest removing the
ESP from the board, power the board, press the S2 button till the blue light turns red. Then power off and put the ESP with the updated firmware and power on again. You should be able to connect and toggle. Below is the version I used, it is not much different from the original post.
esphome:
name: dual_relay
platform: ESP8266
board: esp01_1m
wifi:
ssid: "MY-WIFI"
password: "password"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Dual Relay 5V Fallback Hotspot"
password: "8899667711"
captive_portal:
# Enable logging
logger:
baud_rate: 0 #need this to free up UART pins
# Enable Home Assistant API
api:
password: "anotherpass"
ota:
password: "anotherpass"
# Enable Web server.
web_server:
port: 80
time:
- platform: homeassistant
id: homeassistant_time
# Text sensors with general information.
text_sensor:
# Expose ESPHome version as sensor.
- platform: version
name: Relay ESPHome Version
# Expose WiFi information as sensors.
- platform: wifi_info
ip_address:
name: Relay IP
bssid:
name: Relay BSSID
# Sensors with general information.
sensor:
# Uptime sensor.
- platform: uptime
name: Relay Uptime
# WiFi Signal sensor.
- platform: wifi_signal
name: Relay WiFi Signal
update_interval: 60s
uart:
baud_rate: 115200 # speed to STC15L101EW
tx_pin: GPIO1
rx_pin: GPIO3
switch:
- platform: template
name: 'Relay 1'
id: relay1
turn_on_action:
- uart.write: [0xA0, 0x01, 0x01, 0xA2]
turn_off_action:
- uart.write: [0xA0, 0x01, 0x00, 0xA1]
optimistic: true
- platform: template
name: 'Relay 2'
id: relay2
turn_on_action:
- uart.write: [0xA0, 0x02, 0x01, 0xA3]
turn_off_action:
- uart.write: [0xA0, 0x02, 0x00, 0xA2]
optimistic: true
I had a spare ESP so I updated the firmware on the new one, this was also to be able to revert to the original firmware if I ever need to. After some playing around I can switch between the original firmware and ESPhome firmware
You can press the S1 button, see that the blue led is on and use the stock version, and press the b S2 button see that the red led is on and use the Esp with ESPHome firmware version.
I am totally new at this, so sorry for the “stupid” questions I am about to ask.
How do you create a new device using the esp01_1m profile?
What development software are you using to create these configuration files?
Hi All,
I’ve noticed that the GPIO0 pin is not used, so this gives the opportunity to add for example an extra sensor.
There is no spare connector for it, so you need to solder it on the bottom-side of the module, below the ESP01 connector:
Warning: This GPIO0 pin is directly connected to the ESP01 and therefore the voltage must not exceed 3.3 Volt! (Use a logic level shifter inbetween, for example the “SparkFun Logic Level Converter - Bi-Directional”) Also this pin must be ‘high’ during boottime, otherwise the ESP will start in ‘Program Mode’ instead of ‘Normal mode’!
I added for example this extra water flow sensor: YF-S201
According to this flow sensor specs:
Pulses per Liter: 450
Add this config to report the (converted in Liters/Hour) pulses back to Home Assistant every 5 seconds:
With this extra water flow meter I thought I can now (with a single ESP01 4-channel relay-module) toggle my 4 solenoid valves to give water to my garden, and also report the flow back to HA. Sadly the datapin of this flow meter is active low, and thus also the GPIO0, resulting in an ESP stuck in ‘Program Mode’, so I removed the sensor for now.
Sorry for the late reply, I finally understand how ESP home works. It really is simple! Anyone know if there is a decent 8 relay ESP8266 board which you can buy?
Hello, first of all excuse me for my English. I followed your instructions, hassio recognizes my esp, I see my relays but I don’t know how to activate them! However, the restart function works! An idea ??
Thank you