Page 55 of 76

Re: Pass2PHP

Posted: Wednesday 02 October 2019 5:51
by Egregius
About the delays:
Where do they happen?
Use tail -f on your logfile, make sure pass2php logs to the same file as domoticz.

Re: Pass2PHP

Posted: Wednesday 02 October 2019 21:41
by ropske
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

Re: Pass2PHP

Posted: Thursday 03 October 2019 6:50
by Egregius
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:

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__);
            }
        }
    }
}
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:

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"
}
Then, in _cron60 I check wether the time is between sunrise and sunset to store it in the mode of my virtual switch 'auto':

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;
    }
}
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:

Re: Pass2PHP

Posted: Monday 07 October 2019 22:01
by ropske
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

Re: Pass2PHP

Posted: Tuesday 08 October 2019 7:12
by Egregius
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.

Re: Pass2PHP

Posted: Tuesday 08 October 2019 21:55
by ropske
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 :lol:

there are ghosts in the house for my kids haha

thank you

Re: Pass2PHP

Posted: Wednesday 09 October 2019 7:38
by Egregius
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.

Re: Pass2PHP

Posted: Wednesday 09 October 2019 10:36
by ropske
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?

Re: Pass2PHP

Posted: Wednesday 09 October 2019 16:06
by Trigun
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?
Hi Robske,

Which rollers do you use?
I am searching my butt off for some good(and cheap) automatically rollers


Sent from my iPhone using Tapatalk

Re: Pass2PHP

Posted: Wednesday 09 October 2019 16:56
by ropske
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.

Re: Pass2PHP

Posted: Thursday 10 October 2019 6:47
by Egregius
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 :lol:

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);
}
With that, the roller will stay in the same position for 4 hours.

Re: Pass2PHP

Posted: Thursday 10 October 2019 6:51
by Egregius
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.

Re: Pass2PHP

Posted: Thursday 10 October 2019 10:12
by Trigun
[/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!

Re: Pass2PHP

Posted: Thursday 10 October 2019 10:14
by Trigun
Egregius wrote: Thursday 10 October 2019 6:47
Is there a chance you can share wich motor you are using?
In my case, I have venetian shutters and I only want them to tilt whenever the sun is shining through my windows. that means it doesn't have to be a heavy weight motor.

thanks again!

Re: Pass2PHP

Posted: Thursday 10 October 2019 10:53
by Egregius
Mine are Somfy Ilmo, don't know the type exactly.

Re: Pass2PHP

Posted: Friday 11 October 2019 13:05
by Trigun
Egregius wrote: Thursday 10 October 2019 10:53 Mine are Somfy Ilmo, don't know the type exactly.
wow! those are expensive as well! :(

Re: Pass2PHP

Posted: Friday 11 October 2019 16:29
by Egregius
Are they? Don't know, don't look at that :lol:

Re: Pass2PHP

Posted: Monday 14 October 2019 20:16
by ropske
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

Re: Pass2PHP

Posted: Tuesday 15 October 2019 6:54
by Egregius
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 :lol:

Re: Pass2PHP

Posted: Tuesday 15 October 2019 10:07
by Trigun
Egregius wrote:Are they? Don't know, don't look at that :lol:
Hahah compared to the ones IKEA has brought out. They are a bitImage


Sent from my iPhone using Tapatalk