Advice on upgrading from OpenHAB 1.8.3 to 2.1: FritzAHA binding

I have a working installation of OpenHAB 1.8.3 on a Raspberry Pi v3, that implements a load shredder application using 4 FritzDECT 200 smart switches and 2 Sonoff Pow. I am not a Java programmer but thanks to examples and help from this kind community I obtained the results I wanted.
I am using a FritzBox 7360v1 (with fritzOS 6.30 that won’t be updated)
The FritzAHA binding for openhab 1.x implements two ways to access the power measured by the FritzDECT 200: a slower one based on “Webservice” and a faster one based on “Query Script”.
My application needs updated values every 20-30 seconds in order to detect an overload condition and issue the switch off commands to lower priority appliances. In order to obtain the readings with such a fast refresh rate I use the “Query script” way of defining items and it works pretty well.

I’ve seen that OpenHAB2 offers better functionality than OpenHAB1.8.3 and I am considering to upgrade but it seems to me that the fritzbox AHA binding explicitly developed for OpenHAB 2.0 does not implement the “fast way” (i.e. the one based on the Query Script) of reading the DECT switches.

I have various options to investigate:

  1. use the 1.8.3 fritzaha binding in openhab 2.0 compatibility mode
  2. ask to the developer to port the “Query script” feature in the OpenHab 2.0
  3. try to implement the critical part concerning the reading of the power in python, using the exec binding and then use the fritzaha binding only for sending commands (I’m slightly more familiar with python than java, but not an expert, therefore it could be an impossible task for my skills)

The last option would be to remain in openhab 1.8.3 and clean-up my code a little bit.

Please let me know your opinions.
Thank you for your attention,
LionHe

At a minimum I would upgrade to 2.x using the 1.8 version binding. Then I’d file an issue to have the fast way added to the 2.x version of the binding.

1 Like

Thank you for your reply. I’m now trying to follow your advice to use the fritzaha-1.8.3 but with no success.

I’ve succesfully setup an openhabian installation of Openhab 2.1 and I am following the text based initial configuration.
I have edited the addons.cfg file and followed the suggestions concerning the setup of the compatibility layer for 1.x binding. Finally I indicated the fritzaha binding under the appropriate line.

I was expecting to find a fritzaha.cfg file in the /etc/openhab2/services directory, but it doesn’t appear, while mapdb.cfg and rrd4j.cfg are there…

No addon file is present in the directory /usr/share/openhab2/addons
(In openhab 1 the mapdb and rrd4j jar files were in that directory)

I therefore tried to follow the migration guide by manually copying files
1)
org.openhab.binding.fritzaha-1.8.3.jar
in /usr/share/openhab2/addons
2)
openhab.cfg file in
/etc/openhab2/configuration/services
3)
my items definitions in /etc/openhab2/configuration/items
4)
my default.sitemap in
/etc/openhab2/configuration/sitemaps

I restarted openhab2 but the openhab.log contains lots of errors.
The log is very long. I pasted the first part at the following address https://pastebin.com/LnHeUD9n

Can you give me some hint on how to proceed further?

Thank you
.LionHe

There are a few bindings, particularly 1.x version bindings that have not been updated for 2.x where the cfg file is not automatically created. You may have to create this file manually.

That isn’t where bindings get installed. To verify a binding is installed and correctly configured you should watch the logs during startup and log into the karaf console and run bundle:list and make sure your binding is listed and set as Active.

Did you install and enable the OH 1 comparability layer first? Without doing that first you can’t just treat everything the same as you did with OH 1.

I recommend backing up an undo everything you have already done and go back to the addons.cfg step. After changing the file you should see openHAB.log installing the binding. When that is done log into the console and verify that it is listed and active. Then look at the building’s readme to see how to create a cfg file.

Thank you for your answer. I’m now working on a brand new raspbian image for OpenHAB 2.1 (my openhab 1.8.3 installation is on another SD).

It seems to me that the fritzaha binding cannot be deployed on oh 2.1 because it has not been “upgraded” to version 1.9 and thererefore it cannot work with the compatibility layer. On the other hand, the new avmfritz binding covers part of the functionality (but not the one that I critically need, i.e. the fast reading). Should I give up trying to use fritzaha 1.8.3 and ask to the avmfritz binding developer to include the “fast read” functionality"?

Here’s what I tried so far:
I followed strictly the “text based” guide (http://docs.openhab.org/tutorials/migration#text-based)

  1. I modify the runtime.cfg file
    org.eclipse.smarthome.persistence:default=mapdb
    autoapprove:enabled=false
    org.eclipse.smarthome.links:autoLinks=false

  2. I modify the addon.cfg package
    package=expert
    remote=true
    legacy = true
    binding=fritzaha

The openhab.log does not show any trace of the binding

2017-11-19 10:33:19.850 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at http://192.168.27.33:8080
2017-11-19 10:33:19.859 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https://192.168.27.33:8443
2017-11-19 10:33:34.308 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-11-19 10:33:34.767 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2017-11-19 10:33:35.093 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2017-11-19 10:33:35.418 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2017-11-19 10:33:35.524 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel

I log into the karaf console and get a list all bundles and It confirms that the binding is not installed

START LEVEL 100 , List Threshold: 50
ID | State | Lvl | Version | Name

9 | Active | 80 | 5.3.1.201602281253 | OSGi JAX-RS Connector
10 | Active | 80 | 2.3.1 | Gson
11 | Active | 80 | 18.0.0 | Guava: Google Core Libraries for Java
12 | Active | 80 | 3.0.0.v201312141243 | Google Guice (No AOP)
13 | Active | 80 | 1.5.8 | swagger-annotations
14 | Active | 80 | 3.19.0.GA | Javassist
16 | Active | 80 | 3.5.2 | JmDNS
19 | Active | 80 | 1.1.0.Final | Bean Validation API
21 | Active | 80 | 2.0.1 | javax.ws.rs-api
23 | Active | 80 | 3.2.0.v201101311130 | ANTLR Runtime
26 | Active | 80 | 1.6.0 | Commons Codec
27 | Active | 80 | 3.2.1 | Commons Collections
28 | Active | 80 | 1.1 | Commons Exec
29 | Active | 80 | 2.2.0 | Commons IO
30 | Active | 80 | 2.6 | Commons Lang
35 | Active | 80 | 4.2.3 | Apache HttpClient OSGi bundle
36 | Active | 80 | 4.2.3 | Apache HttpCore OSGi bundle
57 | Active | 80 | 4.0.8 | Apache Karaf :: Wrapper :: Core
58 | Active | 80 | 3.1.0.7 | Apache ServiceMix :: Bundles :: commons-httpclient
63 | Active | 80 | 2.11.0.v20150805-0538 | EMF Common
64 | Active | 80 | 2.11.1.v20150805-0538 | EMF Ecore
65 | Active | 80 | 2.11.1.v20150805-0538 | EMF XML/XMI Persistence
66 | Active | 80 | 3.8.0.v20160509-1230 | Common Eclipse Runtime
67 | Active | 80 | 3.6.100.v20160223-2218 | Extension Registry Support
94 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Config Core
95 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Configuration Discovery
96 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Config Dispatcher
97 | Active | 75 | 0.9.0.b5 | Eclipse SmartHome Config XML
98 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Core
99 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Core Audio
100 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome AutoUpdate Binding
101 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Core Binding XML
102 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Core ID
103 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Core Persistence
104 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Scheduler Service
105 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Core Thing
106 | Active | 75 | 0.9.0.b5 | Eclipse SmartHome Core Thing XML
107 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Transformation Service
108 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Core Voice
109 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Console
110 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Console for OSGi runtime Karaf
111 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome JavaSound I/O, Fragments: 169
112 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Monitor
113 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Net I/O Bundle
114 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome REST Interface Bundle
115 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Core REST API
116 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome REST mDNS Announcer
117 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Sitemap REST API
118 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome SSE REST API
119 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Voice REST API
120 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Bonjour/MDS Service Discovery Bundle
121 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Web Audio Support
122 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Model Core
123 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Item Model
124 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Item Model Runtime
125 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Persistence Model
126 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Persistence Runtime
127 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Rule Model
128 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Rule Runtime
129 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Script
130 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Script Runtime
131 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Sitemap Model
132 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Sitemap Runtime
133 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Thing Model
134 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Thing Model Runtime
135 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Json Storage Service
136 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome UI
137 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome UI Icons
138 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Classic IconSet
139 | Active | 80 | 2.9.2 | Xtend Runtime Library
140 | Active | 80 | 2.9.2 | Xtend Macro Interfaces
141 | Active | 80 | 2.9.2 | Xtext
142 | Active | 80 | 2.9.2 | Xtext Common Types
143 | Active | 80 | 2.9.2 | JSR-45 Smap installer
144 | Active | 80 | 2.9.2 | Xtext Utility
145 | Active | 80 | 2.9.2.v20160428-1452 | Xbase Model
146 | Active | 80 | 2.9.2 | Xbase Runtime Library
162 | Active | 80 | 2.2.0 | JUPnP Library
163 | Active | 80 | 1.9.6 | MIME streaming extension
164 | Active | 80 | 5.0.2 | Require-Bundle Fix :: org.objectweb.asm
166 | Active | 90 | 2.1.0 | openHAB Core
167 | Active | 80 | 2.1.0 | openHAB Karaf Integration
169 | Resolved | 80 | 2.1.0 | openHAB Sound Support, Hosts: 111
170 | Active | 80 | 2.1.0 | openHAB Dashboard UI
175 | Active | 80 | 3.2.0 | Commons Net
176 | Active | 80 | 2.1.0 | openHAB 1.x Compatibility Layer
177 | Active | 80 | 1.1.1.201605111122 | Swagger Provider
178 | Active | 80 | 2.4.5 | Jackson-annotations
179 | Active | 80 | 2.4.5 | Jackson-core
180 | Active | 80 | 2.4.5 | jackson-databind
181 | Active | 80 | 2.4.5 | Jackson-dataformat-YAML
182 | Active | 80 | 2.1.0 | json-path
183 | Active | 80 | 1.5.8 | swagger-core
184 | Active | 80 | 1.5.8 | swagger-jaxrs
185 | Active | 80 | 1.5.8 | swagger-models
186 | Active | 80 | 2.2 | json-smart
187 | Active | 80 | 3.4.0 | Apache Commons Lang
188 | Active | 75 | 0.9.0.b5 | Eclipse SmartHome Exec Transformation Service
189 | Active | 75 | 0.9.0.b5 | Eclipse SmartHome JavaScript Transformation Service
190 | Active | 75 | 0.9.0.b5 | Eclipse SmartHome JSonPath Transformation Service
191 | Active | 75 | 0.9.0.b5 | Eclipse SmartHome Map Transformation Service
192 | Active | 75 | 0.9.0.b5 | Eclipse SmartHome RegEx Transformation Service
193 | Active | 75 | 0.9.0.b5 | Eclipse SmartHome Scale Transformation Service
194 | Active | 75 | 0.9.0.b5 | Eclipse SmartHome XPath Transformation Service
195 | Active | 75 | 0.9.0.b5 | Eclipse SmartHome Xslt Transformation Service
196 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Basic UI, Fragments: 200
197 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome WebApp UI
198 | Active | 80 | 0.9.0.b5 | Eclipse SmartHome Paper UI, Fragments: 204
199 | Active | 80 | 2.1.0 | openHAB REST Documentation
200 | Resolved | 75 | 2.1.0 | openHAB Basic UI Fragment, Hosts: 196
201 | Active | 75 | 2.1.0 | openHAB Classic UI Fragment
202 | Active | 80 | 2.1.0 | HABmin User Interface
203 | Active | 80 | 2.1.0 | HABPanel User Interface
204 | Resolved | 75 | 2.1.0 | openHAB Paper UI Theme Fragment, Hosts: 198
205 | Active | 80 | 0.9.10.v20160429-1435 | reflections (wrap)
206 | Active | 80 | 1.5.8.v20160511-1038 | swagger-jersey2-jaxrs (wrap)

I then looked at the wiki:The fritzaha binding description appears on the following page
http://docs.openhab.org/v2.1.0/addons/bindings/fritzaha1/readme.html
listed as a manual install binding (but not a legacy binding) on the following page
http://docs.openhab.org/v2.1.0/addons/bindings.html

The description page tells that a binding explicitly developed for openhab 2 is
http://docs.openhab.org/v2.1.0/addons/bindings/avmfritz/readme.html

but the name of the binding is different (avmfritz vs fritzaha1)

According to the wiki page on the migration
(http://docs.openhab.org/tutorials/migration#installing-unofficially-supported-openhab-1x-add-ons)
“Therefore the first steps will be to get it running using the 1.9 version of the bindings installed through openHAB 2’s new add-on management system.”

Moreover the binding overview page states, for manual install bindings that

“Many openHAB 1 bindings have not yet completed validation for inclusion in the distribution; however, they may indeed work properly under openHAB 2. All openHAB 1 addons can be downloaded in a zip file (1.9.0). We need your help testing them so that they may be easily installed in a future distribution. Please see the compatibility layer documentation and also search the openHAB community forum for the latest information and steps for manual installation”

But the zip file does not contain the 1.9.0 version of the fritzaha binding

Sorry for the long post, but I’m really stuck now.

Thank you for your kind help
LionHe

Incorrect. The whole point of the compatibility later is to be able to deploy 1.x bindings that have not yet been modified to work with 2.0. But you must activate the compatibility layer.

If the binding is listed in PaperUI or has an entry in the docs than the binding has already been proven to work on OH 2 and the necessary changes made to allow it to work in OH 2 without the comparability layer.

Since it has an entry in the docs this means that it is part of the officially supported bindings.

But, it might have been added after the 2.1 release in which case you will need to upgrade to the 2.2 snapshot to get it.

Since this is a1.x binding, you need to spend a1 to the name.

binding=fritzaha1

The easiest thing to do would be to install PaperUI and manage installation of bindings from there.

That sounds like a good idea regardless.

OH 2 no longer uses a wiki. I only bring this up because when you say wiki the reader will automatically assume you are reading the outdated OH 1 docs.

This is a special term that only applies to 1.x bindings that also have 2.x version. Since there is no 2.x version of this binding it is not a legacy binding.

Unfortunately, i do not know anything about this binding so we’ll be of limited use. The best I can offer is to install PaperUI and check to see if it is listed. If not download the 2.2 snapshot and see if it is listed there. If it is then you can still use add-ons.cfg but you will need to spend a1 to the binding name.

Thank you for your reply. I’ll try to upgrade to the unstable 2.2 version to see if the fritzaha binding is there. I’ll also try to ask for a modification of the native2.0 avmfritz binding

I just upgraded to snapshot 2.2 but the fritzaha binding is not listed in the paperUI.
Thank you in any case
LionHe

I’ve seen that the fritzaha binding is not available anymore in the addons file for openhab 1.8.3 (I’ve seen that the addons versions are now 1.10.0) that can be downloaded from the main openhab webpage. Moreover I do not find it at the link of the nightly builds
https://openhab.ci.cloudbees.com/job/openHAB1-Addons/

Was it perhaps removed because it required some modification by a developer?

Luckily I am keeping my installation backed-up, but if I were to re-install everything from scratch it would be impossible to retrieve the jar file of the fritzaha binding.

How can I raise this issue so that some developer can look into it?

Thank you,
LionHe