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
About the delays:
Where do they happen?
Use tail -f on your logfile, make sure pass2php logs to the same file as domoticz.
Where do they happen?
Use tail -f on your logfile, make sure pass2php logs to the same file as domoticz.
-
- Posts: 483
- Joined: Tuesday 12 August 2014 5:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3_8394
- Location: Rumbeke,Belgium
- Contact:
Re: Pass2PHP
delays are fine now, thank you.
I'm running now on a new install with a ssd hardisk.
I also see you have the files: regenputleeg.php and regenputvol.php
I'm curious how you measure this?
Also how do you now the sunrise and sunset ?
i want to use this as a reference to set my blinds.
thank you
I'm running now on a new install with a ssd hardisk.
I also see you have the files: regenputleeg.php and regenputvol.php
I'm curious how you measure this?

Also how do you now the sunrise and sunset ?
i want to use this as a reference to set my blinds.
thank you
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
I have 2 float sensors in my rain pit (regenput) connected to a Fibaro Universal sensor.
1 at the bottom to indicate he's empty and I need to switch all the water to "city water" (sorry, don't know the exact term for that in English).
1 at about 20% of the top to indicate he's full and I should switch the hot water to rain water because we have plenty.
The only thing they do is an indication on my secondary floorplan and send me a telegram.
Sunrise is scraped in _cron3600 with:
sunrise is stored in $d['civil_twilight']['s'] and sunset in $d['civil_twilight']['m'].
The advantage of sunrise-sunset.org is that they provide different types of them. I use the civil one. For sunrise that means the moment where the sky starts to get lighter but it's actually still dark.
Here's an example result from their site:
Then, in _cron60 I check wether the time is between sunrise and sunset to store it in the mode of my virtual switch 'auto':
Then I use the combinations of $d['auto']['m'] and $d['zon']['s'] to know if it's night, day or that there's actual solar power from the panels.
Domoticz uses the sunrise/sunset values, I prefer the civil ones. I like my blinds to be open so I can enjoy the sunrise instead of sitting in a closed dark house untill it's completely light outside.
For today the difference between this sunrise/sunset and the one in Domoticz is:
1 at the bottom to indicate he's empty and I need to switch all the water to "city water" (sorry, don't know the exact term for that in English).
1 at about 20% of the top to indicate he's full and I should switch the hot water to rain water because we have plenty.
The only thing they do is an indication on my secondary floorplan and send me a telegram.
Sunrise is scraped in _cron3600 with:
Code: Select all
$sunrise=json_decode(
file_get_contents(
'http://api.sunrise-sunset.org/json?lat='
.$lat.'&lng='
.$lon.'&date=today&formatted=0'
),
true
);
if (isset($sunrise['results']['civil_twilight_begin'])) {
if (strtotime($sunrise['results']['civil_twilight_begin'])!=$d['civil_twilight']['s']) {
store('civil_twilight', strtotime($sunrise['results']['civil_twilight_begin']), basename(__FILE__).':'.__LINE__);
}
if (strtotime($sunrise['results']['civil_twilight_end'])!=$d['civil_twilight']['m']) {
storemode('civil_twilight', strtotime($sunrise['results']['civil_twilight_end']), basename(__FILE__).':'.__LINE__);
}
if (TIME>$d['civil_twilight']['s']&&TIME<$d['civil_twilight']['m']) {
$uv=json_decode(
shell_exec(
"curl -X GET 'https://api.openuv.io/api/v1/uv?lat=".$lat."&lng=".$lon."' -H 'x-access-token: ".$openuv."'"
),
true
);
if (isset($uv['result'])) {
if ($uv['result']['uv']!=$d['uv']['s']) {
store('uv', round($uv['result']['uv'], 1), basename(__FILE__).':'.__LINE__);
}
if ($uv['result']['uv_max']!=$d['uv']['m']) {
storemode('uv', round($uv['result']['uv_max'], 1), basename(__FILE__).':'.__LINE__);
}
}
}
}
The advantage of sunrise-sunset.org is that they provide different types of them. I use the civil one. For sunrise that means the moment where the sky starts to get lighter but it's actually still dark.
Here's an example result from their site:
Code: Select all
{
"results":
{
"sunrise":"2019-10-03T05:51:34+00:00",
"sunset":"2019-10-03T17:21:26+00:00",
"solar_noon":"2019-10-03T11:36:30+00:00",
"day_length":41392,
"civil_twilight_begin":"2019-10-03T05:18:52+00:00",
"civil_twilight_end":"2019-10-03T17:54:08+00:00",
"nautical_twilight_begin":"2019-10-03T04:40:40+00:00",
"nautical_twilight_end":"2019-10-03T18:32:20+00:00",
"astronomical_twilight_begin":"2019-10-03T04:01:42+00:00",
"astronomical_twilight_end":"2019-10-03T19:11:18+00:00"
},
"status":"OK"
}
Code: Select all
if (TIME>$d['civil_twilight']['s']&&TIME<$d['civil_twilight']['m']) {
if ($d['auto']['m']!=true) {
storemode('auto', true, basename(__FILE__).':'.__LINE__);
$d['auto']['m']=true;
}
} else {
if ($d['auto']['m']!=false ) {
storemode('auto', false, basename(__FILE__).':'.__LINE__);
$d['auto']['m']=false;
}
}
Domoticz uses the sunrise/sunset values, I prefer the civil ones. I like my blinds to be open so I can enjoy the sunrise instead of sitting in a closed dark house untill it's completely light outside.
For today the difference between this sunrise/sunset and the one in Domoticz is:
- Attachments
-
- civil.png (17.03 KiB) Viewed 1014 times
-
- domoticz.png (12.8 KiB) Viewed 1014 times
-
- Posts: 483
- Joined: Tuesday 12 August 2014 5:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3_8394
- Location: Rumbeke,Belgium
- Contact:
Re: Pass2PHP
thank you mate.
will try to do the same for the regenput
can you give me a type of what kind of flood sensor you used?
Also, the status of 'Weg' and 'auto' ; is this a virtual dummy sensor? (dutch: keuzeschakelaar?)
or is it a user variable (dutch: gebruikersvariabele?)
thank you
will try to do the same for the regenput

