Call Phone +8618073152920 Hotline: +8618073152920
Call Phone +8618073152920
English
CONTACT US/ CONTACT US
Consumer hotline +8618073152920
Changsha Zoko Link Technology Co., Ltd.

Email:Arvin@niubol.com

WhatsApp:+8615367865107

Address:Room 102, District D, Houhu Industrial Park, Yuelu District, Changsha City, Hunan Province, China

Position:Home >> Blogs >> Product knowledge

Product knowledge

Smart Irrigation System Using NodeMCU: Reject Old Commands After Reconnection

Time:2026-08-24 09:03:00 Popularity:253

A smart irrigation system using NodeMCU should not reopen a valve merely because an old remote instruction arrives after reconnection. Treat restored Wi-Fi as a communication event, not permission to water. Validate the command, current soil data and local operating state before accepting a new irrigation action.

NBL-S-TM soil moisture and temperature probe supplying observations rather than valve commands

Separate observations, settings and one-time commands

A soil moisture observation describes a measured condition. A schedule setting defines an ongoing rule. A command requests an action such as starting one irrigation event. Storing all three as undifferentiated latest values makes recovery ambiguous: an old Start message can appear just as current as a recently measured moisture value.

Give each remote command a target zone, unique identity, issue time, validity period and explicit action. The controller must determine whether the command is still applicable and whether it has already been handled. A received message is not a new instruction simply because the network connection is new.

The NBL-S-TM soil temperature and moisture probe supplies observations through RS485 Modbus RTU. Its output does not implement remote-command authorization or valve logic. Those functions belong in the controller and the selected communication application.

Why a retained message needs special treatment

If the project uses MQTT, a retained publication can be delivered to a matching subscriber later, subject to the protocol's subscription handling. The OASIS MQTT 5.0 specification defines retained-message behavior and message expiry. Do not assume that every NodeMCU firmware or broker configuration implements the same options.

A retained state such as the last measured moisture may be useful when its original time and validity are visible. A retained one-shot watering command is different: it can outlive the conditions that justified it. Design the command channel so replay, duplication and expiry are addressed explicitly. Transport delivery confirmation does not prove valve movement or actual water delivery.

Time validity requires a trustworthy time basis. If the controller has lost its clock after restart, it may be unable to establish the age of a remote instruction. Define a restricted recovery state until the required time and local conditions are known, rather than accepting an uncertain timestamp.

The NBL-S-THR TDR probe can provide a fresh soil observation after recovery. A fresh reading is necessary where the decision depends on current moisture, but it does not automatically reauthorize a command that has expired or already been completed.

NBL-S-THR TDR probe for a fresh soil observation after controller recovery

Define local authority before Wi-Fi is lost

Recovery conditionRequired decision
Network returns after a completed watering eventReport the completed state; do not repeat the event from a duplicate command.
An expired Start request arrivesReject it and record the reason rather than shifting its issue time to the reconnection time.
A remote request conflicts with a local inhibitPreserve the required inhibit and report that the action was not executed.
Soil reading is stale or unavailableApply the defined missing-data rule; do not substitute a dry value that initiates watering.
Power returns with an uncertain prior valve stateRe-establish the approved state using the actual valve/output arrangement before accepting another event.

Specify whether an already active irrigation event may finish during network loss, and what local limits remain enforceable. The answer depends on the irrigation arrangement and project operating rules. Network recovery must not restart an event timer or bypass a maximum duration simply because the same command was received again.

Separate command acceptance from physical confirmation. Use valve-position or flow feedback where the duty requires proof of execution. Without it, label the result as an output command, not verified water delivery. An electrical output can change while a valve remains blocked or disconnected.

Fixed three-electrode soil probe whose position and data identity must survive reconnection

Keep the soil interface independent of remote recovery

NodeMCU identifies a development platform, not a guaranteed field interface. Select an RS485 transceiver compatible with the exact board's logic level, a suitable sensor supply and protected field wiring. Do not connect an industrial probe's supply voltage or RS485 pair directly to a logic input.

