Help setting up rule presence/gpio/

Hi, the installation of my raspberry pi + openhab was a success
Now I am searching for hours and cant find the next step.
could someone please help me with this first project:
-Opening/closing the roll-down-curtains for ‘at-home’-simulation when away-

I installed openhab and habmin and the bindings
-network health
-gpio
-astro
fyi: The rolldowncurtain is now installed on a Eltako EGS12Z-UC
(which is working with a double switch, one up/second down)

I want to give a short pulse on a gpio pin (gpio binding) of the raspberry pi if its dark outside (astro binding) and none of the phones are in the house (nethwork health)
And a second gpio pin should be triggered if its getting light outside and no phones are in the home.

I found this script for detecting the phones:
github link
but where do I write this code?

and how do I use habmin for setting this complete rule,
or do you guys advice not to use habmin?

thx in advance!

I recommend reviewing the wiki pages to understand how Items, Rules, and the Sitemap work together. As the example describes, the first code block goes in an Items file and the second block goes in a rules file.

ok, tried to install openhab-designer

  • installs on windows : but no connection to raspberry pi where my runtime is
  • installed on raspberry (as explained in getting-started) but won’t run:

pi@raspberrypi:/opt/openHAB-designer $ dir
addons epl-v10.html notice.html p2
artifacts.xml features openHAB-Designer plugins
configuration libcairo-swt.so openHAB-Designer.ini readme
pi@raspberrypi:/opt/openHAB-designer $ openHAB-Designer
-bash: openHAB-Designer: opdracht niet gevonden

Hi,
I could only try to help you with your setup if you use an editor to write/mofify your items-, rules- and sitemap files.
That is:
create a file “your.items” in the openhab directory “…/openhab/configurations/items” and
paste the text segment from the wiki in such that it looks like this:

Group gMobiles
Switch Presence
Switch phone1 (gMobiles) {nh=“android-xxxxx”}
Switch phone2 (gMobiles) {nh=“android-yyyyy”}

create a file “your.rules” in the openhab directory “…/openhab/configurations/rules” and
paste the text segment from the wiki in such that it looks like this:

rule "Periodically check presence"
when
Time cron "0 */5 * * * ?"
then
if (Presence.state == ON)
{

.
.
.
eck", “Somebody is home”)
sendCommand(Presence, ON)
}
}
end

create a file “your.sitemap” in the openhab directory “…/openhab/configurations/sitemaps” and
write the following text such that it looks like this:

“sitemap default label=“your”
{
Switch item=Presence
}”

Then check with the UI and the logs if everything is working. Switch is changing depending if your phone is logged in via wifi or not (I used the flight-mode in my phone to check).

Cheers
Björn
PS: Don’t forget to configure your openhab.cfg and to add the addons in the addons folder.

if i’m right I need to replace xxxxx and yyyyy by the phones device name (the long number)

trying to find-out what went wrong, I see the item but the switch isn’t switched on at one’s presence

Try
"Switch phone1 (gMobiles) {nh=“192.168.1.xxx”}"
Replace 192.168.1.xxx with the IP of your device (you need to make it static).
Check.
Do you see any errors in your log?

-edit-
It seems there was an error in my log about an rollershutter-item, for now deleted all rollershutter-stuff
and phones are detected.
-edit-

it’s now checking both our phones ip but something weird happens,
sometimes one is detected, sometimes both or none?

M of D is the rule
Maarten/Davina Thuis are the phones separately

Hi,
do you have iphones?

Nope, both android
Detection & rule work perfect.
Seems to work perfect now, thx!

Next thing Im trying is the gpiopin.
First following a tutorial on


Op 21 feb. 2016 2:00 p.m. schreef “Björn” bot@community.openhab.org:

Anybody who knows how to wait to perform an action after a switch has been set to on/off?

I want to send
sendCommand(Gpio24,OFF)
1 second after
sendCommand(Gpio24,ON)
was triggered

sendCommand(Gpio24,OFF)
Thread::sleep(1000)
sendCommand(Gpio24,ON)