Pass2PHP
Moderator: leecollings
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
I do not mean the version of PHP but the version of pass2php.
There's no version number in the files, you have to compare against Github.
There's no version number in the files, you have to compare against Github.
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Egregius wrote:I do not mean the version of PHP but the version of pass2php.
There's no version number in the files, you have to compare against Github.


Sent from my iPhone using Tapatalk
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
You are right! the file is different in many ways.
can I just replace the pass2php file or are there other things I need to do to get it working with the new file?
can I just replace the pass2php file or are there other things I need to do to get it working with the new file?
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Try and you'll see 
I guess you better check the SQL update script to add missing columns and the fetch domoticz file. That one stores the device type in the dt column.

I guess you better check the SQL update script to add missing columns and the fetch domoticz file. That one stores the device type in the dt column.
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Ok, this is going to sound dumb as wellEgregius wrote:Try and you'll see
I guess you better check the SQL update script to add missing columns and the fetch domoticz file. That one stores the device type in the dt column.

Sent from my iPhone using Tapatalk
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
I think I got itTrigun wrote: ↑Wednesday 07 August 2019 16:51Ok, this is going to sound dumb as wellEgregius wrote:Try and you'll see
I guess you better check the SQL update script to add missing columns and the fetch domoticz file. That one stores the device type in the dt column.the sql update script, is is the same as the script which creates the database?
Sent from my iPhone using Tapatalk
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
I think its not just replacing the file since more files have been updated i have to replace those too.Trigun wrote:I think I got itTrigun wrote: ↑Wednesday 07 August 2019 16:51Ok, this is going to sound dumb as wellEgregius wrote:Try and you'll see
I guess you better check the SQL update script to add missing columns and the fetch domoticz file. That one stores the device type in the dt column.the sql update script, is is the same as the script which creates the database?
Sent from my iPhone using Tapatalk
As for now my new _fetchdomoticz doesn’t work as it says my domoticz url is not defined

Sent from my iPhone using Tapatalk
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
after changing all the files and setting the correct rights the following errors are stil there:
if I run the _fetchdomoticz.php script I get the following error:
since I am only using a cron60 and a cron3600 (from the previous setup) it also get the following error.
both errors did not appear with my previous setup. any idea to solve these?
I made an extensive guide for setting up pass2php but I don't remember putting in my domoticz url somewhere as it has always been 'Localhost'
do you have any idea how to solve these?
if I run the _fetchdomoticz.php script I get the following error:
Code: Select all
2019/08/08 10:53:39 [error] 638#638: *2339 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined variable: domoticzurl in /var/www/html/secure/_fetchdomoticz.php on line 14
PHP message: PHP Warning: file_get_contents(/json.htm?type=devices&used=true): failed to open stream: No such file or directory in /var/www/html/secure/_fetchdomoticz.php on line 14" while reading response header from upstream, client: 192.168.1.40, server: _, request: "GET /secure/_fetchdomoticz.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.1.200"
Code: Select all
2019/08/08 10:54:01 [error] 638#638: *2363 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: PIR_Badkamer in /var/www/html/secure/_cron60.php on line 20" while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET /secure/cron.php?cron10&verwarming&rolluiken&cron60&cron120&cron180 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "127.0.0.1"
I made an extensive guide for setting up pass2php but I don't remember putting in my domoticz url somewhere as it has always been 'Localhost'
do you have any idea how to solve these?
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
$domoticzurl has to be set in your config.php file.
There's an example in the secure folder.
I store mine in /var/www so it doesn't get pushed to Github.
There's an example in the secure folder.
I store mine in /var/www so it doesn't get pushed to Github.
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
The second error about PIR_Badkamer means that you're using a name in the cron file that doesn't exists in the database.
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
I know but it’s already in there: 127.0.0.1:8080Egregius wrote:$domoticzurl has to be set in your config.php file.
There's an example in the secure folder.
I store mine in /var/www so it doesn't get pushed to Github.
This should be correct.
I believe the reason for the second error is due the _fetch file not working.
Using my old _fetch file gives the same error.
I think I have to start over to het iT working again
Sent from my iPhone using Tapatalk
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
ok, GOT IT SOLVED!!!
I thought I had this issue before and after scrolling down this topic I found it!
The folowing lines need to be added to the _Fetchdomoticz.php file.
Is there a chance you want to add them to your file as well? ( for future updates
)
I also added this to my pass2php guide. if anyone is interested I attached it
please let me know if anyone thinks I missed something. of course all the credits go Egregius(the majority of the credits
) and Sincze for helping me out and spending time for all my noob questions!
again, thanks guys!
cheers!
I thought I had this issue before and after scrolling down this topic I found it!
The folowing lines need to be added to the _Fetchdomoticz.php file.
Code: Select all
require '/var/www/config.php';
require 'functions.php';

I also added this to my pass2php guide. if anyone is interested I attached it

