Read-only mirror of https://github.com/SchweizerischeBundesbahnen/thingsboard-advanced-attribute-widget — SBB. Issues & pull requests at the source.
  • JavaScript 84.8%
  • HTML 10.4%
  • CSS 4.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2022-03-01 07:56:45 +00:00
assets/images remove readme;add images 2022-02-25 06:45:17 +00:00
docs update doku 2022-02-25 07:03:13 +00:00
src remove readme;add images 2022-02-25 06:45:17 +00:00
test bug killing 2022-02-24 15:39:13 +00:00
.gitignore remove readme;add images 2022-02-25 06:45:17 +00:00
.jsdoc.conf.json add documentation 2022-02-22 16:12:13 +00:00
advanced_thingsboard_attribute_widget__ataw_.json add widget json 2022-02-25 06:55:24 +00:00
LICENSE Initial commit 2022-02-16 09:52:18 +01:00
package.json bug killing 2022-02-24 15:39:13 +00:00
README.md update doku 2022-03-01 07:56:45 +00:00

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 "bc0c2280f2".

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.