Smartvisu V3.2.2 -> V3.5 Update Fehler

Begonnen von Hackstall, 01 Dezember 2025, 00:15:13

Vorheriges Thema - Nächstes Thema

Hackstall

error: Unable to find template "lib.html" (looked into: /var/www/html/smartvisu/apps, /var/www/html/smartvisu/pages/Rosenstr.35, /var/www/html/smartvisu/dropins, /var/www/html/smartvisu/pages/base).
file: index.html
line: 15

Yes I have read the installation procedure but I still received the error as given above.

Can you please help out here.

Thanks Andreas

curiosus

here we go:

<svdir>/widgets/lib.html

/**
* -----------------------------------------------------------------------------
* @package     smartVISU
* @author      Martin Gleiß
* @copyright   2012 - 2024
* @license     GPL [http://www.gnu.de]
* -----------------------------------------------------------------------------
*/


/**
* the smartVISU-logo
*/
{% macro smartvisu(mode) %}

{% if mode == 'app' %}
<div class="app">
<div class="image">
<div class="smartvisu"><span class="smart"></span><br /><span class="visu">rHM</span></div>
</div>
</div>
{% else %}
<span class="smartvisu"><span class="smart"></span><span class="visu">rHM</span></span>
{% endif %}

{% endmacro %}


/**
* Check for new updates of smartVISU
*/
{% macro updatecheck( ) %}
{% if config_updatecheck %}
<script>
$('#index').on('pagecreate', function (event, ui) {
$.ajax({
dataType: 'json',
url: 'lib/base/check_update.php?local={{ config_version_full }}',
beforeSend: function(jqXHR, settings) { jqXHR.svProcess = 'Update Check'; },
success: function (data) {
if (data.update) {
notify.message('update', data.text, sv_lang['update']['local'] +': <b>' + data.local + '</b><br>' +
sv_lang['update']['remote'] +': <b>' + data.remote + '</b><br><br>' +
sv_lang['update']['visit'] + ' <a target="_blank" href="http://smartvisu.de">smartVISU.de</a> '+ sv_lang['templatechecker']['or'] +
' <a target="_blank" href="http://github.com/martin-gleiss/smartvisu">github</a> ' + sv_lang['update']['latest'] + '!<br><br>'+
'<a target="_blank" href="http://github.com/martin-gleiss/smartvisu/blob/master/changelog.md">' + sv_lang['update']['view'] + '</a><br><br>'+
sv_lang['update']['recheck'] + '. <br />');
}
}
})
.fail(notify.json);
});
</script>
{% else %}
<!-- Check for updates disabled in configuration -->
{% endif %}
{% endmacro %}


/**
* Widget to place an app-symbol
* If you write an app yourself, place a @title, @icon, @color tag in your
* header. These tags are used to display the symbol
*
* @param        the name of the app (located in pages/apps)
* @param        title of the app
*/
{% macro app(name, title) %}

{% set app = docu('apps/'~name~'.html') %}

<div class="app">
<a href="index.php?page={{ name }}">
<div class="image" style="background-color: #{{ app.color }};"><img src="{{ app.icon }}" alt="{{ app.name }}"></div>
<div>{{ title|default(app.title|e) }}</div>
</a>
</div>
{% endmacro %}

/**
* Widget to show websocket connection
*
*/
{% macro connection( ) %}
{% import "@widgets/basic.html" as basic %}
<span id="{{ page }}-connection"></span>
<script>
$('#{{ page }}-connection').html(io.socket.url);
if (io.server != undefined) {
if (io.server != '') { // if io.server already set write it directly
var connectString = 'smarthomeNG Websocket Server: '+ io.server + ', '+ sv_lang['system']['connected']+': '+ io.opentime.transUnit('short') +
'<br>Websocket URL:&nbsp;&nbsp;' + io.socket.url;
$('#{{ page }}-connection').html(connectString);
} else {
$(document).on('ioAlive', function(){   //else wait for ioAlive event and write then
if (io.server != '' ) {
var connectString = 'smarthomeNG Websocket Server: '+ io.server + ', '+ sv_lang['system']['connected'] + ': '+ io.opentime.transUnit('short') +
'<br>Websocket URL:&nbsp;&nbsp;' + io.socket.url;
$('#{{ page }}-connection').html(connectString);
}
})
}
}
</script>
{% endmacro %}

/**
* Button to send a timestamp to an item (for countdown docu page)
*
* @param {id} unique id for the widget. Mandatory in order to identify the button in a page with more than one button
* @param {item(num)} the item
*
* @Author: Wolfram v. Hülsen
*/
{% macro timestamp (id, item) %}
<button type="button" data-theme="a" data-inline="true" id="send_timestamp_{{ uid(page, id) }}" class="ui-midi">Trigger</button> Click to start
<script>
$('#send_timestamp_{{ uid(page, id) }} ').click(function() {
var now = +new Date();
io.write('{{ item }}', now );
});
</script>
{% endmacro %}

