Page 5 of 11

Re: IMPORTANT REQUEST!!!

Posted: Tuesday 23 October 2018 12:56
by Thuis
Im trying to instal Rasbian on a Xeon N270 to see if there is any difference when i use linux, so far, the installer is busy, installing it to the hard drive...
On windows no luck yet, but i think, luck has nothing to do with it :-p

Re: IMPORTANT REQUEST!!!

Posted: Tuesday 23 October 2018 12:57
by EastXIII
lightmanster wrote: Friday 19 October 2018 13:39
...

also add:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>

to your webserver config if you get Access-Control_allow-origin error

Kind regards
LM
Can you please specify where to put this in Apache2? I get this error all the time. Header module enabled and added this to apache2.conf
But I still get the mentioned error. I'm stuck!

Re: IMPORTANT REQUEST!!!

Posted: Tuesday 23 October 2018 17:12
by peerkersezuuker
In Linux you can change the php version for apache.
Login with ssh to your machine and :

sudo a2dismod php5.6
sudo a2enmod php7.2
sudo apt-get install php7.2-curl
sudo service apache2 restart

Re: IMPORTANT REQUEST!!!

Posted: Tuesday 23 October 2018 17:14
by peerkersezuuker
@EastXII
I have set it in my virtual host config in /etc/apache2/sites-enabled/domoticz.sonnehoek.nl.conf

<VirtualHost 192.168.0.20:880>
# Always set these headers.
Header always set Access-Control-Allow-Origin "*"
DocumentRoot /var/www/dashticz_v2
ServerName domoticz.sonnehoek.nl
<Directory "/var/www/dashticz_v2">
allow from all
Options Indexes FollowSymLinks
Require all granted
</Directory>
</VirtualHost>

Re: IMPORTANT REQUEST!!!

Posted: Tuesday 23 October 2018 23:18
by jake
Thanks for all your tips and tricks guys. Over time my system must have become messy. I decided to wipe out everything that 'smelled' like PHP and start over.

To delete all PHP packages (I had 5.6, 7.0 and 7.2 packages installed)

Code: Select all

sudo apt-get purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
Install PHP 7.2:
I followed the instructions (for the PHP7.2 part) on this website

After a restart of the apache2 webserver

Code: Select all

sudo service apache2 restart
the agenda came back to life.

The garbage is still not working. To outrule possible not updated HVC code, I decided to use the postal code/house number in the file garbage.js from the 'mijnafvalwijzer' and add those to my CONFIG.js. I double checked the combination on the mijnafvalwijzer website and the postal code / house number is a valid one.
Unfortunately it doesn't help. The block still shows 'loading...'

Adaption on garbage.js:

