Weather stations are the silent sentinels of our environment. Whether it’s a $30 ESP32 rig with a DHT22 in a suburban garden or a $2,000 industrial Davis Vantage Pro2 on a solar farm, these devices generate a constant stream of data: temperature, humidity, barometric pressure, wind speed, rain rate. For years, the bottleneck has been what to do with that data. Most stations log to a local SD card or push to a generic cloud dashboard that nobody checks. The real value — automated decision-making, predictive maintenance, and cross-system orchestration — has remained out of reach for all but the most dedicated homebrew hackers.
Enter ASI Biont. This AI agent doesn’t just visualize data; it connects to your weather station, interprets the readings in real time, and triggers actions across your smart home, industrial PLCs, or notification systems. And it does this without you writing a single line of boilerplate integration code. You describe the setup in natural language, and ASI Biont writes the Python script, establishes the connection, and starts controlling your world.
This article is a technical walkthrough of how to integrate a weather station with ASI Biont. We’ll cover three real-world connection methods — MQTT for ESP32-based stations, Modbus TCP for industrial weather sensors, and COM port via the Hardware Bridge for older serial stations — with complete code examples and wiring diagrams. By the end, you’ll understand how to turn weather data into actions: closing smart windows when rain is detected, preheating a greenhouse floor before a cold snap, or alerting your phone when the barometer drops 3 hPa in an hour.
Why Connect a Weather Station to an AI Agent?
A standalone weather station is a data logger. An AI-connected weather station is a decision engine. Consider these scenarios:
| Scenario | Without AI | With ASI Biont |
|---|---|---|
| Sudden temperature drop | You check a phone app manually | AI detects trend, sends Telegram alert, commands thermostat to raise setpoint |
| High wind detected | You see a reading on a screen | AI triggers MQTT command to close awning and shutters, logs event to a database |
| Barometric pressure spiral | You make a mental note | AI correlates with rain sensor, activates irrigation shutoff, notifies you with forecast summary |
The key enabler is ASI Biont’s ability to connect to any device through its execute_python sandbox or the industrial_command tool. You don’t need to wait for a vendor plugin. You simply tell the AI: “Connect to my ESP32 weather station via MQTT at 192.168.1.100, topic weather/data, and alert me if humidity drops below 30%.” The AI writes the code, tests it, and runs it.
Connection Methods Supported by ASI Biont for Weather Stations
ASI Biont supports multiple industrial and IoT protocols. For weather stations, the three most relevant are:
- MQTT (via
paho-mqttinexecute_python) — Best for ESP32, Raspberry Pi, or any station that publishes to a broker (Mosquitto, HiveMQ). - Modbus TCP (via
pymodbusinindustrial_command) — Best for industrial weather sensors (e.g., Campbell Scientific, Vaisala) that expose data as holding registers. - COM port via Hardware Bridge (via
bridge.pyon a local PC) — Best for older serial stations (e.g., Oregon Scientific, La Crosse) that output NMEA or proprietary ASCII strings.
All three methods are orchestrated through the same chat interface. You never leave the conversation with the AI agent.
Real-World Use Case 1: ESP32 + DHT22 + MQTT → Telegram Alerts
This is the most accessible setup for makers. An ESP32 reads a DHT22 temperature/humidity sensor every 10 seconds and publishes the data to an MQTT broker. ASI Biont subscribes to that topic, analyzes the stream, and sends a Telegram alert when thresholds are exceeded.
Wiring Diagram
ESP32 Pinout:
- 3.3V → DHT22 VCC
- GND → DHT22 GND
- GPIO4 → DHT22 DATA
- A 10kΩ pull-up resistor between DATA and VCC (3.3V)
MicroPython Code for ESP32
Save this as main.py on the ESP32 using Thonny or ampy:
import network
import time
import dht
from machine import Pin
from umqtt.simple import MQTTClient
# Wi-Fi credentials
WIFI_SSID = "your_ssid"
WIFI_PASS = "your_password"
# MQTT broker settings
BROKER = "192.168.1.100" # Your Mosquitto broker IP
TOPIC = "weather/data"
CLIENT_ID = "esp32_weather"
# Sensor
dht_sensor = dht.DHT22(Pin(4))
def connect_wifi():
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(WIFI_SSID, WIFI_PASS)
while not wlan.isconnected():
time.sleep(0.5)
print("Wi-Fi connected")
def main():
connect_wifi()
client = MQTTClient(CLIENT_ID, BROKER)
client.connect()
print("Connected to MQTT broker")
while True:
try:
dht_sensor.measure()
temp = dht_sensor.temperature()
hum = dht_sensor.humidity()
payload = f'{{"temp": {temp}, "hum": {hum}}}'
client.publish(TOPIC, payload.encode())
print(f"Published: {payload}")
except Exception as e:
print(f"Sensor error: {e}")
time.sleep(10)
main()
Note: The infinite loop is fine here because it runs on the ESP32 firmware, not in the ASI Biont sandbox.
How ASI Biont Connects
- You tell the AI: “Connect to MQTT broker at 192.168.1.100, subscribe to
weather/data, parse JSON, and send a Telegram message if temp > 35°C or hum < 20%.” - The AI writes a Python script using
paho-mqttand runs it in theexecute_pythonsandbox. - The script runs continuously (within the 30-second sandbox limit, it polls once and sets up a long-lived callback).
Example AI-generated script (for illustration):
import paho.mqtt.client as mqtt
import json
import requests
TELEGRAM_BOT_TOKEN = "your_bot_token"
CHAT_ID = "your_chat_id"
def on_message(client, userdata, msg):
data = json.loads(msg.payload.decode())
temp = data.get("temp")
hum = data.get("hum")
alerts = []
if temp and temp > 35:
alerts.append(f"⚠️ Temperature high: {temp}°C")
if hum and hum < 20:
alerts.append(f"⚠️ Humidity low: {hum}%")
if alerts:
message = "\n".join(alerts)
requests.post(
f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage",
json={"chat_id": CHAT_ID, "text": message}
)
client = mqtt.Client()
client.on_message = on_message
client.connect("192.168.1.100", 1883, 60)
client.subscribe("weather/data")
client.loop_forever() # Runs until sandbox timeout (30s)
The AI runs this in the sandbox. For persistent monitoring, you can ask the AI to deploy it as a background task via SSH on a Raspberry Pi — the AI will generate a systemd service file and install it.
Real-World Use Case 2: Industrial Modbus Weather Sensor → PLC & Smart Home
Imagine a Vaisala PTU310 pressure/humidity/temperature transmitter connected to a Modbus TCP gateway. You want ASI Biont to read the registers every minute and, if the barometric pressure drops below 980 hPa, trigger a Modbus write to close a window actuator (via a relay).
Wiring / Network
- Vaisala PTU310 → RS-485 to Modbus TCP converter (e.g., USR-W610) → Ethernet switch → same LAN as ASI Biont.
- Modbus TCP port: 502.
- Device ID: 1.
- Registers: 30001 (temperature, °C), 30003 (pressure, hPa), 30005 (humidity, %).
How ASI Biont Connects
You tell the AI: “Read Modbus TCP from 192.168.1.50:502, device ID 1, registers 30001, 30003, 30005 every 60 seconds. If pressure < 980, write coil 0 to 1 on device ID 2 (window actuator).”
The AI uses the industrial_command tool with the Modbus protocol:
industrial_command(
protocol="modbus",
command="read_registers",
params={
"host": "192.168.1.50",
"port": 502,
"unit_id": 1,
"start_address": 30001,
"count": 3
}
)
This returns a list of register values. The AI then evaluates the pressure condition and, if needed, sends:
industrial_command(
protocol="modbus",
command="write_coil",
params={
"host": "192.168.1.51", # Window actuator Modbus device
"port": 502,
"unit_id": 2,
"address": 0,
"value": True
}
)
All of this happens automatically based on your description. The AI also logs every reading to a local CSV file via the sandbox’s file write capability.
Real-World Use Case 3: Old Serial Weather Station (Oregon Scientific) via COM Port + Hardware Bridge
Many hobbyists have older stations that output data over RS-232. For example, the Oregon Scientific WMR200 sends a proprietary ASCII string every 48 seconds at 9600 baud on COM3. ASI Biont can read this via the Hardware Bridge — a small Python application (bridge.py) that runs on your local PC and connects to the ASI Biont cloud via WebSocket.
Setup
- Download
bridge.pyfrom the ASI Biont dashboard (Devices → Create API Key). - Run on your PC:
pip install pyserial requests websockets
python bridge.py --token=YOUR_API_KEY --ports=COM3 --baud 9600
- The bridge connects to ASI Biont via WebSocket. Now the AI can send serial commands.
How ASI Biont Connects
You tell the AI: “Read the serial data from COM3 at 9600 baud. The station sends a string every 48 seconds like $WMR200,25.3,65.2,1013.2*. Parse it and extract temperature, humidity, pressure. If temperature drops below 5°C, send a command to turn on a greenhouse heater via a relay on COM4.”
The AI uses the industrial_command tool with the serial:// protocol:
industrial_command(
protocol="serial://COM3",
command="serial_write_and_read",
params={"data": ""} # Just read, no write needed
)
Because the station sends data periodically, the AI sets up a polling loop (within sandbox limits) or asks the bridge to continuously forward incoming data. The bridge can be configured with --rate=10 to limit polling frequency.
If the condition is met, the AI sends a command to COM4 (a relay board):
industrial_command(
protocol="serial://COM4",
command="serial_write_and_read",
params={"data": "RELAY_ON\n"}
)
No custom server, no HTTP API — just the bridge and the chat.
The Power of the AI Constructor: Zero-Code Integration
One of the most powerful features of ASI Biont is the AI constructor at asibiont.com. This graphical interface lets you build automation rules without writing a single line of Python. You define:
- Trigger: “When MQTT topic
weather/datareceives a new message” - Condition: “Temperature > 30°C AND humidity < 40%”
- Action: “Send Telegram message AND publish MQTT command
weather/actuators/shadewith payloadclose”
The AI constructor generates the underlying Python code and deploys it automatically. It’s perfect for users who want the power of AI integration without diving into code.
Comparison of Connection Methods
| Method | Best For | Latency | Complexity | AI Tool Used |
|---|---|---|---|---|
| MQTT | ESP32, Raspberry Pi, smart home | Low | Low | execute_python (paho-mqtt) |
| Modbus TCP | Industrial sensors, PLCs | Very low | Medium | industrial_command (Modbus) |
| COM Port + Bridge | Old serial stations, custom hardware | Medium | Medium | industrial_command (serial://) |
| SSH | Single-board computer with local scripts | Low | Medium | execute_python (paramiko) |
Real-World Scenario: Smart Greenhouse
Let’s tie it all together. A greenhouse has:
- An ESP32 with DHT22 (temperature, humidity) publishing to MQTT.
- A Vaisala barometric pressure sensor on Modbus TCP.
- A rain sensor on an Arduino connected via COM port.
- Smart windows with an MQTT-controlled actuator.
- A gas heater with a Modbus relay.
You tell ASI Biont:
“Monitor all weather data. If rain is detected or wind speed > 30 km/h, close windows. If temperature drops below 10°C, turn on heater. If all conditions are normal, open windows for ventilation. Also, email me a daily summary at 8 PM.”
The AI:
1. Connects to MQTT broker, subscribes to weather/temp, weather/hum, weather/wind.
2. Polls Modbus pressure sensor every 60 seconds.
3. Reads rain sensor from Arduino via COM bridge.
4. Evaluates rules every 30 seconds.
5. Publishes window/command (open/close) and heater/command (on/off) via MQTT.
6. Sends daily summary email using sendgrid library in sandbox.
All of this is orchestrated from a single chat conversation. The AI writes the code, sets up the loops, and handles error recovery (e.g., reconnecting to MQTT broker if connection drops).
Conclusion
Integrating a weather station with ASI Biont transforms a passive data logger into an active decision-maker. Whether you’re using a $5 ESP32, a $500 industrial sensor array, or a vintage serial station, the AI agent can connect, interpret, and act on the data in real time. The days of writing custom Node-RED flows or Python scripts from scratch are over. You simply describe what you want, and ASI Biont does the rest.
Ready to give your weather station a brain? Go to asibiont.com, start a chat with the AI, and tell it: “I want to connect my weather station and automate my home.” You’ll be amazed at how fast it works.
Comments