Monitor environmental conditions in your greenhouse, grow room, or any space using a BME280 sensor connected to a Raspberry Pi. Get real-time readings via chat and set up automated alerts for out-of-range conditions.What it does:
Read temperature, humidity, and pressure
Get climate updates via chat
Automated alerts for threshold violations
Historical data tracking
Hardware: Raspberry Pi 4/5, BME280 sensor (I²C)APIs used: Custom Edge API + Lua Data API (for history)
import { LuaAgent, LuaSkill, LuaJob } from 'lua-cli';import ReadClimateTool from './tools/ReadClimateTool';// Climate monitoring skillconst climateSkill = new LuaSkill({ name: "greenhouse-climate", description: "Monitor greenhouse environmental conditions", context: ` This skill monitors temperature, humidity, and pressure via BME280 sensor. - read_climate: Get current environmental readings Use when user asks about temperature, humidity, pressure, or conditions Always mention if conditions are outside normal range. Suggest actions for out-of-range conditions. `, tools: [new ReadClimateTool()]});// Hourly climate check jobconst hourlyClimateCheckJob = new LuaJob({ name: 'hourly-climate-check', description: 'Check climate conditions every hour and alert if out of range', schedule: { type: 'interval', intervalSeconds: 3600 // Every hour }, execute: async (job) => { const tool = new ReadClimateTool(); const reading = await tool.execute({ storeHistory: true }); // Alert if conditions are abnormal if (reading.status !== '✅ All conditions normal') { const user = await job.user(); await user.send([{ type: 'text', text: `🌡️ Climate Alert:\n\n${reading.temperature}\n${reading.humidity}\n${reading.pressure}\n\n${reading.status}` }]); } }});// Configure agent (v3.0.0)export const agent = new LuaAgent({ name: "greenhouse-monitor", persona: `You are a greenhouse climate monitoring assistant.Your role:- Monitor temperature, humidity, and pressure- Alert when conditions are out of range- Provide climate recommendations- Track environmental historyCommunication style:- Clear and data-driven- Proactive with alerts- Helpful with recommendationsClimate knowledge:- Ideal temp: 18-28°C (64-82°F)- Ideal humidity: 50-70%- Normal pressure: 980-1020 hPaRecommendations:- High temp: Increase ventilation- Low temp: Close vents, add heat- High humidity: Increase air circulation- Low humidity: Add water trays or mistingWhen to alert:- Temperature outside 15-30°C- Humidity outside 30-80%- Rapid changes (>5°C/hour)`, skills: [climateSkill], jobs: [hourlyClimateCheckJob]});
v3.0.0 Features: Uses LuaAgent with scheduled jobs for hourly climate monitoring and automated alerts.
# Test tool directlylua test# Select: read_climate# Test conversationallylua chat# You: "What's the temperature and humidity?"# You: "Check the greenhouse conditions"# You: "Is it too hot in there?"