Trying to display a textfile in a tile

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
User avatar
RonkA
Posts: 115
Joined: Tuesday 14 June 2022 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Harlingen
Contact:

Trying to display a textfile in a tile

Post by RonkA »

Hello,

I have a script in domoticz that every 20 seconds makes a textfile named 'net_usage.txt' that grabs the values from some devices to make this:

Code: Select all

Voltage L1: 230.5 Volt Verbruik L1:    5 Watt  Teruglevering L1:  500 Watt
Voltage L2: 235.2 Volt Verbruik L2: 1235 Watt  Teruglevering L2:    2 Watt
Voltage L2: 235.0 Volt Verbruik L2:   20 Watt  Teruglevering L2: 1040 Watt
I can open the textfile in a browser via: file://nas-1/docker/domoticz/userdata/net_verbruik.txt and it displays fine
I tried Dashticz to get this textfile to show on a tile but had no luck with this.
First tried the tile as an text so i added this to CONFIG.js to:

Code: Select all

-----
blocks[999] = {
  width: 6
}
-----
columns[3] = {
  blocks: [999],
  width: 4
}

//Definition of tiles
tiles = {}
tiles['power_usage'] = {
  block: 999,
  width: 6,
  title: 'Power Usage',
  type: 'text',
  refresh: 10,
  url: 'file://nas-1/docker/domoticz/userdata/net_verbruik.txt'
}

But no bueno; so i tried iframe tile, so modified Definition of tiles:

Code: Select all

//Definition of tiles
tiles = {}
tiles['power_usage'] = {
  block: 999,
  width: 6,
  title: 'Power Usage',
  type: 'iframe',
  refresh: 10,
  url: 'file://nas-1/docker/domoticz/userdata/net_verbruik.txt',
  height: '300px'
  }
To index.html i added in <head>

Code: Select all

  <link rel="stylesheet" href="css/style.css">
  <link rel="stylesheet" href="css/weather-icons.css">
  <script src="js/jquery.min.js"></script>
  <script src="js/iframeResizer.min.js"></script>
and in <script>

Code: Select all

      $(document).ready(function() {
      $('iframe').iFrameResize();
But also nothing to show..
What am i missing here?
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
User avatar
RonkA
Posts: 115
Joined: Tuesday 14 June 2022 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Harlingen
Contact:

Re: Trying to display a textfile in a tile

Post by RonkA »

Made some changes, in stead of using file://nas-1/docker/domoticz/userdata/net_verbruik.txt i now use: http://192.168.178.2/dashticz-beta/Made ... rbruik.txt.

Domoticz script writes the textfile: /opt/domoticz/userdata/Made/net_verbruik.txt, this is inside the Domoticz Dockercontainer.
i have the directory /opt/domoticz/userdata/Made mounted to /web/dashticz-beta/Made from where i can acces the textfile with Dashticz.

With a modified index.html i can get a page made including the ifame, but the page isnt very pritty..
index.JPG
index.JPG (35.88 KiB) Viewed 196 times
This is the index.html file used:
Spoiler: show
<!DOCTYPE html>
<html lang="en">

<head>
<meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, user-scalable=0">
<meta name="description"
content="Dashticz - V3, Custom dashboard for Domoticz">
<meta name="author" content="Dashticz">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">

<link rel="shortcut icon" href="img/favicon/favicon.ico"
type="image/x-icon" />
<link rel="apple-touch-icon" sizes="57x57"
href="img/favicon/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60"
href="img/favicon/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Dashticz</title>
<link rel="stylesheet" type="text/css" href="./css/dashticz.css">
</head>
<body>
<div class="dt-container">
<div class="dt-column">
<div class="dt-box">
<div class="dt-header">Column 1</div>
<div class="dt-content">
<p>This is a text tile.</p>
</div>
</div>
<div class="dt-box">
<div class="dt-header">Column 1</div>
<div class="dt-content">
<p>This is another text tile.</p>
</div>
</div>
</div>
<div class="dt-column">
<div class="dt-box">
<div class="dt-header">Column 2</div>
<div class="dt-content">
<p>This is a text tile.</p>
</div>
</div>
<div class="dt-box">
<div class="dt-header">Column 2</div>
<div class="dt-content">
<p>This is another text tile.</p>
</div>
</div>
</div>
<div class="dt-column">
<div class="dt-box">
<div class="dt-header">Column 3</div>
<div class="dt-content">
<iframe src="http://192.168.178.2/dashticz-beta/Made ... "></iframe>
</div>
</div>
</div>
</div>
</body>
</html>
and the CONFIG.js:
Spoiler: show
var config = {}
config['language'] = 'nl_NL'; //or: en_US, de_DE, fr_FR, hu_HU, it_IT, pt_PT, sv_SE
config['domoticz_ip'] = 'http://192.168.178.2:7080';
config['app_title'] = 'Dashticz V3';
config['domoticz_refresh'] = '5';
config['dashticz_refresh'] = '60';
config['user_name'] = 'dashticz';
config['pass_word'] = 'abc123';

config['use_favorites'] = 0; //Request all Domoticz Devices, not only favorites
config['auto_positioning'] = 0; // Use 0 this if you have defined your own columns

//Definition of blocks
blocks = {}
blocks[28] = {
width: 6
}

blocks[29] = {
width: 6
}

blocks[30] = {
width: 6
}

blocks[999] = {
width: 6
}

//Definition of columns
columns = {}
columns[1] = {
//In this example: No blocks are defined in this column
//This column will be empty
width: 4
}
columns[2] = {
blocks : [28, 29, 30],
width: 4
}
columns[3] = {
blocks: [999],
width: 6
}

//Definition of tiles
tiles = {}
tiles['power_usage'] = {
block: 999,
width: 6,
title: 'Power Usage',
type: 'text',
refresh: 10,
url: 'http://192.168.178.2/dashticz-beta/Made ... rbruik.txt'
}
Is there anybody who has an idea? :?:
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest