New Binding: Wireless M-Bus / Techem heat cost allocators

OK, just ask, I’ll do my very best to help.

I had another thought on that, and maybe it could be a good idea to lower complexity for the first step by not running under openHAB but first program a simple vanilla Java client for your hardware setup on top of the jmbus library. That should lower testing/debugging times and simplify the development setup.
As soon, as you get some bytes back and parsed, it should be easy to incorporate the running code into the binding.
You wouldn’t need an OpenHAB SDK/IDE or build jmbus at first, but only include the lib in a simple eclipse Java project. There are some code examples coming with jmbus, that may be working as a good starting point.

Yep - I’ll have to start with “Hello World” :slight_smile: … I’ve sent a request to the jmbus developers to ask about that optical mode to ask if it is supported, and if they can give us additional information.

I’ll get back to you as soon as I have news on either front.

with kind regards,
Patrik

Hi Hanno (@friesenkiwi),

to get more information about the required modification I contacted the support from the USB opto-interface (http://www.relay.de). Excellent service; they explained to me the wakeup mechanism and sent me an excerpt from the respective standard:



To achieve this the interface needs 1st to be set to parity “NONE”:

	0.00020890 IOCTL_SERIAL_SET_BAUD_RATE       VCP0	SUCCESS	Rate: 2400		
28	0.00022118 IOCTL_SERIAL_SET_LINE_CONTROL	VCP0	SUCCESS	StopBits: 1 Parity: NONE WordLength: 8	

Then a squere-wave wakup signal needs to be sent to wake-up the device (0x55):

34	0.00041242 IRP_MJ_WRITE	VCP0	SUCCESS	Length 100: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 	
35	3.07034882 IRP_MJ_WRITE	VCP0	SUCCESS	Length 730: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 	

That will wake the device and after the define waiting time the interface can be switched (parity “EVEN”) to use M-Bus to query the sensor(s):

43	0.00023654 IOCTL_SERIAL_SET_LINE_CONTROL	VCP0	SUCCESS	StopBits: 1 Parity: EVEN WordLength: 8	
48	0.00024269 IRP_MJ_WRITE	                    VCP0	SUCCESS	Length 5: 10 7B FE 79 16 			
50	0.00000461 IRP_MJ_READ	                    VCP0	SUCCESS	Length 2: 68 79 

I do not have a working IDE setup; that will take me some time - but I hope this helps already to asses if that can be achieved & how much changes would be required.

with kind regards,
Patrik

Wow, that sounds great! Good, that relay is open to support. I am a bit sceptical about Fraunhofer/openMUC though, because I tried to contact them once and didn’t get an answer :frowning:

The provided information sounds as if it should be doable without too many problems. I think, you wouldn’t need a complex IDE setup, a simple Eclipse installation should be sufficient for the first steps with jmbus. Maybe I have some time next week to put together a raw project template. Do you have a Github account, so I could invite you to the repo for easier collaboration?

Were you already able to use[quote=“patrik_gfeller, post:18, topic:16974”]
“Normal” serial M-Mus test software
[/quote] as mentioned before to access the meter?

Cheers,
Hanno

yep: that works ok (if the above mentioned sequence is used):

Yes: pgfeller

As already mentioned - I’m a complete new to those things; but I’ll do my best to help. Over the weekend I should find time to try to setup an environment :slight_smile: .

with kind regards,
Patrik

Ah, that looks good! It will really be helpful to mimic that behaviour by means of jmbus and debug the communication.

Can you copy the RX buffer and post it here? It looks like a standard M-Bus message as I have decoded in the binding, so I might be able to deduce some first raw data from it.

… here we go:
M-BUS-1.log.xml (1.0 KB)

with kind regards,
Patrik

Hi friesenkiwi

This is really great work!

My appartment building have approx 300 appartments, all installed with bothTechem heating meters and water meters.

Do you know how precisely the room temperature is measured by the Techem heating meter?

I don’t have programming skills, but I can implement your binding and give you feed back if wanted?

Thank you

Thank you,
glad you like it! :slight_smile:
But remember, the Techem HKV (Heizkostenverteiler/Heat cost allocators) are NO heat meters! The numbers they show are dimensionless and have no unit, they only carry some relative sense in the overall view and in context with the energy bill and only if they are calibrated correctly to the radiator.

Now, the thermometers included are measuring °C and the messages carry a precision of 0.01°C. I cannot say if they can actually measure that exact. The manufacturer documentation doesn’t mention this.

Regarding the water meters, they should be received by the stick and the library, but since it is not really implemented yet, they won’t show up in the UI, but you will probably see some debug output in the system console/log.

Now, a last word on privacy: You mentioned your house and 300 apartments. Please do not consider to receive all messages of all allocators/meters of all apartments in real time.

This data shouldn’t be transmitted in the first place, especially not without the knowledge and consent of the resident and especially not unencrypted! You have additional knowledge, which allocator and meter is installed in whose apartment, so to you it is personal information of your tenants.
It is one thing to have the water and heat consumptions for a long-time accumulation period such as one year, but it is a totally different thing to have not only such information but even the single room temperatures in a resolution around 1 minute.
I certainly don’t want my landlord to have such information about me and I would consider it creepy, intrusive, offensive and downright illegal for her/him to try.

Please don’t refer that to you specifically, I am only expressing a general thought of ethics here.
So, provided the privacy of the tenants is not violated, yes, of course you can use the binding, I would be very happy to hear of your feedback and to help.

Cheers

Hey friesenkiwi,

many thanks for adding this addon to openhab! I also live in a flat with the Techem HKV, therefor I bought the Amber USB Stick to log the details of my heating behaviour.

Unfortunaly, im not able to see any HKVs, but let me start from the beginning with what i have done…

According to your manual at github, i downloaded your release Github Release and placed it in the opehab addon folder (with changed permissions).
The addon is visible in openhab, and i successfully added the Amber USB Stick to my THINGS
grafik

But…
I cannot add any Techem HKVs, cause none of them are visible via the inbox of openhab, nor via a manually added thing, where i added manually the ID, see the following screenshot:

I added some channels to see, if values are updated for my manually set thing, but they are not:


Any ideas?

no one?

the above mentioned problem is fixed, i cannot say why, but i can see my devices in the inbox page. everthing works.

but no i am faced with another problem. when this binding is active, my symlinks are not working anymore. meaning, that all other usb sticks (which are connected via a symlink to my device) are not recogniced anymore correctly.

after having installed this binding here, my entire communication was broken with the other bindings (e.g. zwave, maxcul, jeelink lacrosse…)

See the following link: https://community.openhab.org/t/symlinks-not-working/53082/4?u=baggerfahrer

Is anyone facing the same issue?

Hey, @anon71383850, it’s great to hear you are using the binding, I’m glad it’s of interest!

Yes, you are right, that version you are currently using is quite old and has some issues, especially with regard to the serial interface. In the background we are working on implementing more devices, fixing bugs and improving code quality to put up a PR to include it into the main openHAB codebase soon.

This is the latest development version, which should be working now out of the box and conflict-free with other serial bindings like Z-wave.
We are using it stable in several systems in parallel to Z-wave.

Can you please check out, if this works for you? Also, to debug, I would advice to put the following into /var/lib/openhab2/etc/org.ops4j.pax.logging.cfg.

# Define WMBus file appender
log4j2.appender.wmbus.type = RollingRandomAccessFile
log4j2.appender.wmbus.name = WMBUS
log4j2.appender.wmbus.fileName = ${openhab.logdir}/wmbus.log
log4j2.appender.wmbus.filePattern = ${openhab.logdir}/wmbus.log.%i
log4j2.appender.wmbus.append = true
log4j2.appender.wmbus.layout.type = PatternLayout
log4j2.appender.wmbus.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n
log4j2.appender.wmbus.policies.type = Policies
log4j2.appender.wmbus.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.wmbus.policies.size.size = 100MB

# Configure WMBus logging
log4j2.logger.de_unidue_stud_sehawagn_openhab_binding_wmbus.level = TRACE
log4j2.logger.de_unidue_stud_sehawagn_openhab_binding_wmbus.name = de.unidue.stud.sehawagn.openhab.binding.wmbus
log4j2.logger.de_unidue_stud_sehawagn_openhab_binding_wmbus.additivity = false
log4j2.logger.de_unidue_stud_sehawagn_openhab_binding_wmbus.appenderRefs = wmbus
log4j2.logger.de_unidue_stud_sehawagn_openhab_binding_wmbus.appenderRef.wmbus.ref = WMBUS

It will create a new log at /var/log/openhab2/wmbus.log which you can then tail -f to see a live trace of what is happening, which messages are received and how they get parsed.

I’m looking forward to your feedback and will be happy to help out or discuss bug reports or feature ideas.

Cheers,
Hanno

many thanks for this great work! I downloaded and tested the new release, and it works like a charm.
my problems with the symlinks and the serial ports are gone; all the other bindings are working again, like zwave, maxcul and jeelink lacrosse, which are implemetend in my system via different serial ports.

at the moment, debugging is not necessary anymore, so i leave the step you mentioned out with the hint to add some lines to the logging.cfg.

except you need it from me, then i will support! but for me everything is fine at the moment.

Good to hear! :slight_smile:
If you are willing to do the logging, maybe for an hour or day, it would be interesting to see if there are any other devices around you sending, that the binding doesn’t already know.

Please let me know all other comments, questions or feature ideas.

Cheers,
Hanno

i implemented the change of the logging just now; you will get the logfile propably within this weekend.

hey friesenwiki,

see attached my logfile. I just stopped logging this binding again, meaning that the logging content is brand new :slight_smile:

but due to the fact, that this file is 70mb in size, i cannot upload it here… i will send you an pm.

if you see unknown logging content, it could be because of the following device, which is also from techem and maybe communicating in wireless mbus.

this is a hot-water counter, meaning that the used hot water consumption is counted.

Thanks for the logging!
Yes, those water meters are quite popular as well and also use a proprietary encoding by Techem. It has already been uncovered by the people at FHEM (https://svn.fhem.de/trac/browser/trunk/fhem/FHEM/32_TechemWZ.pm#L202) so should be implementable for openHAB as well. But it may take some time until we find the time to do the implementation.

Does the wmbus binding have support for Kamstrup Multicast 21 water meters as well?
Which hardware is needed, except for the Kamstrup Multical 21. I believe some sort of USB dongle or something… I tried your Github, but there isn´t much document in there.

1 Like