ProbeRelevant specificationController responsibility
NBL-S-TMFDR moisture 0-100%, stated accuracy +/-5%; soil temperature -40 to 80 C; RS485 Modbus RTU; IP68; 5-24 V or configured 12-24 V supplyVerify the delivered supply, register scaling and quality checks. Its moisture percentage is not air RH.
NBL-S-THRTDR moisture 0-100%, stated accuracy +/-3%; temperature -50 to 100 C; 12-24 V; approximately 0.3 W; IP68Select the RS485 or actual analog version and keep its interpretation separate from the communication application.
NBL-S-TMSMSConfigured measurement depths; 12 V; RS485 Modbus RTU; IP67 above ground and IP68 below groundRetain each layer's depth, timestamp and validity rather than merging the last received layer into one unlabeled value.

Maintain the location and depth records through controller replacement or reconnection. If a probe moves, its trend context changes even though the device address remains the same. Keep soil observations, command decisions and service events on a timeline that allows the operator to understand why watering was permitted or refused.

A multi-depth probe helps distinguish vertical wetting responses. It does not decide which depth authorizes irrigation; assign that role in the local logic rather than letting message arrival order decide it.

Multi-depth soil probe with separately identified layer readings and validity

Project Decision FAQ

Q1. Can all watering stop whenever Wi-Fi fails?

That can be the chosen policy, but it is not a universal rule. Define behavior for a running event, future schedules and local protective conditions. Test it against the actual valve and pump arrangement before unattended operation.

Q2. Is a duplicate command always harmless?

No. Repeating a Start action may restart a timer or initiate another watering event. Use command identity and state checks so repeated delivery cannot unintentionally extend irrigation.

Q3. Can MQTT message expiry replace controller checks?

No. Where supported, expiry helps limit delayed delivery, but the application still needs zone, state, time and duplicate checks. Verify the actual protocol version and software behavior rather than assuming the option is available.

Q4. What should a reconnection test include?

Include an outage before a command, during an event and after completion. Deliver a duplicate and an expired command, restart the controller, and check recovery with unavailable soil data. Test outputs safely before supervised watering.

Q5. What information helps choose NiuBoL probes?

Send the measured quantity, depths, soil conditions, cable routes, sensor supply and exact receiving interface. State whether the project needs point or profile measurements; remote command policy remains a separate controller requirement.

Q6. Can water potential use the same percentage rule?

No. NBL-S-WPS reports soil water potential in kPa rather than volumetric moisture percentage. Its relationship to soil water content depends on the soil; preserve its unit and use a suitable decision rule.

NBL-S-WPS water potential sensor reporting kPa rather than moisture percentage

Summary

A smart irrigation system using NodeMCU needs controlled recovery, not automatic obedience to the next received message. Separate observations from commands, reject stale or repeated actions and retain local operating limits through outages. NiuBoL soil probes can provide the field measurements while command validity, output control and execution feedback are engineered and tested as separate functions.

Related recommendations

Sensors & Weather Stations Catalog

Agriculture Sensors and Weather Stations Catalog-NiuBoL.pdf

Weather Stations Catalog-NiuBoL.pdf

Agriculture Sensors Catalog-NiuBoL.pdf

Water Quality Sensor Catalog-NiuBoL.pdf

Related products

Tell us your requirements, Let's discuss more about your project.we can do more.

Name*

Tel*

Email*

Company*

Country*

Message


online
Contacts
Email
Top
XSmart Irrigation System Using NodeMCU: Reject Old Commands After Reconnection-Product knowledge-Automatic Weather Stations_Industrial, Agricultural, Water & Environmental IoT Monitoring Solutions—NiuBoL

Screenshot, WhatsApp to identify the QR code

WhatsApp number:+8615367865107

(Click on WhatsApp to copy and add friends)

Open WhatsApp

The WhatsApp ID has been copied, please open WhatsApp to add consultation details!
WhatsApp