Skip to content

note 8: Widget TuyaDAEMON UI

Marco Sillano edited this page May 10, 2024 · 4 revisions

This Widget presents the structure of TuyaDAEMON, in a dynamic 'tree' arrangement and with popups to read the status and updated values of all devices. Zoom, Pan, and alterations can be done with just the mouse. The data update interval, in the tooltips of each device, is given by num_device x refresh_time (default 4s) e.g. 1m20s for 20 devices

User interface using VIS

The choice of the visualization library fell on Vis Network (https://visjs.github.io/vis-network/docs/network/) for its flexibility combined with good ease of use. The nodes and links are two arrays dynamically built by the code by reading the data from TuyaDAEMON via REST.

Specifications

  • Expected modules are CORE - including CORE_devices, core_TRIGGER, core_SYSTEM, core_MQTT, core_OPENAPI. If new TiyaDAEMON extension modules are created, these must be added.
  • The code automatically adapts to each TuyaDAEMON implementation and requires very little intervention.

Configuration

  • You need to update the TuyaDAEMON URL in the file. Typically it is local, but this is not necessarily the case: remote monitoring is also possible, especially if used as a standalone APP and not as a widget.
  • Update: the basic data polling time is set to 4s by default. The update frequency depends on the number of devices. Example 10 devices = 40 seconds

Options

The list of monitored devices is obtained when the program is started and is NOT updated. The program uses 2 methods to get the list, which the user can choose from:

  • 'live' mode: ALL devices in tuyastatus are monitored, i.e. the devices that have sent data. Since a Deploy or Restart of node-red resets all data, the number of devices varies: some devices can disappear from the UI until they send new data (even hours/days) A reload of the widget updates the list. More suitable for occasional use. Note: requires CORE only to run.

    • 'all' mode: ALL devices in global.alldevices are monitored. This method can lead to many disconnected devices, especially during the testing phase. Always present ALL devices in TuyaDEAMON. Note: requires at least CORE + SYSTEM to run.

Customization

There are two sectors of optional customizations to improve the look & feel of the network:

  1. To have specialized icons for some devices, you must provide a criterion and an indication of the special icon to use (see https://fontawesome.com/v4/cheatsheet/). By default, they have special icons: Thermometers (a device with the name 'Temp...'), Thermostatic valves (a device with the name 'Termo...'), and Gateways (a device with 'Gateway' in the name).

  2. The tooltip that opens under the mouse contains by default ALL the latest values of the device's DPs (as per SCHEMA), and normally no processing is necessary. In case of very long information, the browser can truncate the tooltip. A filter function can be customized to select the most important information by device type.

Use

Standalone as an APP or as a widget within WEB pages. Being HTML/js it works in any OS. with an updated browser.


Installation

Download and unzip the files to a directory. A WEB server is NOT necessary, as the code is all in JavaScript, executed by the browser Update the URL for REST communications with your