can you give me a type of what kind of flood sensor you used?
Also, the status of 'Weg' and 'auto' ; is this a virtual dummy sensor? (dutch: keuzeschakelaar?)
or is it a user variable (dutch: gebruikersvariabele?)
thank you
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
I used these: https://www.conrad.be/p/binsack-11132-b ... uks-701629 connected to a Fibaro universal binary sensor.
'Weg' and 'Auto' are switches only known in pass2php.
I don't use dummy hardware or uservariables in Domoticz. You just need to do a sw command and it's created automatically. The sw function knows that when there's no idx known it doesn't need to send it to domoticz.
So you just do a sw('auto', 'On'); or a sw('Weg', 2);
'Weg' in my case is the global state of the house. 0= home, 1= sleeping, 2=away. That's used to control blinds, heating and alarm.
'Weg' and 'Auto' are switches only known in pass2php.
I don't use dummy hardware or uservariables in Domoticz. You just need to do a sw command and it's created automatically. The sw function knows that when there's no idx known it doesn't need to send it to domoticz.
So you just do a sw('auto', 'On'); or a sw('Weg', 2);
'Weg' in my case is the global state of the house. 0= home, 1= sleeping, 2=away. That's used to control blinds, heating and alarm.
-
- Posts: 483
- Joined: Tuesday 12 August 2014 5:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3_8394
- Location: Rumbeke,Belgium
- Contact:
Re: Pass2PHP
Ok thank you mate for the information, already ordered 2 of these.
About the weg and auto; can you explain how you set/activate them and where?
For example, is weg set to 1 (slapen) when all pir in your house does not see action for lets say 30minutes?
and the rollers, are they allways in automatic mode?
what i've done now is: my rollers are also in automatic mode and they are working to go up on sunrise and down on sunset, but if i switch them manually (with my hardware roller switch) down to for example 25% (because the sun is pointing at the tv) then they are automatically going up again because sunset was not activated
there are ghosts in the house for my kids haha
thank you
About the weg and auto; can you explain how you set/activate them and where?
For example, is weg set to 1 (slapen) when all pir in your house does not see action for lets say 30minutes?
and the rollers, are they allways in automatic mode?
what i've done now is: my rollers are also in automatic mode and they are working to go up on sunrise and down on sunset, but if i switch them manually (with my hardware roller switch) down to for example 25% (because the sun is pointing at the tv) then they are automatically going up again because sunset was not activated

