Estimated reading time: 9 minutes
Want to know if it's raining before you leave the house with the window open or start the garden watering? Then the Tuya RB-SRAIN01 Zigbee rain sensor is just the right gadget for your smart home! The sensor is completely battery-free and is operated exclusively via an integrated Solar module operated - This makes it particularly low-maintenance and sustainable.
For detailed instructions and an explanation of all configuration options, I recommend the YouTube video linked below. In this video, every single setting is explained in detail so that you receive comprehensive instructions for the exact setup. You can find any code from the video in this article so that you can use it directly without having to type it in.
Technical highlights of the Tuya RB-SRAIN01
- Communication: Zigbee 3.0 (compatible with Zigbee2MQTT)
- Supply: Solar (you don't need any batteries!)
- Housing: IPX3 - i.e. splash-proof
- Measuring principle: Rain is detected via a conductor track field
- Response time: Fast - within a few seconds of the rain starting
- Entry status:
water: true/false
(via MQTT)
It is available from AliExpress for around €10-15 and can be easily integrated into existing Zigbee setups.
👉 Technical documentation on Zigbee2MQTT.io

What is the sensor useful for?
A rain sensor makes your smart home even smarter. You can:
- Add real precipitation data to your weather station
- be warned in good time when it starts to rain
- Automatically close windows
- Retract awnings
- interrupt the watering of the garden
☀️ Advantages at a glance
- ✅ No battery change necessary
- Weatherproof and reliable
- ✅ Simple integration via Zigbee2MQTT
- ✅ Ideal for window, awning and irrigation automation systems
- ✅ Available at low cost from AliExpress



What is Home Assistant?
Home Assistant is an open source platform for home automation that aims to connect and centrally control all devices in the home. It is designed to provide a unified user interface and simple, flexible control for a variety of smart home devices from different ecosystems. Here are some points in favor of Home Assistant:
- CompatibilityHome Assistant supports thousands of devices and services from various manufacturers, including lighting, air conditioning, heating, cameras, weather sensors, voice assistants and more.
- Local controlUnlike many commercial smart home platforms that rely on cloud services, Home Assistant runs locally on your network. This means increased privacy and reliability, as your smart home devices work even without an active internet connection.
- Automation and scenesOne of the main features of Home Assistant is the ability to create complex automations and scenarios. For example, you can have lights switch on automatically when it gets dark or turn on the heating when the temperature falls below a certain level.
- Simple user interfaceHome Assistant offers a user-friendly interface that makes it easy to monitor and control devices. This interface is fully customizable.
- Integration with voice assistantsHome Assistant can be integrated with voice assistants such as Amazon Alexa or Google Assistant to enable voice-controlled control of your smart home devices.
- Open source and community-drivenSince Home Assistant is open source, it is supported by an active community that is constantly developing new integrations and improving existing ones.
- Data protection and securityAs a locally running platform, Home Assistant has the advantage that the data remains within its own network. This protects privacy and increases security compared to cloud-based solutions.
In summary, Home Assistant is a powerful and flexible solution for those who want to design their own smart home and control their devices centrally, regardless of the manufacturer or ecosystem.
How to integrate the rain sensor into Zigbee2MQTT and Home Assistant 🔌📡
I recommend the integration via Zigbee2MQTTas the sensor is directly supported there. Of course you can also use it with ZHA but sometimes less information is visible here.
✅ Requirements
Before you get started, make sure that you have already set up the following:
- A running Home Assistant (e.g. on a Raspberry Pi, Home Assistant OS, Docker or similar)
- Zigbee2MQTT is installed and running (e.g. as an add-on or container)
- You have a Zigbee sticke.g. the Sonoff Zigbee 3.0 USB Dongle Plus
- The MQTT broker (e.g. Mosquitto) is set up and connected to Zigbee2MQTT and Home Assistant
🔧 Step 1: Set the sensor to pairing mode
- Press the small Button on the back for 5 secondsuntil the LED flashes.
→ The sensor is now in the Pairing mode.
📌 Tip: Make sure that the sensor is close to your Zigbee stick during pairing (max. 3-4 m).
🧩 Step 2: Add device in Zigbee2MQTT
- Open the web interface of Zigbee2MQTT (e.g. via
http://deine-ip:8080
). - Click on the button at the top right "Permit join (All)" resp. "Activate teach-in (all)"to allow new devices to connect.
- The sensor should appear within a few seconds - usually with the name
TS0207
or a device identifier such as0x123456789abcdef
. - Click on the new device, optionally assign your own name (e.g.
Re
gas sensor
) and save. You can also update the name in Home Assistant directly. The device will be added to Home Assistant immediately if you have already integrated Zigbee2MQTT.
Step 3: Integration in Home Assistant
As soon as Zigbee2MQTT recognizes the device and your MQTT broker is correctly connected, Home Assistant recognizes automatically all available sensor values as entities.
How to find them:
- In Home Assistant, go to "Settings → Devices & services → MQTT → Devices".
- You will now see your new device there, e.g. "
" with all entities.Rain sensor
With these steps, the sensor is fully integrated and provides permanent measurement data that you can use for visualizations, notifications or automation - all locally, without the cloud, and reliably via Zigbee.
Automation ideas with Home Assistant
Window warning:
If the sensor reports "Rain detected" → send a notification to your smartphone: "Watch out, it's raining - close the windows!"
Automatically retract awning:
Couple the sensor with your electric awning. As soon as rain is detected → retract automatically to prevent damage.
Stop watering the garden:
When it starts to rain → deactivate your automatic watering for the next 3 hours.
Rain logging:
Log rain events in an InfluxDB or Grafana - perfect for analyzing weather data over time.
Specific example of a rain warning when leaving the house
alias: Rain sensor
description: ""
triggers:
- trigger: state
entity_id:
- binary_sensor.turkontakt_wohnungstur_contact
to: "on"
conditions:
- condition: state
entity_id: binary_sensor.window_contact_bedroom_contact
state: "on"
- condition: state
entity_id:
- binary_sensor.rain_sensor_rain
state: "on"
- condition: state
entity_id: alarm_control_panel.apartment
state:
- armed_vacation
- armed_night
- armed_home
- armed_away
- armed
- arming
actions:
- action: notify.smartphones
metadata: {}
data:
message: Close the windows before you leave.
title: Rain warning
data:
notification_icon: mdi:weather-rainy
color: red
icon_url: /local/icons/weather_icons.rainy-5.svg
mode: single
This home assistant automation warns you when leaving the apartmentif it rains and one window open is. It helps you to avoid water damage and only works if your Alarm system active or is currently being armed.
Automation is started as soon as the Apartment door opens - so typically on the way out.
In order for the notification to be sent all of the following conditions must be met:
- The Bedroom window is open
- It rains according to the rain sensor
- The Alarm system is active or is currently being activated
If all conditions are met, you will receive a Warning on your smartphone with the reference:
"Close the windows before you leave."
Plus a rain symbol in red - ideal for reminding you in good time. Of course, it makes even more sense to have an Alexa or Google Home speak out loud.
Further automation ideas
🌤 Weather & sun automations
- Sunscreen reminder for high UV/brightness
- If, in the last 20 minutes, the brightness sensor data > 5700 lux lie and it hasn't rained → notification on your cell phone or Alexa announcement: "Don't forget to apply cream!".
- Optional: Reminder only between 10 a.m. and 5 p.m. to avoid unnecessary notices.
- Heat & sun protection for plants
- If brightness > 6000 lux and Temperature > 28 °C and Rain = false → Extend awning or sunblind.
- Saves water and protects sensitive plants.
- Pre-rain advice for laundry
- If rain is detected and the motion detector in the garden has had activity in the last 2 hours (e.g. laundry hung up) → push message: "It's raining - bring in the laundry!"
💡 Light & comfort automations
4. Light control according to outside darkness
- If brightness < 200 lux outside and someone at home → switch on the living room light automatically.
- Even smarter: only switch on if there has been movement in the last 5 minutes (presence sensor).
- Automatic night light in case of rain
- If rain = true and Brightness < 150 lux and Motion detector triggered in the hallway → switch on warm LED night light so that nobody slips on wet tiles in the dark.
- Twilight-dependent front door lighting
- If brightness < 300 lux or rain = true and Doorbell activated → Switch on outside light for 5 minutes.
🏡 Safety & security automations
7. Automatic window closing (if window drives are available)
- If rain is detected → close all open motorized windows.
- Extra condition: Temperature < 30 °C to avoid unnecessary ventilation in midsummer.
- Garage door warning in case of rain
- If rain = true and Garage door open for longer than 2 minutes → Notification + light signal in the garage.
- Canopy lighting only when required
- If rain = true and Motion detector active at the entrance → Switch on LED strips under the canopy so that visitors can enter dry.
YouTube video implementation
Conclusion
The Tuya RB-SRAIN01 is a real insider tip for your smart home. Thanks to the Completely self-sufficient solar operation you save on battery changes and still have a reliable rain detector.
In combination with Home Assistant, you have countless automation options - from alerts to irrigation control.
Make your smart home weatherproof - without batteries!
0 Comments