Trigun wrote:Hahaha sudo crontab -e / elevated userTrigun wrote: Friday 10 May 2019 19:28ok, I think I got it.Trigun wrote: Friday 10 May 2019 19:13 ok, now I know for sure that my cron is not working
because when I manually start the cron.sh script I get the lg line in the domoticz.log
so, back to the cron![]()
2 things - the cron.sh was not executable so I did a chmod 777 to cron.sh
and I found out that I used "sudo crontab -e" instead of crontab -e.
now I see the script is running perfectly every minute![]()
just keeping you all informed as it might help others as wel.
crontab -e .. would be the pi user
Strange that you experience all these things. Well done. Making progress. Weekend just started
Sent from my ONEPLUS A6003 using Tapatalk
Pass2PHP
Moderator: leecollings
- 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
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.
-
Trigun
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
sincze wrote: Friday 10 May 2019 20:00Trigun wrote:he guys just found out that when I have the following code in _cron60, the auto off for just Bijkeuken does not work.but when I leave "&&$d['PIR-Bijkeuken']['s']=='Off'" out of the code, it does work.Code: Select all
<?php lg('this is __cron60'); if ($d['Bijkeuken']['s']=='On'&&$d['PIR-Bijkeuken']['s']=='Off'&&past('Bijkeuken')>60) { sw('Bijkeuken', 'Off'); } if ($d['Garageportaal']['s']=='On'&&$d['PIR-Garageportaal']['s']=='Off'&&past('Garageportaal')>60) { sw('Garageportaal', 'Off'); } ?>
I checked the code with php codecheckes but everything seems fine.
don't know where this goes wrong
-
Trigun
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Trigun wrote: Friday 10 May 2019 22:17sincze wrote: Friday 10 May 2019 20:00Trigun wrote:
he guys just found out that when I have the following code in _cron60, the auto off for just Bijkeuken does not work.but when I leave "&&$d['PIR-Bijkeuken']['s']=='Off'" out of the code, it does work.Code: Select all
<?php lg('this is __cron60'); if ($d['Bijkeuken']['s']=='On'&&$d['PIR-Bijkeuken']['s']=='Off'&&past('Bijkeuken')>60) { sw('Bijkeuken', 'Off'); } if ($d['Garageportaal']['s']=='On'&&$d['PIR-Garageportaal']['s']=='Off'&&past('Garageportaal')>60) { sw('Garageportaal', 'Off'); } ?>
I checked the code with php codecheckes but everything seems fine.
and for Garageportaal it works fine
don't know where this goes wrong
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Check the status and name of the pir in the devices table. If that's the question, hard to find the new posts in all these quotes.
-
Trigun
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
I triple checked the device name but there is no difference.
I did change the cron.sh file as I didn't need most of the lines(so I thought), see attached. so basically when I keep the
Code: Select all
&&$d['PIR-Bijkeuken']['s']=='Off' this is a mystery to me.
-
Trigun
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Hi Guys,
just wanted to let you know that I got both Garageportaal and Bijkeuken working.
I guess there was something in the devicenames that was wrong so I renamed Bijkeuken to Berging and it all works amazing!
Thank you for all you efforts in helping me out with this issue!
just wanted to let you know that I got both Garageportaal and Bijkeuken working.
I guess there was something in the devicenames that was wrong so I renamed Bijkeuken to Berging and it all works amazing!
Thank you for all you efforts in helping me out with this issue!
- 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
hahaha
you figured it out nice!
I always copy the name from domoticz directly, in case of a missing " " (space) or something.
Just updated my install to the described cron.php and now all is working without cache
Also rewrote the crontab to use the /usr/bin/nice functionality/
I use a bit of a different directory stucture but that does not matter.
Did not find out where in his code @egregius did hide the calling of _cron300.php (the 5 minute cron).
I always copy the name from domoticz directly, in case of a missing " " (space) or something.
Just updated my install to the described cron.php and now all is working without cache
Also rewrote the crontab to use the /usr/bin/nice functionality/
Code: Select all
# Check if Domoticz is still running else restart
# */1 * * * * root /home/pi/domoticz/scripts/system/domoticzmonitor.sh >/dev/null 2>&1 # Monitor if Domoticz is still running
* * * * * root /usr/bin/nice -n20 /home/pi/domoticz/scripts/system/domoticzmonitor.sh >/dev/null 2>&1 # Monitor if Domoticz is still running
*/2 * * * * root /usr/bin/nice -n20 curl -s "http://127.0.0.1/secure/pass2php_include/cron.php?cron120" >/dev/null 2>&1
0 * * * * root /usr/bin/nice -n20 curl -s "http://127.0.0.1/secure/pass2php_include/cron.php?cron3600" >/dev/null 2>&1Did not find out where in his code @egregius did hide the calling of _cron300.php (the 5 minute cron).
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.
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Cron300 is called the same way as cron120 but then with */5
Only cron10 and cron60 are called from within the cron.sh script.
Only cron10 and cron60 are called from within the cron.sh script.
- 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
Yeah thought so as well.
Check:
https://github.com/Egregius/PHP-Floorpl ... re/cron.sh
The example of the crontab in the first few lines may be a bit 'misleading' for the new guys as the /5 is missing
Check:
https://github.com/Egregius/PHP-Floorpl ... re/cron.sh
The example of the crontab in the first few lines may be a bit 'misleading' for the new guys as the /5 is missing
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.
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
I just added those yesterday...
And new guys have to search and learn a bit so they understand the concept.
And new guys have to search and learn a bit so they understand the concept.
- 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
Egregius wrote:I just added those yesterday...
And new guys have to search and learn a bit so they understand the concept.

