Skip to content

About

AI skill and standalone Go templates for building ThingsPanel device connectors

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

ThingsPanel Connector Kit

简体中文

Build ThingsPanel device connectors from a vendor protocol or a third-party API. The kit combines an AI development skill with two standalone Go projects, each with its own simulator, Dockerfile, connector manifest, and installer catalog example.

What you get

Component Use it to Included
TCP protocol template Connect a device that sends frames directly to the connector JSON line decoder, synthetic temperature/humidity data, configuration form, and a device simulator
Third-party service template Connect a tenant account or an API that provides remote devices Access-point form, paginated discovery, binding reconciliation, telemetry, and a mock HTTP service
AI development skill Adapt either template from vendor documentation and sample traffic A workflow for field mapping, simulation, and release preparation
Installation and publishing guide Make a connector installable through ThingsPanel Image, signed catalog, installation, Resource Center, and verification steps

Each template has its own Go module. The example connectors publish telemetry and have no downlink command implementation. An integration that needs commands should implement the SDK capability and verify acknowledgements and device state separately.

How the templates connect

  • Protocol: Device or simulator → TCP connector → platform device lookup using the managed runtime identity → MQTT using the bound device's credentials → ThingsPanel telemetry.
  • Third-party service: Tenant access point → vendor API → device discovery and binding → connector reconciliation → MQTT → ThingsPanel telemetry.

The managed identity authorizes connector calls to ThingsPanel. The tenant's API credentials authenticate to the vendor service. Device MQTT credentials identify the device that owns the published telemetry. When using an installed connector, keep these credentials in their respective runtime, access-point, and device configurations.

Quick start

You need Go 1.22 or later. Docker is used when building a plugin image.

  1. Clone this repository or unpack the pinned GitHub release archive when it is available.
  2. Copy the complete template directory into your own project. Choose protocol-go for devices that connect over TCP, or service-go for an API that uses tenant credentials and supports device discovery.
  3. Run go test ./... from the copied directory and follow its README to start the connector and simulator. Both examples serve a health check at http://localhost:9001/health.
  4. To adapt the example with AI, add thingspanel-connector-dev to your AI tool and give it access to the complete kit. Provide the vendor specification, sample messages, and your target ThingsPanel version. Keep a trace from each telemetry field and supported command to its source.

Both templates pin ThingsPanel Go SDK v1.1.0. The service template follows Home Assistant connector v1.0.0 for tenant configuration, discovery, binding reconciliation, and telemetry.

Check the first result

Check TCP template Third-party template
Connector health Request /health on port 9001 and look for status: ok Same
Simulator Send a frame for demo-001 to TCP port 9002 Run the mock service on port 8080 and query device discovery through the connector
Expected output Connector receives the frame. With MQTT configured, expect temperature, humidity, and sequence Discovery returns weather, liquid level, and pump devices. With platform binding and MQTT configured, expect a metric and observed_at
Platform acceptance Bind a device and verify its latest data in ThingsPanel Configure a tenant access point, discover and bind a device, verify telemetry, and check that unbinding takes effect

Both connectors default to HTTP port 9001. Run them one at a time or set a distinct CONNECTOR_LISTEN_ADDR. The service simulator must be reachable from the connector's network. The template READMEs include the commands and example credentials for local simulation.

Adapt a template

  • TCP: Change the frame format and decoder to match the device specification. Keep device identifiers consistent among the simulator, lookup, and platform binding. Update the telemetry mapping and verify a known input and its expected units.
  • Service: Replace the mock service client's authentication, discovery, and data calls. Keep remote device IDs stable and test pagination, binding changes, and credential errors.
  • Both: Rename the Go module and choose a unique plugin ID. Update the manifest and catalog example together. Test with a valid sample, a malformed input, and an unavailable or unauthorized upstream.

Install and publish

Follow the installation and publishing guide (Chinese) to build images, prepare signed catalog entries, and submit a Resource Center listing. Use one plugin ID across the manifest, catalog, installation link, and runtime service identifier. A platform super administrator installs the plugin. Tenants then configure their access points and bind devices.

Repository layout

skills/thingspanel-connector-dev/   AI skill entry point
templates/protocol-go/            TCP connector and device simulator
templates/service-go/             Service connector and mock HTTP API
docs/                             Installation, publishing, and migration

The SDK pin is a development baseline. Record the ThingsPanel version, installer version, and CPU architecture you verify when publishing a connector. The installer and Resource Center also need a catalog entry and an installation route for the chosen plugin ID.

Contributing

When proposing a template change, run go test ./... in the affected module. For a change to the shared workflow or release instructions, check both templates and update both root READMEs when their guidance changes. Include a repeatable sample and expected output for mapping changes.

Troubleshooting and issue reports

Symptom Check
Health endpoint fails Check the connector process and logs, CONNECTOR_SERVICE_IDENTIFIER, CONNECTOR_INSTANCE_ID, and the HTTP port.
TCP simulator cannot connect Check the TCP listen address and the network route to port 9002. The installer does not automatically publish that port on the host.
Service discovery fails Check service reachability from the connector and the access-point credentials. For the local mock, verify the configured port and API key.
MQTT receives data but ThingsPanel shows no update Check the bound device ID, device MQTT credentials, telemetry field names, and the device details timestamp.
Plugin is missing or cannot start Check that the Agent trusts the catalog, the referenced image exists on the install host for its architecture, and the service identifier matches the catalog entry.

For a bug report, include the Kit and ThingsPanel versions, template and platform architecture, steps to reproduce, and the expected and actual results. Attach sanitized logs and sample inputs.

Release status

This kit is ready for release-candidate evaluation. Both templates have been tested in clean directories and built as containers. Local MQTT subscribers received telemetry from both simulators using a test platform API, and the catalog examples were signed and verified with a temporary key.

Before a stable release, verify signed installation, tenant configuration, device binding, and telemetry in the ThingsPanel UI for both templates on an isolated target platform. For any connector that supports downlink, verify the acknowledgement and resulting device state. Include the fixed download link after publishing the release archive.

About

AI skill and standalone Go templates for building ThingsPanel device connectors

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages