Möhlenhoff Alpha BUS - Solution

Documentation has an typo JSONPATH vs XPATH

:)))

Still something else is wrong with that example. Look what i get:

with this: String Info “Info [XPATH([name()=‘liveStreams’]/[name()=‘stream’]/[name()=‘label’]/) %s]” {http="<[http://campulverde.info/liveStreams.xml]"}

you have to give a closer look :wink:

there is something missing " : "

azimuth’]/):%s °C]

I added “:”. Still no difference then the last print screen :frowning:

[name()='PTZStatus']/*[name()='AbsoluteHigh']/*[name()='azimuth']/):%s °C]

vs

[name()='liveStreams']/[name()='stream']/[name()='label']/) %s]

you could try it with

String Info "Info [XPATH(/*[name()='liveStreams']/*[name()='stream']/*[name()='label']/):%s]" {...}

@gsmatei and using code fences makes reading the post a lot easier.

1 Like

Sorry for not using code fences.

Nope, still not working with the same code from you :frowning:

String Info "Info [XPATH(/*[name()='liveStreams']/*[name()='stream']/*[name()='label']/):%s]"  {http="<[http://campulverde.info/liveStreams.xml]"}

But you have installed the XPATH transformation!

What does the log say?

@gsmatei this works

String http_Info "Info [%s]" {http="<[http://campulverde.info/liveStreams.xml:60000:XPATH(/*[name()='liveStreams']/*[name()='stream']/*[name()='label'])]"}
2 Likes

Looks like it’s installed.

Log file says:

2018-05-07 15:46:22.416 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type 'http' of item 'Info' could not be parsed correctly.
org.eclipse.smarthome.model.item.BindingConfigParseException: bindingConfig 'http://campulverde.info/liveStreams.xml' doesn't represent a valid in-binding-configuration. A valid configuration is matched by the RegExp '(.*?)(\{.*\})?:(?!//)(\d*):(.*)'
	at org.openhab.core.binding.internal.BindingConfigReaderDelegate.processBindingConfiguration(BindingConfigReaderDelegate.java:50)[176:org.openhab.core.compat1x:2.1.0]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:325)[123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:297)[123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:182)[123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:367)[123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:286)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:136)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:234)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent(FolderObserver.java:297)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.core.service.WatchQueueReader.run(WatchQueueReader.java:206)[98:org.eclipse.smarthome.core:0.9.0.b5]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

Yes!!! Now it’s working!!!

String http_Info "Info [%s]" {http="<[http://campulverde.info/liveStreams.xml:60000:XPATH(/*[name()='liveStreams']/*[name()='stream']/*[name()='label'])]"}

Super thx!!!

Thanks, I was basically copying the one use for openhab service
Learned something, always good

Just as an additional information, there is/was a bug in the label transformation. But it schould be fixed in future reaeases.
Thats why the transformation had to be done at the binding which is a better solution if the content of the xml is not needed anywhere else, imho.

Hey!

I´d like to receive the current tv show via xml, this expression would normaly return me the current running tv-show on that specific channel 'ARD':

string(/rss/channel/item[dc:subject='ARD']/title)

With the help of this post, I was able to create an Item which returns me the channel name as result, as expected. But how can I add the value that I´m searching for 'ARD' and the desired output value in the field <title>?

String      TV_Channel_ARD_CurrentShow      "Aktuell laeuft [%s]"     { http="<[http://www.texxas.de/tv/hauptsenderJetzt.xml:3600000:XPATH(/*[name()='rss']/*[name()='channel']/*[name()='item']/*[name()='dc:subject'])]"}

i have a similar problem:
i have this register:


whit this string:

String dato “Info [%s]” {http="<[http://192.168.1.115/7:6000:XPATH(/[name()=‘modbusregisters’]/[name()=‘register’]/*[name()=‘value’])]"}

but doesn’t work can anyone help me please?

Hi again,

now i want change the setpoint from the temperature in my rooms. I have think that i only must change the sign in my code but it don´t work. Can anybody help me. Thanks

Here my code that i can receive my actual temperatue

http="<[HeizungOG:10000:XPATH(/Devices/Device/HEATAREA[@nr=‘3’]/T_ACTUAL/text())]"

and that the code for change the setpoint

http=">[HeizungOG:10000:XPATH(/Devices/Device/HEATAREA[@nr=‘3’]/T_ACTUAL/text())]"

What it´s wrong ?

Sorry I have the exact same hardware for my floor heating and this is the first time I am using xpath.
Is there no function to return a number value from the xml?
<T_ACTUAL>20.8</T_ACTUAL>

cheers

Hi together, now Openhab 3 is here. How i can read now the infos from the xml file ?

Hi,

here is my Thing file for the Alpha 2:

Thing http:url:MoehlenhoffCacheStaticEG "MoehlenhoffCacheStaticEG" [ baseURL="http://192.168.1.3/data/static.xml", refresh=30]  {        
   Channels:  
      Type number : FBH_Wohnen_IST [ stateTransformation="XPATH:/Devices/Device/HEATAREA[@nr='1']/T_ACTUAL/text()", mode="READONLY" ]   
      Type number : FBH_WC_IST [ stateTransformation="XPATH:/Devices/Device/HEATAREA[@nr='7']/T_ACTUAL/text()", mode="READONLY" ]
	  	  
	  Type number : FBH_Wohnen_SOLL [ stateTransformation="XPATH:/Devices/Device/HEATAREA[@nr='1']/T_TARGET/text()", mode="READONLY" ]   
      Type number : FBH_WC_SOLL [ stateTransformation="XPATH:/Devices/Device/HEATAREA[@nr='7']/T_TARGET/text()", mode="READONLY" ]   
	  
	  Type number : FBH_Wohnen_STATE [ stateTransformation="XPATH:/Devices/Device/HEATCTRL[@nr='1']/HEATCTRL_STATE/text()", mode="READONLY" ]   
      Type number : FBH_WC_STATE [ stateTransformation="XPATH:/Devices/Device/HEATCTRL[@nr='7']/HEATCTRL_STATE/text()", mode="READONLY" ]
	  
	  Type number : FBH_Wohnen_ACTOR [ stateTransformation="XPATH:/Devices/Device/HEATCTRL[@nr='1']/ACTOR/text()", mode="READONLY" ]   
      Type number : FBH_WC_ACTOR [ stateTransformation="XPATH:/Devices/Device/HEATCTRL[@nr='7']/ACTOR/text()", mode="READONLY" ]
	  
	  Type number : FBH_Wohnen_ACTOR_PERCENT [ stateTransformation="XPATH:/Devices/Device/HEATCTRL[@nr='1']/ACTOR_PERCENT/text()", mode="READONLY" ]   
      Type number : FBH_WC_ACTOR_PERCENT [ stateTransformation="XPATH:/Devices/Device/HEATCTRL[@nr='7']/ACTOR_PERCENT/text()", mode="READONLY" ]
}

and here the Items for that:

// IST TEMPERATUREN FBH
Number FBH_Wohnen_IST "Wohnen [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_Wohnen_IST" }
Number FBH_WC_IST "WC [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_WC_IST" }

// SOLL TEMPERATUREN FBH
Number FBH_Wohnen_SOLL "Wohnen [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_Wohnen_SOLL" }
Number FBH_WC_SOLL "WC [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_WC_SOLL" }


//VENTIL AKTIV FBH
Number FBH_Wohnen_STATE "Wohnen [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_Wohnen_STATE" }
Number FBH_WC_STATE "WC [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_WC_STATE" }


//AKTOR AKTIV FBH
Number FBH_Wohnen_ACTOR "Wohnen [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_Wohnen_ACTOR" }
Number FBH_WC_ACTOR "WC [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_WC_ACTOR" }


//AKTOR OEFFNUNGSGRAD
Number FBH_Wohnen_ACTOR_PERCENT "Wohnen [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_Wohnen_ACTOR_PERCENT" }
Number FBH_WC_ACTOR_PERCENT "WC [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_WC_ACTOR_PERCENT" }
1 Like

edit:
The above is to READ from the base unit.
If you want to WRITE new Target Temps (Soll Temperatur) you can do this:

Thing:

Thing http:url:MoehlenhoffCacheChangesEG "MoehlenhoffCacheChangesEG" [ baseURL="http://192.168.1.3/data/changes.xml", commandMethod="POST", contentType: application/xml]  {        
   Channels:  
      Type number : FBH_Wohnen_SOLL [ commandTransformation="JS:Alpha2_FBH_Wohnen.js", mode="WRITEONLY"  ]   
      Type number : FBH_WC_SOLL [ commandTransformation="JS:Alpha2_FBH_WC.js", mode="WRITEONLY"  ]   
 	  
}

You can add a SECOND channel for the existing item that already READS the temp from the base unit - so this items now REPLACE the existing items from above post!
// SOLL TEMPERATUREN FBH

Number FBH_Wohnen_SOLL "Wohnen [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_Wohnen_SOLL", channel="http:url:MoehlenhoffCacheChangesOG:FBH_Wohnen_SOLL"  }
Number FBH_WC_SOLL "WC [%s]" { channel="http:url:MoehlenhoffCacheStaticEG:FBH_WC_SOLL", channel="http:url:MoehlenhoffCacheChangesOG:FBH_WC_SOLL"  }

Finally you need the JS script from the thing in your conf/transform folder:

(function(i) {
  var str1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <Devices> <Device> <ID>YOUR_ID_HERE</ID> <HEATAREA nr=\"7\"> <T_TARGET>";
  var str3 = "</T_TARGET> </HEATAREA> </Device> </Devices>";
  result = str1 + i + str3;
  return result;
})(input)

I made one script per room. Probably you can also have a case statement somehow in the script to copy the correct “Heat Area”. I did not find out how to tell which item triggered the script.
If you improve that part … let me know.

By this you have a single Target Temp item per room. You can still READ a new target temp if it was changed by someone at the room controller. And you can WRITE from openhab to base unit. (remark: The base unit can take up to 10 mins until you see the change on the room controller!! - however when you access the webserver on the base unit you see instantly that your target temp was updated from openhab)

@Maddin2017 can you change the Title and Attributes of this Thread to something link Möhlenhoff Alpha BUS → and push it to the solutions section? So other users can better find and copy.

1 Like