Introducing Ledger

Originally published at: Introducing Ledger - Particle Changelog

Hi everyone,

We are thrilled to announce the rollout of Ledger, Logic’s new companion feature. It’s in beta right now so you can explore it in your Sandbox for non-production usage.

What is Ledger?

Ledger allows you to store and retrieve structured data in the cloud. The data can be scoped to one device, an entire product, or your whole account.

How do I use Ledger?

It can currently be used from the Console, API, and Logic Functions.

Check out the getting started documentation.

Can I use Ledger from a device?

We’re planning to roll out cloud-to-edge synchronization of Ledgers in an upcoming Device OS release.

In the meantime, use Logic to bridge the gap! Publish an event from a device and create a Logic Function that runs when an event is received. In that Logic Function, write to or read from your Ledger. Remember to create the Ledger on the Console first before attempting to write to it.

Uses

  • Aggregate signal over time
  • Set the target state of a device even when it’s offline
  • Build a hierarchy of configuration (read from the device Ledger first, and if doesn’t exist, read from the product Ledger)
  • General purpose memory for Logic Functions

Try it out and let us know what you think! If you have any questions or feedback, please post them in this thread.

8 Likes

Thankyou!

Ledger + Logic look like a really useful development that could simplify our workflow which currently uses 3rd-party scripting / data storage tools like Google Sheets and Pipedream. I have only taken a brief tour, but here are some initial (possibly ill-informed!) thoughts / requests:

Ledger:

  • It would be nice to be able to modify / edit the type, scope and description details of a ledger
  • It would be nice to be able to modify / edit the deviceID for device-scoped ledger instances
  • It would be nice to be able to copy / modify ledger instances to facilitate having multiple devices that share the same instance structure / template but which have different instance values.
  • It would be clearer to be able to delete Legers rather than having only the option to ‘Archive’ them (which if you try it, is actually a Leger delete with the possibility of recovery by submitting a support request within 30 days).
  • It would be nice to be able to invoke Logic functions easily from the Ledger page

Logic:

  • It would be nice if Logic functions could call exposed functions on devices (HTTP requests) as well as being able to generate events.
1 Like

These are good suggestions, thank you!

You can't modify the type of a ledger (cloud only, device to cloud, or cloud to device) because the instances are different based on the type. All of the instance data would have to be deleted, which would be basically the same as deleting the ledger and creating a new one with the same name, which is allowed.

The same is true for changing the scope. There is only one instance an owner or organization scoped ledger. There is one for each product that uses it in the product scope. And one for each device in a device scope.

The console will never provide every option for manipulating ledgers. At some point, you'll probably want to script a solution using the Particle cloud API. This will allow you to do things like replicate device instance ledgers. Since ledgers are just JSON data and there's no schema, it's really easy to create and modify ledgers using the API.

1 Like