KRL rulesets for a LoRaWAN sensor network on Manifold and the Pico Engine. Sensor communities and devices are Manifold picos — this repo adds sensor-specific behavior on top of Manifold's thing/community platform rather than managing its own pico hierarchy.
Supported hardware today is Dragino LoRaWAN sensors (LHT65, LSE01, LSN50, WL03A-LB, and related types). Each sensor type has a router ruleset in this repo that decodes payloads and raises sensor domain events.
Prerequisite: a bootstrapped Manifold installation (manifold-api — tag registry, owner pico, Manifold pico with io.picolabs.manifold_pico, notifications, and base io.picolabs.thing / io.picolabs.community rulesets).
Integration tests: t/README.md. Discovery annotations: docs/DISCOVERY.md.
Sensor-network rulesets delegate most pico lifecycle work to Manifold and focus on sensor-specific setup and event handling.
| Manifold service | Used for |
|---|---|
Community creation (manifold new_community) |
Creates the community child pico, installs io.picolabs.community, and establishes the Manifold↔community subscription |
Thing creation (manifold create_thing) |
Creates bare sensor thing picos with io.picolabs.thing; community receives a community thing_created callback to finish setup |
| Subscriptions | Community↔thing membership; thing events forwarded via community thing_event_occurred |
Notifications (manifold add_notification, change_notification_setting) |
Threshold alerts from a community are routed to Manifold's notification platform (inbox, SMS, Prowl, etc.) instead of calling external services directly |
| Wrangler | Child picos, channels, ruleset install requests |
Events and queries for sensor bootstrap and community management go through the Manifold app channel (not the UI channel — the UI channel's event policy blocks the sensor domain).
Solid lines are parent/child relationships; dashed lines are subscriptions. Sensor communities and things are Manifold picos — this repo adds sensor-specific rulesets on top.
After Manifold itself is bootstrapped, install io.picolabs.sensor.network_bootstrap on the Manifold pico. This ruleset:
- Handles
sensor create_communityand delegates to Manifold's generic community machinery - Installs
io.picolabs.sensor.communityon each new community child - Records communities in
ent:sensor_communities(query viagetSensorCommunities()) - Enables notification channels for each community (default: Manifold inbox only)
- Extends the Manifold app channel policy so
sensorevents andgetSensorCommunitiesqueries work on the same ECI asgetThings/getCommunities(required after Manifold 1.8 app-channel narrowing)
Raise sensor create_community on the Manifold pico's app channel:
POST /sky/event/{manifold_app_eci}/eid/sensor/create_community
attrs: { "name": "My Sensors", "description": "..." }
Optional: "notify_channels": "Manifold,SMS,Prowl" to opt the community into additional notification channels.
What happens (three steps inside network_bootstrap):
-
Delegate to Manifold —
network_bootstrapraisesmanifold new_communitywith a correlation id (rcn) andsensor_bootstrap: true. Manifold creates the child pico, installsio.picolabs.community, and subscribes it as a Manifold community. -
Install sensor.community — On
wrangler child_initializedfor that community,network_bootstrapinstallsio.picolabs.sensor.communityon the child and records it inent:sensor_communities. -
Provision notifications — Raises
manifold change_notification_settingfor each requested channel so threshold alerts from this community can reach the owner.
The community pico exposes a sensor channel (for sensor initiation and related events) and a manifold_callback channel (for Manifold's thing-creation callback).
Raise sensor initiation on the community's sensor channel:
POST /sky/event/{community_sensor_eci}/eid/sensor/initiation
attrs: { "name": "Garden LHT65", "type": "lht65" }
What happens (delegation pattern in sensor.community):
-
Delegate to Manifold — The community sends
manifold create_thingto its parent (Manifold pico) with{ name, callback_eci, rcn }and stashes sensor type / ruleset list underrcn. -
Manifold creates the thing — Manifold creates a child pico, installs
io.picolabs.thing, subscribes it, and calls back on the community'smanifold_callbackchannel withcommunity thing_created. -
Finish sensor setup — The community raises
community add_thing(joins the thing to the community) and installs sensor rulesets on the thing:- Always:
io.picolabs.sensor.thresholds,io.picolabs.iotplotter,io.picolabs.dragino - Per type: e.g.
io.picolabs.lht65.routerfortype: "lht65"
- Always:
Sensor readings and threshold violations flow back through the community subscription as community thing_event_occurred events, are re-raised into the sensor domain, and can trigger manifold add_notification on the Manifold pico.
| Ruleset | Installed on | Purpose |
|---|---|---|
io.picolabs.sensor.network_bootstrap |
Manifold pico | Community creation orchestration, getSensorCommunities() |
io.picolabs.sensor.community |
Community picos | Sensor channel, thing delegation, readings, threshold → notifications |
io.picolabs.sensor.thresholds |
Thing picos | Threshold monitoring |
io.picolabs.dragino |
Thing picos | Shared Dragino helpers |
io.picolabs.iotplotter |
Thing picos | Plotting / visualization hooks |
io.picolabs.lht65.router |
LHT65 things | Decode LHT65 payloads |
io.picolabs.lse01.router |
LSE01 things | Decode LSE01 payloads |
io.picolabs.lsn50.router |
LSN50 things | Decode LSN50 payloads |
io.picolabs.wl03a_lb.router |
WL03A-LB things | Decode WL03A-LB payloads |
io.picolabs.sensor.temperatures_view |
A pico created for the display | XMLUI page of one community's lastTemperatures |
To add a sensor type, register it in rids_to_install inside io.picolabs.sensor.community.krl and add a router ruleset to this repo.
Install io.picolabs.xmlui and io.picolabs.sensor.temperatures_view on a pico you create for the page. On that pico raise config new_relationship with webvh set to the community's did:webvh, then approve the invite on the community. The install creates an app channel that allows that event. Query viewUrl on that pico for the page URL. The page queries this pico; this pico calls the community's lastTemperatures.
On a mesh that requires a bearer, tag that app channel oauth-webhook, mint an access token, and paste it under Settings on the page. Settings also chooses PST, MST, CST, or EST, and a theme (Default, Dark, Green, or Gray, each in light or dark). The page keeps these in the browser tab, sends the token on the temperature query, and shows each reading time in the chosen standard-time zone. Refresh loads the latest readings without reloading the page. The page also polls every five minutes (poll_seconds). The defaults are MST and the Default theme.
The view is built from components: TemperatureSettings and TemperatureTable in this ruleset, and PicoTheme, PicoSettings, PicoThemeField, and PicoAccessTokenField from io.picolabs.xmlui. It needs pico-engine 1.9.4 or later (@component support); flush io.picolabs.xmlui on the view pico after upgrading the engine.
- manifold-api — Manifold platform rulesets (
manifold_pico,thing,community, notifications, bootstrap). Required at runtime; the integration test harness mounts both repos into one pico-engine container. - Pico Engine modules —
io.picolabs.wrangler,io.picolabs.subscription(provided by the engine).
From the repo root:
npm install
npm testSee t/README.md for the full harness (parse gate, Docker, Manifold bootstrap, sensor scenarios, cleanup).
This repo includes an optional Home Assistant companion integration under custom_components/pico_mesh_sensor_network/. It extends the Manifold hub integration (pico_mesh) with sensor entities for router rulesets in this repo (LHT65 today; LSE01, LSN50, etc. later).
- Install and configure Manifold (
pico_mesh) from manifold-home-assistant — OAuth, mesh connection, thing/community devices. - Add Manifold Sensor Network from this repo (HACS custom repository or copy
custom_components/pico_mesh_sensor_network/into your HAconfig/custom_components/directory). - In HA: Settings → Devices & services → Add integration → Manifold Sensor Network — link it to your Manifold hub entry.
Sensor entities attach to existing Manifold thing devices (same device cards as SafeAndMine). Readings are polled from each thing's router ruleset (e.g. io.picolabs.lht65.router → temperature, humidity, last reading).
sensor-network/
io.picolabs.*.krl ← engine rulesets
custom_components/
pico_mesh_sensor_network/ ← HA companion (depends on pico_mesh)
hacs.json
Third-party Manifold communities can follow the same pattern: KRL in the repo root, custom_components/pico_mesh_<name>/ beside it, "dependencies": ["pico_mesh"] in manifest.json, and a stable import surface from custom_components.pico_mesh.hub.
If you use the manifold-home-assistant Docker stack, mount this companion alongside the hub:
volumes:
- ../manifold-home-assistant/custom_components/pico_mesh:/config/custom_components/pico_mesh:ro
- ../sensor-network/custom_components/pico_mesh_sensor_network:/config/custom_components/pico_mesh_sensor_network:roRestart Home Assistant after adding the mount, then add both integrations in HA.
