Can someone set me straight on network bindings?

(Lee Mueller) #1

I feel that I need to preface this, I am new to openhab, home automation, linux and asking questions in forums. This being said, if I have posted this in the wrong place, I apologize.

I have jumped into a home automation project and have successfully turned a SONOFF into box fan controller which turns itself on and off. Kind of a big deal for me being brand new to all of this.

For my next project I want to do some presence detection to control a front door lock. I have installed the network binding and have been following the tutorial here:

When I try to detect my phone from the paperui, nothing is found, not a single ip address on the network.
I have looked around and found many different answers, such as: add the manually, keep trying with the appropriate wifi settings on my phone and even the network binding is broken do to a bug carry over form 2.3. (Oh I am running 2.4).

So my question is, what is up? Is the binding really broken? If someone would be willing to teach me what is going, point me to info I have not or even just throw a little guidance my way so that I can keep moving I would greatly appreciate it.

Thanks

0 Likes

(Kris K) #2

Is your phone pingable from a PC on your network? Is your OpenHab server on the same network as that PC and your Phone?

If its all on the same network, you should see items inside the PaperUI Inbox with Network Binding devices that have been found.

Have you also set the Primary Address in PaperUI under SYSTEM for your network?

More information is available here:

0 Likes

(Rich Koshak) #3

@muellercandd, the Network binding in general is working, but this one part of the binding is currently broken. The scan Kris describes would normally work but I believe it has been broken at least between OH version 2.4 release and 2.5 Milestone 1.

So when you say

I’m assuming you are doing a scan from the Inbox. And unfortunately that part is the broken part.

You can create the Thing manually though. Go to the Inbox, click the + and choose Network from the list. Fill out all the appropriate information. NOTE: You will want to configure your router to always give your phone the same IP address, or configure your phone with a static IP address.

0 Likes

(Lee Mueller) #4

Thank you for the replies. So yes I am doing a scan from the inbox and not finding anything. I just pinged my phone from my pc and it works.I have also set my network in openhab be the same as my raspberry pi’s ip address that is running openhab, is that what was meant by :

Have you also set the Primary Address in PaperUI under SYSTEM for your network?

So plan to try and enter this manually but would like some clarification first;

Name: I can make this what ever I would like, correct?

Thing ID: this has already been populated, do I need to change it, should I change it, does it need to be different than the Name?

Location: Is this the static IP I have set for my phone?

Host name or IP: It would seem redundant to have my phones IP address twice so I am guessing one of these most be different?

Do I need to or should I change anything under the configuration parameters?

0 Likes

(anonymous.one) #5

I try to keep names and thingIDs consistent in my setup (everyone has their own preferences), I like to know if its phoneA vs phoneB from troubleshooting I know which thing I’m troubleshooting.

Location is used for other purposes within OH, I’ve never filled that field out for my things.

I suggest IP address for the time being, until you get more hands on experience with OH & Linux you are taking a large leap into a pool and I applaud your enthusiastic approach! :wink:

0 Likes

(Rich Koshak) #6

Yes, but try to use meaningful names.

I do recommend changing it. Again, use something meaningful. It does not need to be different from the Name.

No, this will control where the Thing will appear in the Control tab in PaperUI. Honestly, I just ignore it. It really isn’t meaningful outside of PaperUI and the Control tab in PaperUI isn’t all that useful.

Here is where you put the IP or hostname.

Only if you want to change how often it pings the phone or stuff like that. You can always come back and change those parameters later.

0 Likes

(Lee Mueller) #7

Thank you for all of you help. I have been able to add my and phone see it in the paperui. When my phone is connected to the the wifi a slider turns to the “ON” position, when it is not connected the slider turns to “OFF”. I would say it is work the way it should. Now I just need to determine how I want to wright my rules.

I just wanted to add, in case someone else looks at this. The Things ID, does like to have spaces in it. Maybe this is coding 101 but it took bit to figure that one out. I kept getting an error every time I had a space in it.

Thanks again

0 Likes

(Rich Koshak) #8

Start here:

0 Likes

(Lee Mueller) #9

Ok, between work, school and the kids, this got put on the back burner. I have tinkered with this for a little bit and have hit a brick wall. I feel like I have missed a step somewhere. When I SSH into my things folder, my phone does not show up. I was under the impression that by adding it manually through the network binding, it would create a thing for me. Is this not true? Is it needed? It does show up in the PaperUI though. I can not seem to finish step 3 from:

I have also added the code from this tutorial and it does not work. I am guessing it is because I have not properly finished Steps 3 through 5.

So here is what is working. The phone shows ups under the control tab, and the slider moves when my phone is connected or disconnected from my router.

I have a feeling this is getting long winded, so please try comb through this and let me know what you think. I will be happy to add any info needed to help sort this out.

Thanks

0 Likes

(anonymous.one) #10

Creating ‘things’ in PaperUI does not auto create a ‘things’ file in /etc/openhab2/things/

And you don’t want to add a same named thing into a manual thing file while it is still active in PaperUI.

If you need to create a group for multiple phones, you can create something like ‘virtual.items’ under the /items folder and copy the smart home blog’s code for the group. At which point you will need to edit your current working PaperUI item that is associated to your thing, and make it a member of the group (should auto populate in a drop down).

Past that, I’m not sure what code in the tutorial you are trying that is failing?

0 Likes

(Lee Mueller) #11

Are you suggesting that I need to create another, but digferent thing for my phone? If so, is this an appropriate code?

Thing network:pingdevice:devicename [ hostname="192.168.0.42" ]

I am guessing I also need make an item similar to

Switch MyDevice { channel="network:pingdevice:devicename:online" }
Number MyDeviceResponseTime { channel="network:pingdevice:devicename:latency" 

I am basing this off

Does of any of this seem to be the right direction or am I just that confused?

0 Likes

(anonymous.one) #12

That is something that is up to you, if you want a OS level file in the things folder for your network devices you are monitoring for, then yes you would want to use that line of code don’t forget to remove it from PaperUI when you do this to lower confusion down the road.

Your item code also looks correct but again the item will need to be defined in your items folder at the OS level or within PaperUI, and again is personal preference/choice.

From my own experiences with OH and swapping around my hardware a couple of times, I prefer having the OS level files in the items/things/rules folders as I can easily remember that I need to copy /etc/openhab2/* off the old system and onto the new one and know things will just work (some things require additional work, like google calendar integration).

0 Likes

(Lee Mueller) #13

Thank you, writing the code at the OS level made more sense to me. I now have frame in paper ui displaying a device that shows on whenever my phone is connected to the WiFi. I think this is exactly what I want. My plan is to have a rule that when my phone is set to off, it sets another switch to on which will be my control to turn on my security system. Does this make sense? Is it more complex than that?

0 Likes