FritzBoxTR064 binding: cannot check presence of device in network

fritzbox
presense
Tags: #<Tag:0x00007fe057f64fc0> #<Tag:0x00007fe057f64e58>

(Torsten) #1

Hi,

I have installed the binding, created a corresponding user in the FritzBox and set it up via the binding’s cfg file.
First, when loading the cfg file, I see the following message in the log:
[WARN ] [ing.fritzboxtr064.internal.Tr064Comm] - No tr064 service found for service id urn:WLANConfiguration-com:serviceId:WLANConfiguration3

I don’t know what that means but this, however, does not seem to stop the binding from generally working, I can get values for items like this:
String fboxName “FBox Model [%s]” {fritzboxtr064=“modelName”}
String fboxSerial “FBox Serial [%s]” {fritzboxtr064=“serialNumber”}
Switch fboxWifi24 “2,4GHz Wifi” {fritzboxtr064=“wifi24Switch”}

However, what does not work is to check for presence of a device by providing its MAC address:
Contact cFboxMacOnline “Presence (WiFi) [%s]” {fritzboxtr064=“maconline:XX-XX-XX-XX-XX-XX”}
(XX replaced by the MAC) keeps staying OFF, even though the web interface of the FritzBox clearly shows that it’s online. Also changing the item type from Contact to Switch does not help.

Any ideas or workarounds for a presence detection?

Thanks a lot, Torsten


(Michael) #2

Hi Torsten,

i´m using the TR064 for presence detection and have no problems like you described.

My items are using the Contact definition
Contact fbMichael "Michael [MAP(presence.map):%s]" <presence> (gPersist) {fritzboxtr064="maconline:AA-BB-CC-DD-EE-FF"}

I´ve never seen the message No tr064 service found for service id... in my logs.
There was a discussion about this error some years ago at Github.

Please change the log level to DEBUG through the console:
(please read everything before starting :slight_smile: )

sudo openhab-cli console
// Login with your user

// Wait for the console to load
log:set DEBUG org.openhab.binding.fritzboxtr064
// Check if the log level was set to DEBUG for the TR064 binding
log:get

// Restart the binding to get new logs
bundle:restart org.openhab.binding.fritzboxtr064

// or use
bundle:list | grep Fritzbox
// remember the id from the beginning of this line
bundle:restart <ID>

Now you can check the logs and should see some more detailled messages.
What does your log say right after the No tr064 service found error?
Please post it here.

And by the way, please have a look at this thread to learn how to put your code and logs in tags so it´s easier to read :wink:

kind regards
Michael


(Torsten) #3

Thank you. Yes, I had seen that posting at Github already when trying to fix the problem but it didn’t help me. Concerning the questions there, the Fritzbox returns the SOAP request successfully and the setting in the WebUI is enabled.

I have tried enabling the debug logging but it does not work for me: the DEBUG level is not enabled, maybe the path is wrong?

openhab> log:set DEBUG org.openhab.binding.fritzboxtr064
openhab> log:get
Logger                                             │ Level
───────────────────────────────────────────────────┼──────
ROOT                                               │ WARN
javax.jmdns                                        │ ERROR
org.apache.karaf.jaas.modules.audit                │ INFO
org.apache.karaf.kar.internal.KarServiceImpl       │ ERROR
org.apache.karaf.shell.support                     │ OFF
org.eclipse.smarthome                              │ INFO
org.jupnp                                          │ ERROR
org.openhab                                        │ INFO
org.openhab.binding.hue                            │ INFO
org.ops4j.pax.url.mvn.internal.AetherBasedResolver │ ERROR
org.ops4j.pax.web.pax-web-runtime                  │ OFF
smarthome.event                                    │ INFO
smarthome.event.InboxUpdatedEvent                  │ ERROR
smarthome.event.ItemAddedEvent                     │ ERROR
smarthome.event.ItemRemovedEvent                   │ ERROR
smarthome.event.ItemStateEvent                     │ ERROR
smarthome.event.ThingAddedEvent                    │ ERROR
smarthome.event.ThingRemovedEvent                  │ ERROR
smarthome.event.ThingStatusInfoEvent               │ ERROR

