Skip to content

SchweizerischeBundesbahnen/thingsboard-advanced-attribute-widget

Advanced Thingsboard Attribute Widget (ATAW)

GitHub package.json version

Description

Looking for an advanced dashboard widget in Thingsboard to edit attributes. Look no more. ATAW is very flexible. You can choose one ore many of the input field to let the user edit attribute values. The following input types are possible:

  • textfield (opt. pattern check with regex)
  • slider / range slider (min,max,step)
  • checkbox (true|false)
  • multifield (array|list)

Installation

  1. Import advanced_thingsboard_attribute_widget__ataw_.json to widget Library

OR (if you want to make changes to the widget specific stuff and only want to import the class)

  1. create new Widget (type: control widget, call it ATAW)
  2. add resources:
  1. copy content of src/html.html to "HTML" tab
  2. copy content of src/style.css to "CSS" bab
  3. copy content of src/javascript.js to javascript section
  4. copy content of src/settings-schema.json to "Settings schema"
  5. save widget

At step 2. you can also specify the version of the class by adding the github version behind an "@", for example: https://cdn.jsdelivr.net/gh/SchweizerischeBundesbahnen/thingsboard-advanced-attribute-widget@bc0c2280f271f915b411d9949654ccf82e172bf1/src/class.inputfield.js to get commit version "bc0c2280f271f915b411d9949654ccf82e172bf1".

Usage

  1. Create new Dashboard
  2. create new entity alias
  3. add new widget > select ATAW Widget
  4. go to advanced tab and edit "Button label"
  5. set a device command (this can be used to filter in Rules)
  6. select attribute type (server|shared)
  7. Set parameters via json Example:
[
        {
            "title": "LED einschalten?",
            "type": "checkbox",
            "key": "led_on"
        },
        {
            "title": "Max Temp 1: %s °C",
            "type": "range",
            "key": "temp_max",
            "min": -50,
            "max": 100,
            "step": 1
        },
        {
            "title": "Min Temp 1: %s °C",
            "type": "range",
            "key": "temp_min",
            "min": -50,
            "max": 100,
            "step": 1
        },
        {
            "title": "Waypoint %s: ",
            "key": "waypoints",
            "type": "text",
            "default": "0",
            "multi": true,
            "multitype": "array",
            "pattern":"^[+-]?([0-9]+\\.?[0-9]*|\\.[0-9]+)$"
        },
        {
            "title": "E-Mail Alarm %s: ",
            "key": "alert_email",
            "type": "text",
            "default": "0",
            "multi": true,
            "multitype": "array",
            "pattern":"[^@ \\t\\r\\n]+@[^@ \\t\\r\\n]+\\.[^@ \\t\\r\\n]+"
        }
]
  1. Save widget
  2. Save dashboard
  3. Try widget!

Code Documentation

https://schweizerischebundesbahnen.github.io/thingsboard-advanced-attribute-widget/

Tests

The directory "test" contains a simple framework to locally test the widget and debug in a Thingsboard independent enviroment.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published