Scaling an IoT deployment? Join our webinar on May 28th where we dive into real-world scaling pain points and how to overcome them.

Blues Developers
What’s New
Resources
Blog
Technical articles for developers
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Developer Certification
Get certified on wireless connectivity with Blues
Webinars
Listing of Blues technical webinars
Blues.comNotehub.io
Shop
Docs
Button IconHelp
Notehub StatusVisit our Forum
Button IconSign In
Sign In
Sign In
What’s New
Resources
Blog
Technical articles for developers
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Developer Certification
Get certified on wireless connectivity with Blues
Webinars
Listing of Blues technical webinars
Blues.comNotehub.io
Shop
Docs
homechevron_rightBlogchevron_rightIntroducing Notehub Smart Fleets

Introducing Notehub Smart Fleets

Introducing Notehub Smart Fleets banner

February 25, 2025

Learn about smart fleets, a new Notehub feature that lets you dynamically group your devices based on their data.

  • Notehub
TJ VanToll
TJ VanTollPrincipal Developer Advocate
email

Today we’re excited to announce smart fleets, a new Notehub feature that lets you automatically categorize your devices based on their data.

What are Smart Fleets?

Since day one, Notehub has made it possible to group your devices into fleets for easier management. However, the actual grouping process has always been manual, requiring a fleet manager to add new devices to their fleets using the Notehub UI or API, and to manually update those fleets as their project’s requirements change.

Smart fleets introduce a new way to automate device groupings using smart-fleet rules—expressions that Notehub evaluates to add or remove devices based on their data. Let’s look at how they work.

How to Use Smart Fleets

To try out smart fleets, visit any existing Notehub fleet’s settings, and find the new Smart Fleet Rules section.

The Smart Fleet section on a Notehub fleet

When enabled, Notehub will run every incoming event through the smart-fleet rules you provide. The rules themselves must be a valid JSONata expression, and that expression must return one the following three functions to categorize your devices:

  • $addToFleet(): Adds the current device to the fleet.

  • $removeFromFleet(): Removes the current device from the fleet.

  • $leaveFleetAlone(): Neither adds nor removes the current device from the fleet.

For example, the following JSONata expression looks for inbound data from a _temp.qo Notefile, and automatically adds devices with a temperature over 20 to the current fleet, and automatically removes devices with a temperature under 20 from the fleet.

(
  $notefileToCheck := "_temp.qo";
  $threshold := 20;

  $result := (file != $notefileToCheck) 
    ? $leaveFleetAlone() 
    : (body.temperature > $threshold) 
      ? $addToFleet() 
      : $removeFromFleet();
)

JSONata can be a bit intimidating, so let’s go through what’s happening in this example in detail. To start, using parenthesis in JSONata defines a scope, and a scope allows you to use variables.

/* This creates a scope */
(
  /* This creates a variable, x, and sets its value to 5 */
  $x := 5;
)

JSONata exports the last-declared variable within a scope.

/* The result of this expression is 7, as it’s the last-declared
variable within the scope */
(
  $x := 2;
  $y := 7;
)

JSONata has a ternary operator allowing you conditionally set variables.

/* The result of this expression is true, as the variable $temp
is > 10 */
(
  $temp := 20;
  $result := $temp > 10 ? true : false
)

Putting that all together let’s return to the example JSONata.

(
  $notefileToCheck := "_temp.qo";
  $threshold := 20;

  $result := (file != $notefileToCheck) 
    ? $leaveFleetAlone() 
    : (body.temperature > $threshold) 
      ? $addToFleet() 
      : $removeFromFleet();
)

This expression performs two checks.

  • The first check (file != $notefileToCheck) is used to filter out data that’s not relevant to the current fleet. The example fleet is named “High Temp” and is only interested in temperature data, so this initial check tells Notehub to leave the fleet alone for other types of events such as platform events.

  • The second check (body.temperature > $threshold) is a simple comparison that determines whether the device’s temperature is above the configured threshold, and adds or removes the device from the fleet accordingly.

note

Most smart-fleet scenarios can be implemented by making small tweaks to the example JSONata shown above. If you get stuck writing your own JSONata, feel free to reach out in our community forum for help.

Once you save your smart-fleet rules—you’re good to go. As event data comes in, Notehub will run your provided JSONata expression and categorize devices into your fleets automatically.

Smart-fleet assignments display in your project's device list, as well as on a device's Summary page.

A device with a smart fleet assigned in Notehub

What Can You Do With Smart Fleets?

Fleets with smart-fleet rules are still Notehub fleets, and can use existing fleet features. For example, you can apply environment variables to fleets with smart-fleet rules.

Environment variables on a Notehub fleet

And you can use fleets with smart-fleet rules through the Notehub API.

Getting fleet devices using the Notehub API

This combination makes some interesting scenarios possible.

  • Suppose your project controls a sprinkler system for lawns, and you store how often the sprinklers run in an environment variable. You could create a “High Temp” smart fleet, and set a more-frequent interval for sprinklers that detect a higher temperature.

  • Suppose you’re tasked with building a daily report on devices with poor connectivity. Instead of looking through event data manually, you could create a smart fleet based off the metadata in _session.qo events, and use the Notehub API’s Get Fleet Devices request to retrieve a list of devices that match your criteria.

Overall, we’re excited about the power that smart fleets give you to organize your devices and automate business processes.

And we’re just getting started. If you have feedback about Notehub smart fleets, or if you have a scenario in mind you’d like to try out, let us know in the comments .

In This Article

  • What are Smart Fleets?
  • How to Use Smart Fleets
  • What Can You Do With Smart Fleets?

Blues Developer News

The latest IoT news for developers, delivered right to your inbox.

Comments

Join the conversation for this article on our Community Forum

Blues Developer Newsletter

The latest IoT news for developers, delivered right to your inbox.

© 2025 Blues Inc.
© 2025 Blues Inc.
TermsPrivacy
Notecard Disconnected
Having trouble connecting?

Try changing your USB cable as some cables do not support transferring data. If that does not solve your problem, contact us at support@blues.com and we will get you set up with another tool to communicate with the Notecard.

Advanced Usage

The help command gives more info.

Connect a Notecard
Use USB to connect and start issuing requests from the browser.
Try Notecard Simulator
Experiment with Notecard's latest firmware on a Simulator assigned to your free Notehub account.

Don't have an account? Sign up