please let me know if anyone thinks I missed something. of course all the credits go Egregius(the majority of the credits

again, thanks guys!
cheers!
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
My fetchdomoticz is included in my floorplan so I don’t need it
It might be a hard way to learn but this way you also learn how things hang together.

It might be a hard way to learn but this way you also learn how things hang together.
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
you are absolutely right and thats ok

as long as I can ask a few questions so once in a while

so once I got everything working again I updated again to you latest files.
I have a very basic setup compared to yours but my cron files used to work with it.
my cron 60 looks like:
Code: Select all
<?php
lg('this is __cron60 --> a 1 minute Cron');
if ($d['Garageportaal']['s']=='On'&&$d['PIR_Garageportaal']['s']=='Off'&&past('Garageportaal')>60) {
sw('Garageportaal', 'Off');
}
if ($d['Garageportaal']['s']=='On'&&$d['PIR_Garage']['s']=='Off'&&past('Garageportaal')>60) {
sw('Garageportaal', 'Off');
}
if ($d['Berging']['s']=='On'&&$d['PIR_Berging']['s']=='Off'&&past('Berging')>60) {
sw('Berging', 'Off');
}
if ($d['Overloop']['s']=='On'&&$d['Auto']['s']=='Off'&&$d['PIR_Overloop']['s']=='Off'&&past('Overloop')>60) {
sw('Overloop', 'Off');
}
lg('STATUS ==> Badkamer='.$d['Badkamer']['s'].', past='.past('Badkamer'));
if ($d['Badkamer']['s']>=1&&$d['Auto']['s']=='Off'&&past('Badkamer')>60){
sw('Badkamer', 'Off');
}
lg('STATUS ==> BANO_Outdoor-Rain='.$d['BANO_Outdoor-Rain']['s'].', Buienradar_Solar-Radiation='.$d['Buienradar_Solar-Radiation']['s'].', Tuinsproeiers='.$d['Tuinsproeiers']['s']);
if (TIME>=strtotime('T04:00')&&TIME<=strtotime('T07:00')&&$d['BANO_Outdoor-Rain']['s']<1&&$d['Buienradar_Solar-Radiation']['s']<250&&$d['Tuinsproeiers']['s']=='Off') {
sw('Tuinsproeiers', 'On');
}
?>
Code: Select all
2019/08/08 22:24:02 [error] 703#703: *21135 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined variable: d in /var/www/html/secure/_cron60.php on line 6
PHP message: PHP Notice: Undefined variable: d in /var/www/html/secure/_cron60.php on line 10
PHP message: PHP Notice: Undefined variable: d in /var/www/html/secure/_cron60.php on line 14
PHP message: PHP Notice: Undefined variable: d in /var/www/html/secure/_cron60.php on line 18
PHP message: PHP Notice: Undefined variable: d in /var/www/html/secure/_cron60.php on line 22" while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET /secure/cron.php?cron60 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "127.0.0.1"
If I compare the cron60 to yours the difference is too big to see what I need to change

- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
You need line 15 of cron.php:
$d=fetchdata();
$d is now filled with the fetchdata() function. So you can include the functions file without it calling the data everytime.
And you can add multiple $d=fetchdata() lines if you need an updated dataset.
$d=fetchdata();
$d is now filled with the fetchdata() function. So you can include the functions file without it calling the data everytime.
And you can add multiple $d=fetchdata() lines if you need an updated dataset.
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Ok, so just add $d=fetchdata(); to the cron60 file?Egregius wrote:You need line 15 of cron.php:
$d=fetchdata();
$d is now filled with the fetchdata() function. So you can include the functions file without it calling the data everytime.
And you can add multiple $d=fetchdata() lines if you need an updated dataset.
Sorry, but how to put it and where?
Sent from my iPhone using Tapatalk
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
OK, NICE!!! the error is gone!
now I need to get my cron working again.
are there any lines I need to add to the cron file?
now I need to get my cron working again.
are there any lines I need to add to the cron file?
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
You mean in cron60?
Normally not.
$d is fetched in cron.php before including cron60 so $d is available.
Normally not.
$d is fetched in cron.php before including cron60 so $d is available.
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Tge strange thing is that my cron files are actually working now!
the only thing is that I have have multiple LG line in my cron60 file see:
Code: Select all
<?php
lg('this is __cron60 --> a 1 minute Cron');
if ($d['Garageportaal']['s']=='On'&&$d['PIR_Garageportaal']['s']=='Off'&&past('Garageportaal')>60) {
sw('Garageportaal', 'Off');
}
if ($d['Garageportaal']['s']=='On'&&$d['PIR_Garage']['s']=='Off'&&past('Garageportaal')>60) {
sw('Garageportaal', 'Off');
}
if ($d['Berging']['s']=='On'&&$d['PIR_Berging']['s']=='Off'&&past('Berging')>60) {
sw('Berging', 'Off');
}
if ($d['Overloop']['s']=='On'&&$d['Auto']['s']=='Off'&&$d['PIR_Overloop']['s']=='Off'&&past('Overloop')>60) {
sw('Overloop', 'Off');
}
lg('STATUS ==> Badkamer='.$d['Badkamer']['s'].', past='.past('Badkamer'));
if ($d['Badkamer']['s']>=50&&$d['Auto']['s']=='Off'&&past('Badkamer')>60){
sw('Badkamer', 'Off');
}
lg('STATUS ==> BANO_Outdoor-Rain='.$d['BANO_Outdoor-Rain']['s'].', Buienradar_Solar-Radiation='.$d['Buienradar_Solar-Radiation']['s'].', Tuinsproeiers='.$d['Tuinsproeiers']['s']);
if (TIME>=strtotime('T04:00')&&TIME<=strtotime('T07:00')&&$d['BANO_Outdoor-Rain']['s']<1&&$d['Buienradar_Solar-Radiation']['s']<250&&$d['Tuinsproeiers']['s']=='Off') {
sw('Tuinsproeiers', 'On');
}
?>
Who is online
Users browsing this forum: No registered users and 1 guest