there are ghosts in the house for my kids haha
thank you
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
That's where the modes come in to play.
My rollers only go automatic when for example $d['Rbureel']['m']==0.
When I control any of the rollers by hand, either with a remote control or with the floorplan the mode is set to 1.
Then, in a cron you can check for the last change with the past function to set them back to automatic after 4 hours or something like you want.
My rollers only go automatic when for example $d['Rbureel']['m']==0.
When I control any of the rollers by hand, either with a remote control or with the floorplan the mode is set to 1.
Then, in a cron you can check for the last change with the past function to set them back to automatic after 4 hours or something like you want.
-
- Posts: 483
- Joined: Tuesday 12 August 2014 5:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3_8394
- Location: Rumbeke,Belgium
- Contact:
Re: Pass2PHP
So when you set a roller by hand (hardware switch) , you set the mode for this roller to 1 (manual)
And when is it set back to automatic mode then? by program? or when you set rollers to automatic in your floorplan?
And when is it set back to automatic mode then? by program? or when you set rollers to automatic in your floorplan?
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Hi Robske,ropske wrote:So when you set a roller by hand (hardware switch) , you set the mode for this roller to 1 (manual)
And when is it set back to automatic mode then? by program? or when you set rollers to automatic in your floorplan?
Which rollers do you use?
I am searching my butt off for some good(and cheap) automatically rollers
Sent from my iPhone using Tapatalk
-
- Posts: 483
- Joined: Tuesday 12 August 2014 5:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3_8394
- Location: Rumbeke,Belgium
- Contact:
Re: Pass2PHP
i will need to check on my papers from my windows what type they used.
I didn't install them, i asked them together with my new windows.
I didn't install them, i asked them together with my new windows.
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
My rollers use the cheapest Somfy motor. I explicitly for 3 wire motors without receiver in them so I could connect them to a Fibaro roller shutter switch. They have never had that question and where quite surprised about what I was going to do with them
About the manual switches: I don't have those. I can only control them from domoticz.
The first thing you can add to your automation is a past function. Something like this:
With that, the roller will stay in the same position for 4 hours.

About the manual switches: I don't have those. I can only control them from domoticz.
The first thing you can add to your automation is a past function. Something like this:
Code: Select all
if (past('Rbureel'')>14400&&$d['Rbureel']['s']<100) {
sl('Rbureel', 100);
}
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Everything I do for the rollers is in https://github.com/Egregius/PHP-Floorpl ... luiken.php
It's quite a mess at the moment. I'm totally rewritten it because it was way to complicated before. It used to be more than a thousand lines of code. Now I only have about 150 lines.
It's quite a mess at the moment. I'm totally rewritten it because it was way to complicated before. It used to be more than a thousand lines of code. Now I only have about 150 lines.
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
[/quote]
Please, if you can find the time.
right now I am holding back because the motors to operate it cost as much as new rollers so there is no gain
thanks again!
Please, if you can find the time.
right now I am holding back because the motors to operate it cost as much as new rollers so there is no gain

thanks again!
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Mine are Somfy Ilmo, don't know the type exactly.
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Are they? Don't know, don't look at that 

-
- Posts: 483
- Joined: Tuesday 12 August 2014 5:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3_8394
- Location: Rumbeke,Belgium
- Contact:
Re: Pass2PHP
to save the status of the battery devices, you needed to change the file attributes of: '/domoticz/Config/zwcfg_0xe9238f6e.xml'
?
Mine i called this way.
Because, standard, it has root privileges and it wont save the battery status to the mysql database.
or am i'm doing something wrong?
Thank you
?
Mine i called this way.
Because, standard, it has root privileges and it wont save the battery status to the mysql database.
or am i'm doing something wrong?
Thank you
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Yes, you need to update the name of the Zwave config file.
Mine is owned by root with 644 rights.
There is a glitch in the code tough, think you have to manually enter a line for each battery powered device for the first time. Can't remember, to long ago
Mine is owned by root with 644 rights.
There is a glitch in the code tough, think you have to manually enter a line for each battery powered device for the first time. Can't remember, to long ago

-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Pass2PHP
Hahah compared to the ones IKEA has brought out. They are a bitEgregius wrote:Are they? Don't know, don't look at that

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