/**
* Extend a single block to full screen width
*
* @param {id=} unique id for the widget.
*
* @Author: bonze  (plot resize and icon management by Wolfram v. Hülsen)
*/
{% macro supersize ( id ) %}
{% set uid = uid(page, id) %}
{% import _self as lib %}
<span{% if not id is empty %} id="{{ uid(page, id) }}"{% endif %} >
<a>{{ lib.svgimg ('', 'control_centr_arrow_up_right.svg', 'supersize icon0 sizesmall') }}</a>
<a>{{ lib.svgimg ('', 'jquery_minus.svg', 'supersize icon0 sizebig', 'display:none;') }}</a>
</span>
<script>
$(".supersize").closest("div").on("collapsiblecreate", function (event, ui){
var element = $(this);
if (element.parent().attr("data-iconpos") == "right")
element.collapsible({iconpos: "none"});
});

$(".supersize").click(function (e) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
var element = $(this).closest("div");
var previousWidth = parseFloat(element.css('width').replace('px',''));
var previousHeight = parseFloat(element.find('.ui-collapsible-content').css('height').replace('px',''));

if (!element.hasClass('overlay')){
$(".mask").css('display','block');
element.addClass("overlay").show();
element.collapsible('expand');
element.find("h3").addClass("ui-corner-all");
element.find(".supersize.sizesmall").hide();
element.find(".supersize.sizebig").show();
element.find(".supersize").attr("data-ypos", Math.round(window.scrollY));
element.find('.highcharts-root').addClass('supersized');
$.mobile.silentScroll(0);
}else{
$(".mask").css('display','none');
element.removeClass("overlay");
element.find("h3").removeClass("ui-corner-all");
element.find(".supersize.sizebig").hide();
element.find(".supersize.sizesmall").show();
element.find('.highcharts-root').removeClass('supersized');
var previousPosition = element.find(".supersize").attr("data-ypos")*1;
$.mobile.silentScroll(previousPosition);
}
var actualWidth = parseInt(element.css('width').replace('px',''));
var sizeFactor = actualWidth / previousWidth;
element.find('.ui-collapsible-content').css('height', previousHeight * sizeFactor)
.find('.plot').each(function() {
var actualPlotHeight = parseFloat($(this).css('height').replace('px',''));
$(this).css('height', actualPlotHeight * sizeFactor);
$(this).highcharts().setSize(null, null);
}).end()
.find('[data-widget="device.uzsutable"] .highcharts-root').css('max-height', sizeFactor < 1 ? '' : 400*sizeFactor+"px");
});
</script>
{% endmacro %}

/**
* Embed an svg icon into html DOM in order to make it styleable.   
  icon must be available in ./icons/ws or ./dropins/icons/ws. Otherwise use &lt;img src=... with icon path and name
*
* @param {text=} optional id for the icon
* @param {text} icon name e.g. 'myicon' or 'myicon.svg'
* @param {text=} CSS classes for the icon (optional, default='')
* @param {text=} styling options in CSS notation (optional, default='')
*
* @Author: Wolfram v. Hülsen
*/
{% macro svgimg ( id, pic, iconclass, styleoptions ) %}
{% set pic = localize_svg(pic) %}
<svg class="icon {{ iconclass }}" {% if not id is empty %} id="{{ uid(page, id) }}"{% endif %} {{ (styleoptions is not empty ? 'style ="' ~ styleoptions ~'"' : '')|raw }} role="img" aria-label="{{ pic|split('/')|last|split('.')[0:-1]|join('.') }}"
{{ source( pic )|split('<svg')[1]|replace( {'stroke="#fff"':'', 'fill="#fff"':'', 'stroke="#FFF"':'', 'fill="#FFF"':''} )|raw }}
{% endmacro %}

good luck
Klaus
NUC | Fronthem/Smartvisu | Nextcloud | DBLog | Grafana | div. HM Akt-/Sensoren | ESP8266/32 | 1-Wire | Shelly | WH1000 | PWM-PWMR | Xiaomi | MQTT | CarConnectivity-MQTT | Luftsensor.info | Alexa | iRobots | Zigbee | HUE | SENEC Bat+Wallbox | Zoneminder | Fritz!/Box/Fon/Repeater

wvhn

Moin Andreas,

das Problem ist in den Release Notes für v3.5 unter "Wichtig !!! für den Umstieg" beschrieben und hier genau erklärt.

Der Import von Widgets wird schon seit v2.9 automatisch gemacht, so dass man in den eigenen Seiten keine Import-Anweisungen mehr braucht. Lediglich in eigenen Widgets muss man die verwendeten Widgets noch explizit importieren. Zusätzlich wurde für die Widgets in v3.3 ein Namespace "@widgets" eingeführt. Der Namespace legt die Ordner fest, in denen nach einem zu importierenden Widget gesucht wird. Dieser Suchpfad ist jetzt unabhängig von dem Pfad, in dem Visu-Seiten gesucht werden. Grund für dies Maßnahme war, dass Anwender bei der Vergabe der Seitennamen immer mal wieder Namen verwendet haben, die für die Widgets reserviert waren, z.B. "multimedia.html". Die alte Methode war 2 Jahre deprecated und wurde in v3.5 abgeschaltet.

Die von Dir gepostete Fehlermeldung besagt, dass das Widget "lib.html" im falschen Pfad gesucht wurde. Du mussst also in Deiner ./pages/Rosenstr.35/index.html nach der Import-Anweisung für lib.html suchen und diese löschen:
{% import "lib.html" as lib %}Ebenso alle anderen Widget-Importe, die noch in Deinen Visu-Seiten vorhanden sind.

Gruß
Wolfram