HTTP Binding Piko Solar 10.1 not working

102 views
Skip to first unread message

Thomas Schäfer

unread,
Jul 6, 2015, 4:46:15 AM7/6/15
to ope...@googlegroups.com
Hello,
I have solar inverter(?) from Kostal and tried the examples from the wiki to read the energy data. But the values do not appear and when i go through the logfiles the value seems never to be read. I am using openhab on a raspberry pi without a display, only remote ssh-terminal.

The entry in my openhab configuration is:

http:kostal.cache.url=http://pvserver:password@ipadress:port/index.fhtml                                                                  
http
:kostal.cache.updateInterval=60000


The entry in my items file is:

Number Solar_Gesamt "Ertrag [%.0f kWh]" (energie) {http="<[kostal.cache:10000:REGEX(.*?Gesamtenergie<\/td>\n<.*?\n(.*?)<\/td>.*)]" }


The regex code differs from the given sample for two reasons: the first ist, that the example did not work, the second is that this regex code matched the correct value when i tested it with a regex online tool. 

The sitemap entry looks this way:

Frame label="Photovoltaik" icon="solarplant"                                                                                                                                          
       
{                                                                                                                                                                                    
               
Group label="Piko Solar" icon="inverter"                                                                                                                                      
               
{                                                                                                                                                                            
                       
Frame label="Übersicht" icon="solarplant"                                                                                                                            
                       
{                                                                                                                                                                    
                               
Text item=Solar_Gesamt icon="inverter"                                                                                                                        
                       
}                                                                                                                                                                    
                                                                                                                                                                                             
                       
Frame label="Strings" icon="solarplant"                                                                                                                              
                       
{                                                                                                                                                                    
                       
}                                                                                                                                                                    
               
}                                                                                                                                                                            
       
}

I guess I did some simple but fundamental error, but cannot find it. Is there anything gesides the http binding I have to activate or modify? What in this code is so wrong I even do not get any output?

Thank you for your answers :)

Thomas

watou

unread,
Jul 6, 2015, 5:43:58 AM7/6/15
to ope...@googlegroups.com
I don't see the error off-hand, but here are some separate ideas for possibly simplifying the setup so it's easier to see what is happening:

  1. Make sure the HTTP binding JAR is in your addons directory.
  2. The "." in kostal.cache ought not be causing a problem, but replace all occurrences (in openhab.cfg and your .items file) with kostalcache just to be sure.
  3. Or, eliminate the URL caching aspect by replacing kostal.cache in the item binding string with the full URL and removing the lines in openhab.cfg.  Your password should not begin with a numeric character.  This will hit the URL every ten seconds (per your item example), instead of only hitting the URL every minute, per your kostal.cache caching setting.  If you want to hit the URL every ten seconds, then you don't want to cache the returned HTML result anyway.
  4. Consider using the XSLT transform to parse the HTML returned instead of Regex.
Hope this helps.

watou

unread,
Jul 6, 2015, 5:52:39 AM7/6/15
to ope...@googlegroups.com
Wait a minute: I see you are using a non-standard HTTP port in your URL, which would confuse the parsing of the binding string (numeric digit characters following a colon : character, so the binding string won't parse properly).  So you *have* to use the http:kostalcache.url= and http:kostalcache.updateInterval= entries in openhab.cfg.  So, the option to eliminate the URL caching mechanism is not available to you.

Thomas Schäfer

unread,
Jul 6, 2015, 5:54:28 AM7/6/15
to ope...@googlegroups.com
Ok... thank you for the hint, I will test it as soon as possible.

Thomas Schäfer

unread,
Jul 6, 2015, 6:11:26 AM7/6/15
to ope...@googlegroups.com
Hi...
I did as you posted below... there is a mysterious thing I cannot explain. For testing purpose I added a second line in item file with the confriguration from the wiki for the daily value... now the really odd thing ist, that when I put it in, it appeared in the app and the webpage. As it did not work, I commented it out with double slashes.... It is still there... is there some general caching function or anything else? Maybe I tested hundreds of configurations for nothing as they never took effect :D and yes... I did a service restart every time after I changed something...

Thomas Schäfer

unread,
Jul 6, 2015, 6:32:46 AM7/6/15
to ope...@googlegroups.com
Hi... it works. I just forgot to put out the TEXT item in the sitemap file :D but it still doesn'T work. I have no JAR in the addon repository and it is not installable.

watou

unread,
Jul 6, 2015, 6:59:26 AM7/6/15
to ope...@googlegroups.com
Hi Thomas,

I am having a little trouble following what different things you are trying. First, make sure you have org.openhab.binding.http-1.7.0.jar in your /usr/share/openhab/addons directory.  If you do not, then there is no code in place to perform any of your configuration instructions.  If you used the recommended apt-get installation method, then you would type:

sudo apt-get install openhab-addon-binding-http

On success, this results in putting the needed JAR file in place.

I don't know which file you added // to, but that may not be a proper way to comment out a line, depending on which file you are editing.  When you feel you have a complete setup that, according to available docs, ought to be working, then please attach files or embed configuration information into your post so we can better see what you are attempting.

All the best,
John

Thomas Schäfer

unread,
Jul 6, 2015, 7:21:56 AM7/6/15
to ope...@googlegroups.com
Ah...okay, sorry... now I know about which jar you are talking, thought you would reffer to a ...binding-jar... 

I installed the http binding in a proper way and the files are where they should be.


Am Montag, 6. Juli 2015 10:46:15 UTC+2 schrieb Thomas Schäfer:

Thomas Schäfer

unread,
Jul 6, 2015, 9:06:21 AM7/6/15
to ope...@googlegroups.com

The output of my openhab.log is:

015-07-06 14:59:32.953 [INFO ] [.o.core.internal.CoreActivator] - openHAB runtime has been started (v1.7.0).                                                                                
2015-07-06 14:59:51.493 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - mDNS service has been started                                                                                              
2015-07-06 14:59:52.280 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - Service Discovery initialization completed.                                                                                
2015-07-06 15:00:06.567 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'nr110.items'                                                                                                
2015-07-06 15:00:22.196 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'nr110.sitemap'                                                                                              
2015-07-06 15:00:30.133 [INFO ] [penhab.io.rest.RESTApplication] - Started REST API at /rest                                                                                                  
2015-07-06 15:00:36.337 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Started Classic UI at /openhab.app                                                                                        
2015-07-06 15:00:47.420 [INFO ] [.service.AbstractActiveService] - FritzBox refresh Service has been started                                                                                  
2015-07-06 15:00:47.903 [ERROR] [i.internal.GenericItemProvider] - Binding configuration of type 'http' of item Solar_Gesamt could not be parsed correctly.                                
org.openhab.model.item.binding.BindingConfigParseException: bindingConfig '<[KostalCache:100000:REGEX(.*?Gesamtenergie</td>                                                                  
<.*?                                                                                                                                                                                          
(.*?)</td>.*)]' doesn't contain a valid binding configuration                                                                                                                                
        at org.openhab.binding.http.internal.HttpGenericBindingProvider.parseBindingConfig(HttpGenericBindingProvider.java:127) ~[na:na]                                                      
       at org.openhab.binding.http.internal.HttpGenericBindingProvider.processBindingConfiguration(HttpGenericBindingProvider.java:101) ~[na:na]                                            
        at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:348) [org.openhab.model.item_1.7.0.jar:na]                                  
        at org.openhab.model.item.internal.GenericItemProvider.dispatchBindingsPerType(GenericItemProvider.java:309) [org.openhab.model.item_1.7.0.jar:na]                                    
       at org.openhab.model.item.internal.GenericItemProvider.addBindingConfigReader(GenericItemProvider.java:106) [org.openhab.model.item_1.7.0.jar:na]                                    
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0]                                                                                                            
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0]                                                                                          
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0]                                                                                  
       at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0]                                                                                                                      
        at org.eclipse.equinox.internal.ds.model.ComponentReference.bind(ComponentReference.java:376) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                                  
       at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.bindReference(ServiceComponentProp.java:444) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                    
        at org.eclipse.equinox.internal.ds.InstanceProcess.dynamicBind(InstanceProcess.java:416) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                                      
        at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:334) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                                                    
        at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                                              
       at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]                
       at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]                              
       at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]                                            
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]                                
       at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]                
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]                          
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]                      
       at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]                              
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]                            
       at org.eclipse.equinox.internal.ds.InstanceProcess.registerService(InstanceProcess.java:536) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                                  
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:260) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                                  
        at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:473) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                                            
        at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:217) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                                                
       at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:816) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                                                
        at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:783) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                                          
       at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]                                                          
       at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70) [org.eclipse.equinox.util_1.0.400.v20120917-192807.jar:na]                                    
2015-07-06 15:00:47.959 [INFO ] [.service.AbstractActiveService] - HTTP Refresh Service has been started                                                                                      
2015-07-06 15:00:48.719 [INFO ] [.service.AbstractActiveService] - Exec Refresh Service has been started

Is this helpfull? For me it looks like my regex is malformed.... but what could be a right expression?

Thx Thomas

watou

unread,
Jul 6, 2015, 9:31:38 AM7/6/15
to ope...@googlegroups.com
Hi Thomas,

I see a Google Group thread here that seems to cover very similar ground about how to use RegEx transformations to parse out of value using an HTTP in-binding item.  I also see the wiki page for Transformations is also incomplete, so it's not like you have that much documentation to work from!

I hope the mentioned thread shines light on your RegEx.  I think it's very relevant!  

If that doesn't bear fruit, if your HTML input is "well formed" (as in, properly balanced tags), then the XSLT transform could be used instead.

...

Christoph Wempe

unread,
Jul 6, 2015, 10:30:04 AM7/6/15
to ope...@googlegroups.com
I don't think the http-binding is installed correctly.

There should be a log entry like this:
2015-06-28 01:29:25.611 [INFO ] [.service.AbstractActiveService] - HTTP Refresh Service has been started

Thomas Schäfer

unread,
Jul 6, 2015, 10:37:44 AM7/6/15
to ope...@googlegroups.com
The refresh service is started. I guess... as this regex expression works when i try it with edit++, thhere might be an issue with non showing symbols, type conversion errors, bracketing or escaping or "'.. thanks for your help I will see what the members of this other group found out. If it works I will post it to this mailgroup, too and maybe I find someone who could update the wiki.

Thomas

Thomas Schäfer

unread,
Jul 7, 2015, 1:47:54 AM7/7/15
to ope...@googlegroups.com
Hello... seems I have a problem with linebreaks not correctly recognized... so I guess the xslt should work, but I am a totaly newbie to that. Arggghhhh....

watou

unread,
Jul 7, 2015, 2:33:45 AM7/7/15
to ope...@googlegroups.com
The other Google Group thread I linked to you earlier discussed and covers newlines.  Give it a look.
Reply all
Reply to author
Forward
0 new messages