smartvisu - Widget Assistant

Table of Content

  1. How it works
  2. ChangeLog new
  3. Hot-Keys new
  4. Known issues new
  5. Logics to create masteritem.json new

How it works

This tool should help you to create widgets for your smartvisu-Web-Interface. It will assist you with autocompletes for widgets, items, icons, and colors. After you have selected a widget (like basic.symbol...) you will get a tooltip for this kind of widget. The actual parameter is highlighted in red and all the available details will be shown in the tooltip-window. For icons and colors you will see a preview in the tooltip-window. After completing the wiget you can render it in a new window. The widget in the rendered window is fully working, except there is an error in the created widget, you will get a TWIG-Error. The final widget including the brackets "{{" + "}}" will be stored on rendering to the clipboard. You can paste the widget-code directly to your html-file.

Right now you can render multiple widgets, you have to separate the different widgets by a <br>-TAG

Example :


plot.period('', ['licht.og.terrasse.screens.warm.dimmen', 'licht.og.terrasse.screens.kalt.dimmen', 'licht.og.terrasse.decke.dimmen'], 'max', '1w', 'now', '0', '110', '1000', ['Screens warm', 'Screens kalt', 'Decke'], ['#daa', '#aad', '#955'], ['stair', 'stair', 'stair'], ['Uhrzeit', 'Helligkeit'], 'advanced', '', '', '', '', '', { yAxis: [ { tickInterval: 40 } ], legend: {align: 'right', verticalAlign: 'top', y: 50, layout: 'vertical'}, chart: { marginRight: 110} })
<br>
basic.stateswitch('','OG.Bad.Licht','midi','','light_ceiling_light','Licht Bad','','','','','')
<br>
quad.dimmer('Lueftungsstufe1', 'Lüftungsstufe', 'Haustechnik.Lueftung', 'Haustechnik.Lueftung.stufe', 0, 100, 5, icon.ventilation(), icon.ventilation('','','Haustechnik.Lueftung.stufe'), '', '', '', 0, 100, '', '', '', '',   '', '', '', '', '', '', '', '', '', ['switch', 'value_popup']) 

Change-Log

2021.01.18 - Version 1.1.0

2020.11.08 - Version 1.0.0

2020.05.15 - Version 1.0.0

2020.05.03 - Version 1.0.0

2020.05.02 - Version 1.0.0

2020.05.01 - Version 1.0.0

2020.04.26 - Version 1.0.0

2020.04.25 - launch of Version 1.0.0

Requirements

actual smartvisu-Version - you can find it here

Hot-Keys

Shortcut function
STRG+0 switch OFF autocomplete-Dict
STRG+1 switch ON autocomplete-Dict
STRG+2 only Widgets in autocomplete-Dict
STRG+3 only Icons in autocomplete-Dict
STRG+4 all in autocomplete-Dict
STRG+5 only Colors in autocomplete-Dict
STRG+6 autocomplete-Dict is OFF
STRG+7 switch ON/OFF autocomplete for Ouotes (1) - take some time to build the autocomplete
STRG+8 only Items in autocomplete-Dict
STRG+9 switch ON/OFF Wildcard search in autocomplete dict
STRG+Space opens the actual autocomplete-Dict
STRG+F find value in widgets
STRG+SHIFT+R replace value in widgets - use ENTER to go to replacement-value

(1) when autocomplete for quotes is on - the autocomplete dict will return all values without quotes
when autocomplete for quotes is off - the autocomplete dictionary will return all values with quotes

Known Issues

It is possible to render the new widget into the iframe on the actual page. But this will destroy the loaded index.php. You will get in trouble when you want to use the navigation of smartvisu again. No solution right now. You can reload the page with bypassing the cache, then everthing is working again. (STRG+F5 / CTRL + Shift + R)

Logic to create masteritem.json from shNG


#!/usr/bin/env python3
# create_master_item.py
import json
from lib.item import Items
items = Items.get_instance()
items_sorted = sorted(items.return_items(), key=lambda k: str.lower(k['_path']), reverse=False)
item_list = []
for item in items_sorted:
    item_list.append(item._path + "|" + item._type )
f = open("/var/www/html/smartvisu/pages/YOUR_PAGES/masteritem.json", "w")
f.write(json.dumps(item_list))
f.close()