npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-soil-device-sdk

v1.0.2

Published

React Native SDK for USB Type-C soil sensor cable (CH34x/CH340) speaking Modbus-RTU over USB serial, with optional server reporting + offline queue.

Readme

react-native-soil-device-sdk

React Native SDK for a USB Type‑C soil sensor cable (CH34x/CH340) that talks Modbus‑RTU over USB Serial and (optionally) reports readings to your server with an offline queue.

Android only. USB Host / OTG is required. iOS does not allow generic USB-serial access in normal apps.

What you get

  • List USB serial devices (CH34x/CH340 preferred)
  • Connect / disconnect
  • Read 8 soil parameters from Modbus holding registers 0x0000–0x0007:
    • temp (°C), hum (%), EC (µS/cm), salinity (mg/L), N/P/K (mg/kg), pH
  • Optional: API-key verification (/api/verify) and reporting (/api/data) with offline FIFO queue

Install

npm i react-native-soil-device-sdk
# or
yarn add react-native-soil-device-sdk

Peer deps you must install (for offline queue + online detection):

yarn add @react-native-async-storage/async-storage @react-native-community/netinfo

Android setup

1) Enable USB host

android/app/src/main/AndroidManifest.xml

<uses-feature android:name="android.hardware.usb.host" />

<application
  android:usesCleartextTraffic="true"
  ... />

2) (Recommended) Add USB intent filter (auto-open your app when the cable plugs in)
Create android/app/src/main/res/xml/soil_device_filter.xml in your app:

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <!-- WCH CH340/CH341 -->
  <usb-device vendor-id="6790" />
</resources>

Then add this inside your MainActivity in the app manifest:

<intent-filter>
  <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>

<meta-data
  android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
  android:resource="@xml/soil_device_filter" />

Quick start

import { SoilDeviceSdk, SoilDeviceClient } from "react-native-soil-device-sdk";

// 1) Configure once at app startup
SoilDeviceSdk.configure({ apiKey: "YOUR_API_KEY" });

// 2) Create a client
const client = new SoilDeviceClient({
  mode: "once",
  proactiveReportingSeconds: 2,
  slaveId: 1
});

// 3) List, connect, read
const devices = await client.getDeviceList();
await client.makeConnection(devices[0]);

const data = await client.getPrintingValue();
console.log(data);

State management examples

See: example/src/state/*

  • useState / hooks: example/src/App.useState.tsx
  • Context + useReducer: example/src/state/context/*
  • Redux Toolkit: example/src/state/redux/*
  • Zustand: example/src/state/zustand/*
  • MobX: example/src/state/mobx/*
  • Recoil: example/src/state/recoil/*

Notes / limitations

  • You must physically plug the USB sensor in and accept the Android permission prompt.
  • On some devices, manufacturer/product names are only available after permission is granted.