The official SDK for building applications on the NatureOS platform.
The NatureOS Developer SDK provides a comprehensive toolkit for developers to build applications that interact with NatureOS, the cloud platform for environmental monitoring and IoT device management. The SDK offers type-safe clients, utilities, and abstractions for seamless integration with NatureOS services.
- Device Management: Register, configure, and monitor IoT devices
- Sensor Data Access: Real-time and historical sensor data retrieval
- Environmental Monitoring: Access to environmental data streams
- Command Execution: Send commands to devices remotely
- Analytics: Data analysis and visualization utilities
- Multi-tenant Support: Built-in support for tenant isolation
- Offline Mode: Local caching and offline operation
- Type Safety: Full TypeScript and Python type support
pip install natureos-sdkOr from source:
git clone https://github.com/MycosoftLabs/sdk.git
cd sdk
pip install -e .npm install @mycosoft/natureos-sdkOr with yarn:
yarn add @mycosoft/natureos-sdkfrom natureos_sdk import NatureOSClient
# Initialize client
client = NatureOSClient(
api_url="http://localhost:8002",
api_key="your_api_key"
)
# List devices
devices = await client.list_devices()
for device in devices:
print(f"{device.name} - {device.status}")
# Get sensor data
data = await client.get_sensor_data(
device_id="esp32-001",
sensor_type="temperature"
)
# Send command
result = await client.send_command(
device_id="esp32-001",
command_type="set_mosfet",
parameters={"channel": 1, "state": "on"}
)import { NatureOSClient } from '@mycosoft/natureos-sdk';
const client = new NatureOSClient({
apiUrl: 'http://localhost:8002',
apiKey: 'your_api_key'
});
// List devices
const devices = await client.listDevices();
devices.forEach(device => {
console.log(`${device.name} - ${device.status}`);
});
// Get sensor data
const data = await client.getSensorData({
deviceId: 'esp32-001',
sensorType: 'temperature'
});
// Send command
const result = await client.sendCommand({
deviceId: 'esp32-001',
commandType: 'set_mosfet',
parameters: { channel: 1, state: 'on' }
});- Full Documentation: Comprehensive guide
- Database Schema: Database structure
- Implementation Plan: Development roadmap
- API Reference: Complete API documentation (coming soon)
# List all devices
devices = await client.list_devices(device_type="esp32", status="online")
# Get device details
device = await client.get_device(device_id="esp32-001")
# Register new device
device = await client.register_device(
device_id="esp32-001",
name="My Device",
device_type="esp32"
)# Get historical data
data = await client.get_sensor_data(
device_id="esp32-001",
sensor_type="temperature",
start_time=datetime.now() - timedelta(hours=24)
)
# Stream real-time data
async for reading in client.stream_sensor_data(
device_id="esp32-001",
sensor_type="temperature"
):
print(f"Temperature: {reading.value}°C")Specialized methods for MycoBrain devices:
# Register MycoBrain device
device = await client.register_mycobrain_device(
device_id="mycobrain-001",
serial_number="MB-2024-001",
name="MycoBrain Lab Unit",
firmware_version="2.1.0"
)Use with NLM for intelligent data processing:
from natureos_sdk import NatureOSClient
from nlm import NLMClient
natureos = NatureOSClient(...)
nlm = NLMClient(...)
data = await natureos.get_sensor_data(device_id="esp32-001")
insights = await nlm.process_environmental_data(
temperature=data[0].value,
humidity=data[1].value
)NATUREOS_API_URL=http://localhost:8002
NATUREOS_API_KEY=your_api_key
NATUREOS_TENANT_ID=your_tenant_id # Optionalsdk/
├── natureos_sdk/ # Python package
├── @mycosoft/ # TypeScript package
├── examples/ # Code examples
├── tests/ # Test suite
└── docs/ # Documentation
# Python
pytest
# TypeScript
npm test- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file for details.
- Documentation: docs/
- Issues: GitHub Issues
- Email: support@mycosoft.com