Update device attribute
Allows to send shared attribute update when user press the button.
Who it’s for
Anyone who needs a dashboard to write a device setting rather than send a command — a threshold the firmware reads, a reporting interval, a mode flag delivered as a shared attribute. The change is configuration, not an instruction, and it should persist whether or not the device is online right now.
What it does
The Update device attribute widget writes a fixed set of attributes to the device when its button is pressed. The attributes are written as JSON in the settings and go to the server or shared scope, so a shared attribute reaches the device on its next connection without any RPC involved.
- Attributes, not commands — the value persists on the platform and is delivered when the device connects, which suits configuration that must survive a device being offline.
- Server or shared scope, chosen per widget: shared attributes reach the device, server attributes stay on the platform.
- The payload is written as JSON, so one press can set several attributes at once.
- The button label and style are set directly.
- The Update device attribute widget writes a fixed payload: a value chosen at press time belongs on a slider, a stepper or the Command button, which can compute what it sends.
How to set up
Data keys
The Update device attribute widget takes no data keys — the payload is defined in its settings.
| Attribute | Scope | Operation | Description |
|---|---|---|---|
| Keys in the parameters JSON | Server (default) or Shared | Write | Every key in Device attribute parameters is written on each press. Shared scope reaches the device; server scope stays on the platform. |
Attributes
| Setting | Default | Effect |
|---|---|---|
| Device attribute scope | Server attribute | Where the attributes are written; switch to Shared attribute to reach the device |
| Device attribute parameters | {} | The JSON object written on each press |
| Button label | Update device attribute | The text on the button |
| Widget title | Unset | The caption above the control |
Set the scope deliberately. The default is server scope, which the device never sees, so a widget intended to configure firmware and left on the default writes successfully and changes nothing on the device.
How to customize
- To reach the device — set Device attribute scope to Shared attribute, which is what the firmware subscribes to.
- To choose what is written — write the keys and values into Device attribute parameters as a JSON object.
- To label the action — set the Button label to what the press actually does, replacing the generic default.
- To caption the control — set the Widget title.
- To match the dashboard’s styling — set the button to raised or flat, and primary or not.
Tips
- Check the scope before assuming a write failed. Server scope succeeds and stays on the platform, so a firmware that never sees the change looks like a broken widget when it is a scope that was never switched.
- Put the attribute keys in the button label when the payload sets more than one thing. A button reading Apply reporting config is honest about writing several attributes; Update device attribute tells nobody what is about to change.
Share Your Widget with the Community
Built a custom widget? Export it as a JSON from ThingsBoard and publish it to the IoT Hub through a simple 4-step wizard (Upload, Listing, Readme, Review & Submit). Share it with thousands of ThingsBoard developers worldwide and get featured in the catalog.