Which binding will be good for telephone wifi checking (in Home or Outside).
I search good solution for HABPanel.
Thanks!
Network binding and platform dependant arpping.
Have u some link for tutorial?
Works with S7, note 8&9 and iPhone X
After you have arpping and Network binding installed you will need:
Assignment of fixed IP from MAC (setup in you router) or a device static IP outside of DHCP pool.
.items
Group:Switch:OR(ON, OFF) presenceDevices
Switch Phone1 (lanItems, presenceDevices) { channel = "network:pingdevice:192_168_1_??:online" }
Switch Phone2 (lanItems, presenceDevices) { channel = "network:pingdevice:192_168_1_??:online" }
Switch Phone3 (lanItems, presenceDevices) { channel = "network:pingdevice:192_168_1_??:online" }
Switch anyPhonesPresent
Switch PresenceTimer { expire="12m,command=OFF" } // need expire binding
.rules
rule "Phones Present"
when
Item presenceDevices changed
then
//val name = "PhonesPresent"
//logInfo(name, "presenceDevices = " + presenceDevices.state) // semicolon is not needed
if (presenceDevices.state == ON) { // only use === when one of the operands are null
if (PresenceTimer.state == ON) PresenceTimer.postUpdate(OFF) // Cancel Expire based timer
if (anyPhonesPresent.state != ON) anyPhonesPresent.sendCommand(ON)
}
else {
//logInfo(name, "Setting timer...")
PresenceTimer.sendCommand(ON) // schedule/reschedule Expire based timer
}
end
// Expire timer expired
rule "Presence Timer"
when
Item PresenceTimer received command OFF
then
logInfo("PresenceTimer", "To: present")
anyPhonesPresent.sendCommand(OFF)
end
rule 'anyPhonesPresent'
when
Item anyPhonesPresent changed to OFF
then
logInfo("presence", "anyPhonesPresent.state=" + anyPhonesPresent.state);
vNoPhonesPresent_Time.postUpdate(now.toString)
switch vTimeOfDay.state.toString {
case "MORNING": {
if ((vDayOfWeek.state.toString != "Sunday") && (vDayOfWeek.state.toString != "Saturday")) {
if (HouseGuests.state != ON) {
logInfo("presence", vTimeOfDay.state.toString + " Week day: No phones detected, all OFF")
callScript("allOff")
} else {
logInfo("presence", vTimeOfDay.state.toString + " Week day: but house guests. Do nothing")
}
} else {
logInfo("presence", vTimeOfDay.state.toString + " Weekend: No phones detected, do nothing")
}
}
default: {}
}
end
[19:47:10] root@openHABianPi:/home/openhabian# /usr/sbin/arping -v 192.168.1.133
arping: Autodetected interface eth0
This box: Interface: eth0 IP: 192.168.1.147 MAC address: b8:27:eb:17:87:01
ARPING 192.168.1.133
Timeout
Timeout
Timeout
Timeout
But IPhone is Online hmm…
If iPhone is on sand by, no ping if i unlocked them , is ok hmm
Note it can take up to 12m before one ARP-PING comes through in StandBy. Hence the 12m timer.
This is from an iPhone X:
Graph is this item:
Switch Phone2 (lanItems, presenceDevices) { channel = "network:pingdevice:192_168_1_51:online" }
I need only .items and .rules and everything will be working ??
If your arpping is working this is it, but you will need to tune the timeout rule to what you want to happen when no phones are detected. I just call the script ‘allOff’. I don’t have any action for phonesDiscovered, but that should be trivial. Also my timeout rule is complicated with the houseGuest switch, weekDays Mornings only (06.00 - 10.00).
Modify to suit your needs. Start with just the logging in order to verify operation.
You could also fiddle around with the Network-binding timeout which is currently at 60s and try the get the DHCP monitoring going, but a 12m detection is OK for my use. My son is the last one out in the morning, and he usually forgets to hit the allOff button by the door. When we come home, the motion detector is way faster than WiFi detection.