Pass2PHP

User avatar
Egregius
Posts: 2677
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: Pass2PHP

Post by Egregius » Wednesday 23 May 2018 9:10

Lol, seems I have superfast disks :lol:
Image

User avatar
sincze
Posts: 927
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 3.8875
Location: Netherlands
Contact:

Re: Pass2PHP

Post by sincze » Wednesday 23 May 2018 20:55

A well, because we now can :D read the usage of a Unifi AP-AC-LR :D
Unifi_SNMP_1.JPG
Unifi_SNMP_1.JPG (43.7 KiB) Viewed 480 times
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

gimic
Posts: 11
Joined: Thursday 04 January 2018 9:43
Target OS: Linux
Domoticz version: 3.66
Location: Roeselare, Wvl, BE
Contact:

Re: Pass2PHP

Post by gimic » Tuesday 19 June 2018 22:21

Is it normal that when no events ocure that the _cron60.php is not executed every 60 seconds? or am i missing something?

Tnx

User avatar
Egregius
Posts: 2677
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: Pass2PHP

Post by Egregius » Tuesday 19 June 2018 23:36

If you don't trigger the script by cron yes. If you have lot's of devices it gets triggered automatically.
I shall post my cron script tomorrow, or it could be on github.

gimic
Posts: 11
Joined: Thursday 04 January 2018 9:43
Target OS: Linux
Domoticz version: 3.66
Location: Roeselare, Wvl, BE
Contact:

Re: Pass2PHP

Post by gimic » Wednesday 20 June 2018 13:27

ok, tnx there is a cron.sh file on git but i don't think that that is the file i need.

User avatar
Egregius
Posts: 2677
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: Pass2PHP

Post by Egregius » Wednesday 20 June 2018 14:56

That's the one ;)
https://github.com/Egregius/LUA-Pass2PH ... re/cron.sh

You can adjust the sleeps in it and remove lines as needed.
Add it to cron with sudo crontab -e
* * * * * /path/to/script/cron.sh

The script will also check if domoticz is still online and reboot if needed.

gimic
Posts: 11
Joined: Thursday 04 January 2018 9:43
Target OS: Linux
Domoticz version: 3.66
Location: Roeselare, Wvl, BE
Contact:

Re: Pass2PHP

Post by gimic » Wednesday 20 June 2018 19:58

Works, needed also jq package installed ;-)

User avatar
Egregius
Posts: 2677
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: Pass2PHP

Post by Egregius » Wednesday 20 June 2018 20:20

Great!
Enjoy pass2php ;)

gimic
Posts: 11
Joined: Thursday 04 January 2018 9:43
Target OS: Linux
Domoticz version: 3.66
Location: Roeselare, Wvl, BE
Contact:

Re: Pass2PHP

Post by gimic » Thursday 21 June 2018 22:37

Do you have an example or an idea how i can create a button with following function
First time pressed: change status of blinds to ON
Second time pressed: change status of blinds to Stop
Third time pressed: change status of blinds to Off
Fourth time pressed: change status of blinds to Stop
Fifth time pressed: change status of blinds to On
etc...
how can i remember in php the blinds two steps in history so i know if it is stopped i need to do On or Off the next time it is activated?

User avatar
Egregius
Posts: 2677
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: Pass2PHP

Post by Egregius » Friday 22 June 2018 15:51

You want ON - STOP - OFF - STOP - ON - STOP - OFF - ...?
No matter what the current status of the blinds is?
And it's a button that acts independently from the blinds? I mean, without script the blinds don't respond to the button?

gimic
Posts: 11
Joined: Thursday 04 January 2018 9:43
Target OS: Linux
Domoticz version: 3.66
Location: Roeselare, Wvl, BE
Contact:

Re: Pass2PHP

Post by gimic » Friday 22 June 2018 16:57

yes ON - STOP - OFF - STOP - ON - STOP - OFF - ...?
the stop would only be needed the time it takes to get the blinds up or down, but maybe that i can figure out myself, the main problem is how do i know when i have status Stop, the next push will be On or Off?

The last question i don't understand.

User avatar
Egregius
Posts: 2677
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: Pass2PHP

Post by Egregius » Friday 22 June 2018 17:48

I think I would do something like this:

Code: Select all

<?php
if($status=='On'){
	$pushbutton=apcu_fetch('pushbutton');
	if($pushbutton=='on'){
		//do stop action
		apcu_store('pushbutton','onstop');
	}elseif($pushbutton=='onstop'){
		//do off action
		apcu_store('pushbutton','off');
	}elseif($pushbutton=='off'){
		//do stop action
		apcu_store('pushbutton','offstop');
	}elseif($pushbutton=='offstop'){
		//do on action
		apcu_store('pushbutton','on');
	}
}
Use a cache where you set the last action, write that cache after each action with another value. I used onstop and offstop so you know wich stop action it was.

gimic
Posts: 11
Joined: Thursday 04 January 2018 9:43
Target OS: Linux
Domoticz version: 3.66
Location: Roeselare, Wvl, BE
Contact:

Re: Pass2PHP

Post by gimic » Saturday 23 June 2018 21:19

Tnx, since i don't know php (yet) i did not know the function to store variables the last in memory. i'l try it next week!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest