Which state has the presence item of the Fritzbox TR-064 binding?

Hi folks,

I am using the Fritzbox TR-064 binding for presence detection. As I want to use this further with rules, I do have a question. For the binding, you have to define an item (according to the wiki a contact item, but afaik this could also be a switch item). My item looks like this:

Switch HandyStefan_WLAN "Handy Stefan" (grp_PRAESENZ) { fritzboxtr064="maconline:11-22-33-44-55-66" }
The binding itself delivers 0 or 1, therefore I am using a mapping. 0 means absent, 1 is present. I’ll do this in the sitemap and all works well. Now I want to check the item state in a rule. Which state do I have to query now? According to the OH wiki, a switch can only be ON or OFF. So is this the state to query? As the binding delivers 0 or 1 and the mapping actually transforms 0 and 1, and not ON and OFF.

I hope you can comprehend my problem? :wink:


Mapping only effects the visualization on your sitemap, not the event.log.
So just take a look into your event.log what state is updated there and use that in your rules …

Thanks! Yes, I assumed that the mapped expressions (absent/present) are not the ones to check in the rule. But it could be 0/1 or ON/OFF. Ok, I’ll have a look at the log.


Well, I checked the log but the result wasn’t as obvious as I hoped! :slight_smile:

`2016-06-28 19:00:29.434 [DEBUG] [o.o.b.f.i.FritzboxTr064Binding] - Parsing response using SOAP value parser in Item map
2016-06-28 19:00:29.434 [DEBUG] [o.o.b.f.i.FritzboxTr064Binding] - Parsing FritzBox response for maconline
2016-06-28 19:00:29.443 [DEBUG] [o.o.b.f.i.FritzboxTr064Binding] - parsed as 1
2016-06-28 19:00:29.454 [DEBUG] [.p.m.i.MysqlPersistenceService] - mySQL: Stored item ‘HandyStefan_WLAN’ as ‘ON’[ON] in SQL database at Tue Jun 28 19:00:29 CEST 2016.

So the parsing response is “1” (not ON), but the mySQL item is stored as “ON”. So for me it’s still not clear which state I have to check with the rule… :frowning: `

Why not setting up two rules, one on “0/1” trigger and the other one on “ON/OFF” trigger. Put in a logInfo and the rule that fires is the right trigger :grinning:

1 Like

Good idea. I modified your advice a little bit and made a rule which was triggered by a change of the item and does a logInfo of the state of the item. Result: ON/OFF.

Thanks @sihui for your help!