Code: Select all

	$.getJSON(getPrefixUrl() + 'http://127.0.0.1/beta2/dashboard/vendor/dashticz/afval/?service='+service+'&sub='+subservice+'&zipcode=' + address.zipcode + '&nr=' + address.housenumber + '&t=' + address.housenumberSuffix, function (data) {

Re: IMPORTANT REQUEST!!!

Posted: Wednesday 24 October 2018 0:06
by Lokonli
If agenda is working then php is working.

I guess the url is not correct.

Press F12 in the browser. Probably there is an error.

What is the output in your browser if you go to: http://127.0.0.1/beta2/dashboard/vendor/dashticz/afval/
(should be: [])

If dashticz and the afval module are installed on the same server, same location then in garbage.js you can try the following:

Code: Select all

	$.getJSON('./vendor/dashticz/afval/?service='+service+'&sub='+subservice+'&zipcode=' + address.zipcode + '&nr=' + address.housenumber + '&t=' + address.housenumberSuffix, function (data) {

Re: IMPORTANT REQUEST!!!

Posted: Wednesday 24 October 2018 9:49
by poudenes
skip. ignore this post

Re: IMPORTANT REQUEST!!!

Posted: Wednesday 24 October 2018 14:47
by jake
Lokonli wrote: If dashticz and the afval module are installed on the same server, same location then in garbage.js you can try the following:

Code: Select all

	$.getJSON('./vendor/dashticz/afval/?service='+service+'&sub='+subservice+'&zipcode=' + address.zipcode + '&nr=' + address.housenumber + '&t=' + address.housenumberSuffix, function (data) {
I'm booking progress now: instead of that the garbage block tells me 'laden...' it shows 'geen gegevens gevonden'.

Once again I changed company names /address (deafvalapp with corresponding and working address), but with the same result.

I loaded dashticz on my desktop to check for the error log in the browser. This is what it gives me:
Spoiler: show
Source map error: request failed with status 404
Resource URL: http://192.168.x.yz/beta2/dashboard/vendor/head.js
Source Map URL: head.load.min.js.map[Learn More]
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/ jquery.min.js:4:15141
Source map error: TypeError: NetworkError when attempting to fetch resource.
Resource URL: null
Source Map URL: ical.min.js.map[Learn More]
Source map error: TypeError: NetworkError when attempting to fetch resource.
Resource URL: null
Source Map URL: maps/swiper.min.js.map[Learn More]
Loading failed for the <script> with source “https://az416426.vo.msecnd.net/scripts/a/ai.0.js”.
Doesn't seem related to garbage, but probably to the use of 'pihole' that blocks advertisements.

Re: IMPORTANT REQUEST!!!

Posted: Wednesday 24 October 2018 18:09
by EdwinK
poudenes wrote: Wednesday 24 October 2018 9:49 skip. ignore this post
Sorry, no can do ;)

Re: IMPORTANT REQUEST!!!

Posted: Wednesday 24 October 2018 20:38
by Lokonli
jake wrote: Wednesday 24 October 2018 14:47
Lokonli wrote: If dashticz and the afval module are installed on the same server, same location then in garbage.js you can try the following:

Code: Select all

	$.getJSON('./vendor/dashticz/afval/?service='+service+'&sub='+subservice+'&zipcode=' + address.zipcode + '&nr=' + address.housenumber + '&t=' + address.housenumberSuffix, function (data) {
I'm booking progress now: instead of that the garbage block tells me 'laden...' it shows 'geen gegevens gevonden'.

Once again I changed company names /address (deafvalapp with corresponding and working address), but with the same result.

I loaded dashticz on my desktop to check for the error log in the browser. This is what it gives me:
Spoiler: show
Source map error: request failed with status 404
Resource URL: http://192.168.x.yz/beta2/dashboard/vendor/head.js
Source Map URL: head.load.min.js.map[Learn More]
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/ jquery.min.js:4:15141
Source map error: TypeError: NetworkError when attempting to fetch resource.
Resource URL: null
Source Map URL: ical.min.js.map[Learn More]
Source map error: TypeError: NetworkError when attempting to fetch resource.
Resource URL: null
Source Map URL: maps/swiper.min.js.map[Learn More]
Loading failed for the <script> with source “https://az416426.vo.msecnd.net/scripts/a/ai.0.js”.
Doesn't seem related to garbage, but probably to the use of 'pihole' that blocks advertisements.
Double check you have the correct settings in CONFIG.js:

Code: Select all

config['garbage_company'] = 'deafvalapp';
config['garbage_icalurl'] = '';
config['garbage_calendar_id'] = '';
config['garbage_zipcode'] = '5692VG';
config['garbage_street'] = '0';
config['garbage_housenumber'] = '33';

Re: IMPORTANT REQUEST!!!

Posted: Wednesday 24 October 2018 21:15
by robgeerts
Wow had to read back a lot and good to see that most off you already have it working again!!

Re: IMPORTANT REQUEST!!!

Posted: Wednesday 24 October 2018 21:41
by stuffer
robgeerts wrote: Wednesday 24 October 2018 21:15 Wow had to read back a lot and good to see that most off you already have it working again!!
@robgeerts

Almost :-)

First I want to thank you for the project. A crate of beer is on his way when I get this working :-) (or at the Jumbo 1,5 for the price for one )

What I did on my Ubuntu 16 machine for domoticz:

apt install apache2
apt-get install python-software-properties
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.2
apt-get install php7.2-curl
service apache2 restart
nano /home/pi/domoticz/www/dashboard/js/calendar.js

//\\changed://\\

if (settings['calendar_parse_localy']){
curUrl = './vendor/dashticz/ical/?time=' + cache + '&url=' + curUrl;
} else {
curUrl = 'https://dashticz.nl/ical/?time=' + cache + '&url=' + curUrl;
}

//\\to//\\

change curUrl = 'https://MYOWNDOMOTICZIP/ical/?time=' + cache + '&url=' + curUrl;

and add this in my CONFIG.js
config['calendar_parse_localy']=true;

With the result that the dutch tv section is working again. Only my 2 iCals are still not responding. (Google and RMN https://inzamelschema.rmn.nl/ical/0356200000014977)

What is the best way to look at this?

Re: IMPORTANT REQUEST!!!

Posted: Wednesday 24 October 2018 22:14
by Lokonli
stuffer wrote: Wednesday 24 October 2018 21:41
robgeerts wrote: Wednesday 24 October 2018 21:15 Wow had to read back a lot and good to see that most off you already have it working again!!
@robgeerts

Almost :-)

First I want to thank you for the project. A crate of beer is on his way when I get this working :-) (or at the Jumbo 1,5 for the price for one )

What I did on my Ubuntu 16 machine for domoticz:

apt install apache2
apt-get install python-software-properties
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.2
apt-get install php7.2-curl
service apache2 restart
nano /home/pi/domoticz/www/dashboard/js/calendar.js

//\\changed://\\

if (settings['calendar_parse_localy']){
curUrl = './vendor/dashticz/ical/?time=' + cache + '&url=' + curUrl;
} else {
curUrl = 'https://dashticz.nl/ical/?time=' + cache + '&url=' + curUrl;
}

//\\to//\\

change curUrl = 'https://MYOWNDOMOTICZIP/ical/?time=' + cache + '&url=' + curUrl;

and add this in my CONFIG.js
config['calendar_parse_localy']=true;

With the result that the dutch tv section is working again. Only my 2 iCals are still not responding. (Google and RMN https://inzamelschema.rmn.nl/ical/0356200000014977)

What is the best way to look at this?
The CONFIG.js setting should be:
config['calendar_parse_localy']=1;

The change you made in calendar.js is not needed (and incorrect) so better to revert that one.

Re: IMPORTANT REQUEST!!!

Posted: Wednesday 24 October 2018 22:18
by EastXIII
peerkersezuuker wrote: Tuesday 23 October 2018 17:14 @EastXII
I have set it in my virtual host config in /etc/apache2/sites-enabled/domoticz.sonnehoek.nl.conf

<VirtualHost 192.168.0.20:880>
# Always set these headers.
Header always set Access-Control-Allow-Origin "*"
DocumentRoot /var/www/dashticz_v2
ServerName domoticz.sonnehoek.nl
<Directory "/var/www/dashticz_v2">
allow from all
Options Indexes FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
I can't get it to work. I see you are running Dashticz on your server to?
I do not have that, is that why it does not work?
What I also noticed is that OV works on Firefox on Linux but my tablet does not show OV...
I could live without OV but I really, really like the garbage part. In the short time I used Dashticz, it was my, and my wife's, favorite and most used block.

Re: IMPORTANT REQUEST!!!

Posted: Wednesday 24 October 2018 22:53
by jake
Lokonli wrote: Wednesday 24 October 2018 20:38 ...
Double check you have the correct settings in CONFIG.js:

Code: Select all

config['garbage_company'] = 'deafvalapp';
config['garbage_icalurl'] = '';
config['garbage_calendar_id'] = '';
config['garbage_zipcode'] = '5692VG';
config['garbage_street'] = '0';
config['garbage_housenumber'] = '33';
In my CONFIG.js I disabled all 'garbage' related lines with the '//' Then I simply copied your complete example in there. However no change and still showing the text 'geen gegevens gevonden'


Is there possibly something wrong with my 'afval folder'? I downloaded the ZIP file that Rob shared and this one contained only index.php in the /afval folder.


Shame on me, I copy pasted the string to modify garbage.js
Some smart program changed the '&sub' into a special character, avoiding the complete json to complete. So, garbage works as well. Hurray!

One more thing, I already opened a github request for it, HVC changed their code. It seems that you first need to check your 'bagID', and put that into the next json request to get the pick-up dates. Although it explained in this topic, I wouldn't know how to fix up the Dashticz code.

Re: IMPORTANT REQUEST!!!

Posted: Thursday 25 October 2018 8:07
by Lokonli
jake wrote: Wednesday 24 October 2018 22:53
Lokonli wrote: Wednesday 24 October 2018 20:38 ...
Double check you have the correct settings in CONFIG.js:

Code: Select all

config['garbage_company'] = 'deafvalapp';
config['garbage_icalurl'] = '';
config['garbage_calendar_id'] = '';
config['garbage_zipcode'] = '5692VG';
config['garbage_street'] = '0';
config['garbage_housenumber'] = '33';
In my CONFIG.js I disabled all 'garbage' related lines with the '//' Then I simply copied your complete example in there. However no change and still showing the text 'geen gegevens gevonden'


Is there possibly something wrong with my 'afval folder'? I downloaded the ZIP file that Rob shared and this one contained only index.php in the /afval folder.


Shame on me, I copy pasted the string to modify garbage.js
Some smart program changed the '&sub' into a special character, avoiding the complete json to complete. So, garbage works as well. Hurray!

One more thing, I already opened a github request for it, HVC changed their code. It seems that you first need to check your 'bagID', and put that into the next json request to get the pick-up dates. Although it explained in this topic, I wouldn't know how to fix up the Dashticz code.
HVC is part of 'afvalstromen'. For afvalstromen all code already is implemented, except for HVC. I'll make the fix this weekend.

Re: IMPORTANT REQUEST!!!

Posted: Thursday 25 October 2018 8:30
by poudenes
Hi All,

Almost perfect working. Did everything below. After that reboot Raspberry. Domoticz UP, Apache UP, Dasthicz page load fast. Calendar, TVGuide and Public Transport loads OK.

Only thing i don't have now are the fontawesome icons you can add like:

Code: Select all

icon: 'fa-window-close'
Here steps i did:

Code: Select all

apt-get install apache2 apache2-doc apache2-utils php7.0-zip
apt-get install libapache2-mod-php7.0 php7.0 php7.0-opcache php7.0-mbstring php7.0-mysql php7.0-curl php7.0-gd
apt-get install libapache2-mod-php php-curl
edit Port listen 80 > 82

Code: Select all

nano /etc/apache2/ports.conf

listen 82
edit Virtual Host

Code: Select all

nano /etc/apache2/sites-available/000-default.conf
add

Code: Select all

<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule> 


and change <VirtualHost *: 80> to

Code: Select all

<VirtualHost *: 82>
Create a Symbolic Link into /var/www/html/ because i backup the Domoticz Folder every night. Then everything is save.

Code: Select all

ln -s /home/pi/domoticz/www/dashbeta/ /var/www/html/

Re: IMPORTANT REQUEST!!!

Posted: Thursday 25 October 2018 9:26
by edge
In my situation Domoticz is running at :8080. If I start a new webserver at :8081 where the scripts are 'hosted' I receive a
"No access-control-allow-origin' header is present on the requested resource" within Chrome.

Workaround:
Start Chrome with the following parameters:
chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security

So that's why I would like to host the scripts behind :8080 (at the domoticz port). But when I try to access the scripts I receive a "Domoticz offline" message.

Anyone with this problem?

Edit: I will try what's mentioned here above first! :)

Re: IMPORTANT REQUEST!!!

Posted: Thursday 25 October 2018 9:40
by gielie
robgeerts wrote: Wednesday 24 October 2018 21:15 Wow had to read back a lot and good to see that most off you already have it working again!!
Nope, i cant get it to work.
I started from scratch, installed dashticz in var/www/html (instead of domoticz/www) with all the necessary dependencies.
I also tried to host the files on my synology and redirected to that address but still no luck.

Can someone make a clear tutorial how to change this.

And one question, if i change the icall/garbage file wont this be a problem with the next git pull update?

Re: IMPORTANT REQUEST!!!

Posted: Thursday 25 October 2018 9:41
by poudenes
gielie wrote: Thursday 25 October 2018 9:40
robgeerts wrote: Wednesday 24 October 2018 21:15 Wow had to read back a lot and good to see that most off you already have it working again!!
Nope, i cant get it to work.
I started from scratch, installed dashticz in var/www/html (instead of domoticz/www) with all the necessary dependencies.
I also tried to host the files on my synology and redirected to that address but still no luck.

Can someone make a clear tutorial how to change this.

And one question, if i change the icall/garbage file wont this be a problem with the next git pull update?
See my post 2 up... For me it work now. Only the custom icons part is gone now. But rest is working