Send a command to a device, such as a micro controller or IOT device.
Are there any examples that would show how this is done?
I’m working on integration with Simple IoT where we want to change configuration settings in a Grafana dashboard that then get written to SIOT.
I’ve experimented with the Button panel, but cors issues makes this messy. It would be much cleaner if I could run some Go code in the backend to talk NATS directly to SIOT.
For a frontend data source solution, you can check out this code example.
For a backend data source solution, you can register a resource handler, which extends the Grafana HTTP API with plugin-specific endpoints, which you can then call from your dashboard.
Since you specifically asked for examples of data source plugins, here’s how you extend your backend plugin with a resource handler:
You can then access the plugin resource from: /api/datasources/<your-plugin-id>/resources/, where your-plugin-id is an integer that identifies the data source instance you want to access.
Here’s the frontend code to query the data source resource: