no nothing....
Pass2PHP
Moderator: leecollings
-
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Pass2PHP
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
I don't understand...
Values in mysql table are updated, that means that pass2php is working.
If the lg function doesn't work it either doesn't have rights to the logfile or the parameters are wrong. In any way the apache or php logfile should show the errors.
Values in mysql table are updated, that means that pass2php is working.
If the lg function doesn't work it either doesn't have rights to the logfile or the parameters are wrong. In any way the apache or php logfile should show the errors.
-
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Pass2PHP
all .php files have root:rootEgregius wrote: ↑Saturday 04 May 2019 12:36 I don't understand...
Values in mysql table are updated, that means that pass2php is working.
If the lg function doesn't work it either doesn't have rights to the logfile or the parameters are wrong. In any way the apache or php logfile should show the errors.
Code: Select all
[code]127.0.1.1:80 127.0.0.1 - - [04/May/2019:12:59:38 +0200] "POST /secure/pass2php.php HTTP/1.1" 200 163 "-" "curl/7.52.1"
127.0.1.1:80 127.0.0.1 - - [04/May/2019:12:59:38 +0200] "POST /secure/pass2php.php HTTP/1.1" 200 149 "-" "curl/7.52.1"
127.0.1.1:80 127.0.0.1 - - [04/May/2019:12:59:38 +0200] "POST /secure/pass2php.php HTTP/1.1" 200 163 "-" "curl/7.52.1"
Code: Select all
-rwxrwxrwx 1 root root 318951 mei 4 13:03 domoticz.log
Code: Select all
php _fetchdomoticz.php
When I switch for example Switch-Hall-MEEK I see that its updated in dB as well On states on and Off states off in dB
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
-
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Pass2PHP
im now goto my work...
no testing for some hours...




RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
He Guys,
since I am still a bit of php noob, perhaps you guys are willing to help me out with a fairly simple test setup.
I have a motion sensor called "PIR-Bijkeuken" that needs to switch a light called "Bijkeuken" on and off.
I created a php file called: "PIR-Bijkeuken.php"
I entered the following code:
as for now the switch is not working what am I doing wrong?
I would like the domoticz log file to show if the light is triggered(on and off) and I want the light to go out after 1 minute.
thanks in advance!
since I am still a bit of php noob, perhaps you guys are willing to help me out with a fairly simple test setup.
I have a motion sensor called "PIR-Bijkeuken" that needs to switch a light called "Bijkeuken" on and off.
I created a php file called: "PIR-Bijkeuken.php"
I entered the following code:
Code: Select all
<?php
if($status=='On'){
sw('Bijkeuken','On');
I would like the domoticz log file to show if the light is triggered(on and off) and I want the light to go out after 1 minute.
thanks in advance!
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Test that apache can write to the logfile, and that the path to the logfile is correct in the lg function.
Add a lg(‘test’); line at the end of pass2php.
If the test is logged (remember to use tail to watch the logfile, not the domoticz gui).
Move the lg test line inside the device script.
Once that is working move the lg test line inside the if status is on brackets.
Or add diferent lg lines so you can see in the logfile where the script gets.
Add a lg(‘test’); line at the end of pass2php.
If the test is logged (remember to use tail to watch the logfile, not the domoticz gui).
Move the lg test line inside the device script.
Once that is working move the lg test line inside the if status is on brackets.
Or add diferent lg lines so you can see in the logfile where the script gets.
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
ok, this sounds odd bu there is no domoticz.log in /var/logEgregius wrote: ↑Saturday 04 May 2019 13:57 Test that apache can write to the logfile, and that the path to the logfile is correct in the lg function.
Add a lg(‘test’); line at the end of pass2php.
If the test is logged (remember to use tail to watch the logfile, not the domoticz gui).
Move the lg test line inside the device script.
Once that is working move the lg test line inside the if status is on brackets.
Or add diferent lg lines so you can see in the logfile where the script gets.

- sincze
- Posts: 1302
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
Seems like a 'rights" issue. As _fetch is working just add an lg('test'); in there and look at Apache log as well.. tail -f ****Apache.logTrigun wrote:ok, this sounds odd bu there is no domoticz.log in /var/logEgregius wrote: ↑Saturday 04 May 2019 13:57 Test that apache can write to the logfile, and that the path to the logfile is correct in the lg function.
Add a lg(‘test’); line at the end of pass2php.
If the test is logged (remember to use tail to watch the logfile, not the domoticz gui).
Move the lg test line inside the device script.
Once that is working move the lg test line inside the if status is on brackets.
Or add diferent lg lines so you can see in the logfile where the script gets.
Sent from my ONEPLUS A6003 using Tapatalk
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
ok, i did a full search with winscp but no apache.log or domoticz.log is foundsincze wrote: ↑Saturday 04 May 2019 21:08Seems like a 'rights" issue. As _fetch is working just add an lg('test'); in there and look at Apache log as well.. tail -f ****Apache.logTrigun wrote:ok, this sounds odd bu there is no domoticz.log in /var/logEgregius wrote: ↑Saturday 04 May 2019 13:57 Test that apache can write to the logfile, and that the path to the logfile is correct in the lg function.
Add a lg(‘test’); line at the end of pass2php.
If the test is logged (remember to use tail to watch the logfile, not the domoticz gui).
Move the lg test line inside the device script.
Once that is working move the lg test line inside the if status is on brackets.
Or add diferent lg lines so you can see in the logfile where the script gets.
Sent from my ONEPLUS A6003 using Tapatalk
i guess im doing something wrong?
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
- Attachments
-
- 2019-05-04 21_54_59-_var_www_html_secure_pass2php.php - Domoticz-NEW! - Editor - WinSCP.png (4.03 KiB) Viewed 725 times
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
could it be that /etc/init.d/domoticz.txt is the correct logfile?
- sincze
- Posts: 1302
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
Normally Apache should have some logging.Trigun wrote:could it be that /etc/init.d/domoticz.txt is the correct logfile?
/var/log/apache2/access.log
/var/log/apache2/error.log
Is Apache running??
The lg command now in @egregiius code create a separate logfile. I modified it a bit so it shows up in the Domoticz log

Sent from my ONEPLUS A6003 using Tapatalk
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
yess I got something and it does show some errorssincze wrote: ↑Saturday 04 May 2019 22:20Normally Apache should have some logging.Trigun wrote:could it be that /etc/init.d/domoticz.txt is the correct logfile?
/var/log/apache2/access.log
/var/log/apache2/error.log
Is Apache running??
The lg command now in @egregiius code create a separate logfile. I modified it a bit so it shows up in the Domoticz log
Sent from my ONEPLUS A6003 using Tapatalk
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
ok, i did a chmod 777 on /var/log. now the error is gone.Trigun wrote: ↑Saturday 04 May 2019 22:22yess I got something and it does show some errorssincze wrote: ↑Saturday 04 May 2019 22:20Normally Apache should have some logging.Trigun wrote:could it be that /etc/init.d/domoticz.txt is the correct logfile?
/var/log/apache2/access.log
/var/log/apache2/error.log
Is Apache running??
The lg command now in @egregiius code create a separate logfile. I modified it a bit so it shows up in the Domoticz log
Sent from my ONEPLUS A6003 using Tapatalk
2019-05-04 22_20_00-_var_log_apache2_error.log - Domoticz-NEW! - Editor - WinSCP.png
i did a tail -f on the apache error log
since i set a lg (‘test’) on the pass2php.php file i can the test line in the apache log
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
now when I trigger the motion sensor i get the following error. apperantly something is wrong with the scriptTrigun wrote: ↑Saturday 04 May 2019 22:39ok, i did a chmod 777 on /var/log. now the error is gone.Trigun wrote: ↑Saturday 04 May 2019 22:22yess I got something and it does show some errorssincze wrote: ↑Saturday 04 May 2019 22:20 Normally Apache should have some logging.
/var/log/apache2/access.log
/var/log/apache2/error.log
Is Apache running??
The lg command now in @egregiius code create a separate logfile. I modified it a bit so it shows up in the Domoticz log
Sent from my ONEPLUS A6003 using Tapatalk
2019-05-04 22_20_00-_var_log_apache2_error.log - Domoticz-NEW! - Editor - WinSCP.png
i did a tail -f on the apache error log
since i set a lg (‘test’) on the pass2php.php file i can the test line in the apache log

-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Trigun wrote:now when I trigger the motion sensor i get the error that something is wrong in line 3 apperantly something is wrong with the scriptbut I dont know what?
Sent from my iPhone using Tapatalk
- sincze
- Posts: 1302
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
You are missing a closing bracket } in your script
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- sincze
- Posts: 1302
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
This website can check your php code and save you a lot of trouble
https://phpcodechecker.com
Sent from my ONEPLUS A6003 using Tapatalk
https://phpcodechecker.com
Sent from my ONEPLUS A6003 using Tapatalk
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Whaaaa great it works!!!sincze wrote:This website can check your php code and save you a lot of trouble
https://phpcodechecker.com
Sent from my ONEPLUS A6003 using Tapatalk
The light went on

Can you tell me it works to make the light go out automatically?
This was done via a cronjob?
Verzonden vanaf mijn iPad met Tapatalk
- sincze
- Posts: 1302
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
please have a look on the example files e.g. _cron60.php
Look for an example with function past(60) in it.
And issue the sw function but now off.
Dit you implement cron.sh the Domoticz monitor and also used for pass2php crons??
Look for an example with function past(60) in it.
And issue the sw function but now off.

Dit you implement cron.sh the Domoticz monitor and also used for pass2php crons??
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Who is online
Users browsing this forum: No registered users and 1 guest