Yes with the concept in mind it is indeed easier to figure out what goes wrong and why. It just came to my attention.
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.
-
Trigun
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Hi Guys,
still fiddling around with PHP, its getting better and better.
perhaps you can explain to me why the following script is doing exactly the opposite.
If I switch Woonkamer On, nothing happens. If I switch Woonkamer off, everything the items are going On 
still fiddling around with PHP, its getting better and better.
perhaps you can explain to me why the following script is doing exactly the opposite.
Code: Select all
<?php
$items=array('Dimmer-Woonkamer-Achter','Dimmer-Woonkamer-Voor','Dimmer-Woonkamer-TV' );
foreach ($items as $item)
if ($d['Woonkamer']['s']=='On') {
sw($item, 'On');
}
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Is this a device script or a cron script?
If it's a device script I would change $d['Woonkamer']['s'] to $status because $d holds the previous status, not the new one.
If it's a device script I would change $d['Woonkamer']['s'] to $status because $d holds the previous status, not the new one.
Code: Select all
<?php
if ($status=='On') {
$items=array('Dimmer-Woonkamer-Achter','Dimmer-Woonkamer-Voor','Dimmer-Woonkamer-TV' );
foreach ($items as $item) {
sw($item, 'On');
}
}-
Trigun
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Works like a charm, thanks a lot!
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
I'm working on the floorplan to use Ajax instead of just refreshing the whole page.
Before I just did a reload of the page every 3 seconds resulting in 6,7KB each 3 seconds. That's 137KB per minute.
Now the basic stuff is loaded initially and other stuff is fetched 4 times every second (250 msec) resulting in a realtime view of the home with less data. That's done with just 64KB.
Of course when on mobile internet I set the refresh 'slower' to once every second, then there's only 16KB of data needed.
The javascript must be expanded a lot, for now switches, dimmers, thermometers, pirs and contacts are in realtime. Will continue with the other stuff
Before I just did a reload of the page every 3 seconds resulting in 6,7KB each 3 seconds. That's 137KB per minute.
Now the basic stuff is loaded initially and other stuff is fetched 4 times every second (250 msec) resulting in a realtime view of the home with less data. That's done with just 64KB.
Of course when on mobile internet I set the refresh 'slower' to once every second, then there's only 16KB of data needed.
The javascript must be expanded a lot, for now switches, dimmers, thermometers, pirs and contacts are in realtime. Will continue with the other stuff
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Almost finished. And damn, it's fast
When I enter a room with a motion sensor, watching the floorplan, I see the light earlier on the floorplan than in reality. I like it
When I enter a room with a motion sensor, watching the floorplan, I see the light earlier on the floorplan than in reality. I like it
-
Trigun
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Hi all,
please pay attention when installing phpmyadmin with apt-get install phpmyadmin.
when doing so, it will also install apache2 as it is one of the recommendations.
of course this is not a problem when you want to use apache but when you have also installed NginX you have two webservers enabled.
please use sudo apt-get --no-install-recommends install phpmyadmin
with this method you can use NginX as being the main webserver.
please pay attention when installing phpmyadmin with apt-get install phpmyadmin.
when doing so, it will also install apache2 as it is one of the recommendations.
of course this is not a problem when you want to use apache but when you have also installed NginX you have two webservers enabled.
please use sudo apt-get --no-install-recommends install phpmyadmin
with this method you can use NginX as being the main webserver.
- 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
Friend of mine has a GoodWe inverter and wanted me to monitor his 32 panels.
Had to create a Pass2PHP solution ofcourse
btw.. it can be used by non Pass2PHP users, but with PHP.
https://github.com/sincze/Domoticz/blob ... Goodwe.php
Had to create a Pass2PHP solution ofcourse
https://github.com/sincze/Domoticz/blob ... Goodwe.php
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.
-
Trigun
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Hi Sincze,
What does it do?
I have a goodwe inverter as well and am curious

Sent from my iPhone using Tapatalk
Who is online
Users browsing this forum: No registered users and 1 guest