Best regards, Torsten


(Michael) #4

No the path is correct and for me it works, but it´s not shown with log:get.
Looks like a bug…
Please have a look at your log and restart the bundle as described before.


(Torsten) #5

Your are right, the DEBUG level is set, it just doesn’t show in the list.

Please find the output below. It’s not helpful for me so far:

2019-01-13 22:51:35.321 [DEBUG] [org.openhab.binding.fritzboxtr064   ] - BundleEvent STARTING - org.openhab.binding.fritzboxtr064
2019-01-13 22:51:35.366 [DEBUG] [org.openhab.binding.fritzboxtr064   ] - ServiceEvent REGISTERED - {org.osgi.service.cm.ManagedService}={service.id=419, service.bundleid=228, service.scope=singleton} - org.openhab.binding.fritzboxtr064
2019-01-13 22:51:35.416 [DEBUG] [.FritzboxTr064GenericBindingProvider] - Adding item fboxName with config modelName
2019-01-13 22:51:35.422 [DEBUG] [.FritzboxTr064GenericBindingProvider] - Adding item fboxSerial with config serialNumber
2019-01-13 22:51:35.427 [DEBUG] [.FritzboxTr064GenericBindingProvider] - Adding item fboxWifi24 with config wifi24Switch
2019-01-13 22:51:35.432 [DEBUG] [.FritzboxTr064GenericBindingProvider] - Adding item cFboxMacOnline with config maconline:XX-XX-XX-XX-XX-XX
2019-01-13 22:51:35.459 [DEBUG] [xtr064.internal.FritzboxTr064Binding] - FritzBox TR064 Binding activated!
2019-01-13 22:51:35.463 [DEBUG] [xtr064.internal.FritzboxTr064Binding] - Custom refresh interval set to 60000
2019-01-13 22:51:35.467 [DEBUG] [xtr064.internal.FritzboxTr064Binding] - No Phonebookid provided. Use default: 0
2019-01-13 22:51:36.013 [DEBUG] [ing.fritzboxtr064.internal.Tr064Comm] - Releasing connection
2019-01-13 22:51:36.345 [WARN ] [ing.fritzboxtr064.internal.Tr064Comm] - No tr064 service found for service id urn:WLANConfiguration-com:serviceId:WLANConfiguration3
2019-01-13 22:51:36.348 [DEBUG] [ing.fritzboxtr064.internal.Tr064Comm] - Found 2,4 Ghz and Guest Wifi
2019-01-13 22:51:36.354 [DEBUG] [org.openhab.binding.fritzboxtr064   ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler}={service.id=422, service.bundleid=228, service.scope=bundle, user=openhab, refresh=60000, url=https://192.168.178.1:49443, component.name=org.openhab.binding.fritzboxtr064.binding, component.id=259, pass=XXX, event.topics=openhab/command/*, service.pid=org.openhab.fritzboxtr064} - org.openhab.binding.fritzboxtr064
2019-01-13 22:51:36.358 [INFO ] [b.core.service.AbstractActiveService] - FritzboxTr064 Refresh Service has been started
2019-01-13 22:51:36.362 [DEBUG] [org.openhab.binding.fritzboxtr064   ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.fritzboxtr064.FritzboxTr064BindingProvider}={service.id=420, service.bundleid=228, service.scope=bundle, component.name=org.openhab.binding.fritzboxtr064.genericbindingprovider, component.id=260} - org.openhab.binding.fritzboxtr064
2019-01-13 22:51:36.378 [DEBUG] [org.openhab.binding.fritzboxtr064   ] - BundleEvent STARTED - org.openhab.binding.fritzboxtr064
2019-01-13 22:51:36.496 [DEBUG] [ing.fritzboxtr064.internal.Tr064Comm] - Releasing connection
2019-01-13 22:51:36.707 [DEBUG] [ing.fritzboxtr064.internal.Tr064Comm] - Releasing connection
2019-01-13 22:51:37.077 [DEBUG] [ing.fritzboxtr064.internal.Tr064Comm] - Releasing connection
2019-01-13 22:51:37.105 [DEBUG] [ing.fritzboxtr064.internal.Tr064Comm] - MAC not known to FritzBox!
2019-01-13 22:51:37.223 [DEBUG] [ing.fritzboxtr064.internal.Tr064Comm] - Releasing connection
2019-01-13 22:52:20.500 [INFO ] [b.core.service.AbstractActiveService] - FritzboxTr064 Refresh Service has been shut down
´´´

(Michael) #6

I had a look at the source and WLANConfiguration3 is the guestwifi.
I don´t think this message is responsible for your problem.

The log says MAC not known to FritzBox!
It sounds like you used the wrong MAC address.
Please double check the address you used in your item and the one that´s displayed in the FritzBox UI.


(Torsten) #7

Thanks for checking this in the code!

Yes, I see the log entry, however, the MAC is definitely correct and also listed as Online in the FritzBox’s WebUI. The only difference is that on the WebUI it’s listed with the normal “:” as separators and I have used “-” separators as required by the binding. Otherwise it’s identical.

I see another thing though:
the device with this MAC is not directly connected to the FritzBox’s Wifi but the FritzBox is connected via cable to another access point which in turn connects to the device. This normally should not be a problem and the WebUI shows the device as Online, however it shows it as Online and connected to LAN, not WIFI. Is that possible the cause of the problem? Is “maconline” only looking for devices connected to WiFi (directly, no Access Point in between)? If yes, is it possible to also look for all devices instead?


(Torsten) #8

No, I just verified: even when I put my phone next to the FritzBox and it directly connects to the WiFi (also shown on the WebUI) the binding still displays “MAC not known”.


(Michael) #9

I made a quick test and added my PC as an item and it´s working.
The item switched from null to OPEN and back to CLOSED when disconnected.

2019-01-13 23:27:10.965 [vent.ItemStateChangedEvent] - fbMacPro changed from NULL to OPEN
2019-01-13 23:45:25.864 [vent.ItemStateChangedEvent] - fbMacPro changed from OPEN to CLOSED

Just to compare, i´m using version 1.13.0 of the binding.

I´m out of ideas and would suggest to open an Github issue for this.
@tensberg do you have any ideas?


(Torsten) #10

I am using the same version of the binding:

228 │ Active   │  80 │ 1.13.0                 │ openHAB FritzboxTr064 Binding
´´´´

(Torsten) #11

Seems to be a relatively frequent problem with that binding, there are a lot of people complaining about similar problems with that binding. Does not seem to work for me. Any proposal what alternative to use best instead? Is it a good idea to use the network binding and look for the IP instead or is that less reliable?


(Michael) #12

What mobile devices are you using?
There are some solutions for Android devices and some others for iOS devices.
iOS devices are a little bit difficult because the stop answering pings after some time.
That´s why i´m not using any ping solution in my oH and stick to the FritzBox maconline or iCloud location solutions.


(Torsten) #13

Actually both. I need to check for an Android as well as for an iOS device (my wife’s). So a combination of network binding and iCloud location would be best?


(Michael) #14

Have you tried different MAC addresses with the binding?
There should be a solution for this.
Are you able to create a Github issue? Otherwise i would create it for you.


(Torsten) #15

Yes, I have tried another device, same problem. I then continued googling for a solution and found several people facing similar issues, e.g. here

Unfortunatley, it’s not the version of my FritzBox OS.

I will try creating an issue there if you think that might be helpful. Thanks a lot!


(Michael) #16

Please create the issue here


(Torsten) #17

I just did here:

Wrong?


(Michael) #18

Yeah because it‘s not the official repo, just the repo of the user Gitbock.
I know he worked at the binding but it‘s better to create an issue in the openhab1-addons repo.

Edit: And add an link to this discussion in your issue :slight_smile:


(Torsten) #19

Done