[SOLVED]Problem with HTML custom block

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
Diplo95
Posts: 15
Joined: Friday 26 July 2019 10:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Melun France
Contact:

[SOLVED]Problem with HTML custom block

Post by Diplo95 »

Hi,

I'm a beginner with dashticz and I try to use an HTML custom block on my screen. I use the example of the wiki and try to retrieve the met of my location.

Here is the code from weatherwidget.io :

Code: Select all

<a class="weatherwidget-io" href="https://forecast7.com/fr/48d542d66/melun/" data-label_1="Moissy-Cramayel" data-icons="Climacons Animated" data-mode="Current" data-theme="pure" >Moissy-Cramayel</a>
<script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='https://weatherwidget.io/js/widget.min.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','weatherwidget-io-js');
</script>
I created the file WeatherwidgetMelunCurrent.html in /home/pi/Dashticz/Program/custom

Then, I created my block :

Code: Select all

blocks['weatherwidgetCurrent'] = {
    htmlfile: 'WeatherwidgetMelunCurrent.html',
	width: 6,
	title: 'Melun'
}
And finally, I put it in a column :

Code: Select all

columns = {}

columns[1] = {}
columns[1]['blocks'] = ['weatherwidgetCurrent']
columns[1]['width'] = 6;
Here is the result :
Image

Any idea where I go wrong ?
Thx
Last edited by Diplo95 on Friday 10 September 2021 18:44, edited 1 time in total.
Domoticz v2021.1 on Raspberry Pi 3B+
Raspbian Buster
ConBee II + Xiaomi devices
Zwave
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Problem with HTML custom block

Post by Lokonli »

Diplo95 wrote: Friday 10 September 2021 10:26 Hi,

I'm a beginner with dashticz and I try to use an HTML custom block on my screen. I use the example of the wiki and try to retrieve the met of my location.

Here is the code from weatherwidget.io :

Code: Select all

<a class="weatherwidget-io" href="https://forecast7.com/fr/48d542d66/melun/" data-label_1="Moissy-Cramayel" data-icons="Climacons Animated" data-mode="Current" data-theme="pure" >Moissy-Cramayel</a>
<script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='https://weatherwidget.io/js/widget.min.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','weatherwidget-io-js');
</script>
I created the file WeatherwidgetMelunCurrent.html in /home/pi/Dashticz/Program/custom

Then, I created my block :

Code: Select all

blocks['weatherwidgetCurrent'] = {
    htmlfile: 'WeatherwidgetMelunCurrent.html',
	width: 6,
	title: 'Melun'
}
And finally, I put it in a column :

Code: Select all

columns = {}

columns[1] = {}
columns[1]['blocks'] = ['weatherwidgetCurrent']
columns[1]['width'] = 6;
Here is the result :
Image

Any idea where I go wrong ?
Thx
The htmlfile parameter is relative to the Dashticz custom folder ./custom

So your custom html file might be in the wrong location. (or is Program the name of your Dashticz folder?)

Naming is case sensitive. So you should check that as well.
Diplo95
Posts: 15
Joined: Friday 26 July 2019 10:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Melun France
Contact:

Re: Problem with HTML custom block

Post by Diplo95 »

Hi,

Image

I used the automatic installation, and I don't remember the path I chose. But, as you can see, this is the folder containing my CONGIG.js and custom.css files.
Domoticz v2021.1 on Raspberry Pi 3B+
Raspbian Buster
ConBee II + Xiaomi devices
Zwave
Diplo95
Posts: 15
Joined: Friday 26 July 2019 10:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Melun France
Contact:

Re: Problem with HTML custom block

Post by Diplo95 »

I found my stupid error :
I had defined the weatherwidget blocks before the line

Code: Select all

blocks{}
in CONFIG.js !!!
Domoticz v2021.1 on Raspberry Pi 3B+
Raspbian Buster
ConBee II + Xiaomi devices
Zwave
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest