Seite 1 von 1

My experience connecting Landis-GYR to Openhab via SHRDZM

Verfasst: 20. Okt 2024 20:08
von wjones
Hi All,

Working closely with Erich from Shrdzm, we have successfully managed to integrate with my new smartmeter in Switzerland.
As there were a few issues during this process, I have detailed them below.

My setup:
  • Meter : Landis Gyr e450
  • Connectivity: RJ12 port using M-Bus (DLMS/COSEM)
  • Home automation system : Openhab 4.2 (latest version)
  • System : Raspberry Pi 4
  • Connection: MQTT (Mosquitto installed on RPI)
The RJ12 data stream from the smartmeter is not encrypted with R/E, so this makes the setup simpler.

Settings in SHRDZM:
  • Baud: 2400
  • RequestPin: OFF
  • Cipherkey: Must be 32 digits, but not used - I used 000...001
  • rxpin: 3
  • invertrx: NO
  • sendRawData: YES
  • autoReboot: 0
Cable:
The RJ12 cable provided by SHRDZM (which is 6P6C) :

Code: Alles auswählen

1 2 3 4 5 6
| | | | | |
1 2 3 4 5 6
This cable does not work for me - I tried different cables (with the same configuration).
Sometimes I got 3-4 packets of good data, then just invalid data.

After lots of headscratching and troubleshooting, I started to try other cables.
Finally, I discovered the following cable which does work:

Code: Alles auswählen

1 2 3 4 5 6
    | |
     X
    | |
1 2 3 4 5 6
This is a 2 core RJ11 crossover cable (6P2C) used for ADSL / fax machines. I found this in my old box of cables, they are not easy to find online.
This cable worked immediately - No config changes needed in settings (e.g. I was expecting RX pin to change)

Once I had the above, I was able to see the data coming into SHRDZM in the last measurement window.

Code: Alles auswählen

(0)timestamp=2024-10-20T19:51:25
(1)1.7.0=568
(2)2.7.0=0
(3)1.8.0=5853648
(4)2.8.0=15317
(5)31.7.0=1.37
(6)51.7.0=0.57
(7)71.7.0=1.57
(8)32.7.0=238
(9)52.7.0=237
(10)72.7.0=237
(11)16.7.0=568
(12)uptime=0000:00:16:00
Then it's time to send the data to Openhab via MQTT.

Gateway settings IN SHRDZM:
  • MQTT Enable: Yes
  • MQTT Broker: IP of my RPI box
  • MQTT Port: 1883
  • MQTT ClientID: SHRDZM
  • MQTT User: Not used (see Mosquitto.conf below)
  • MQTT Password: Not used (see Mosquitto.conf below)
  • MQTT Gateway topic: SHRDZM/Suisse
  • MQTT State topic: SHRDZM/Suisse/Suisse
  • MQTT Sensor topic: SHRDZM/Suisse/Suisse/sensor
  • Send Values in JSON: Yes
  • Modbus-TCP enabled : No

Mosquitto.conf
Mosquitto is installed on my RPI, I will not explain how to install this - You can find easily with google.
In my installation it is under /etc/mosquitto/mosquitto.conf (may be different for you)

Code: Alles auswählen

# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /run/mosquitto/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d
listener 1883
allow_anonymous true
Openhab:
Need to install following:
  • MQTT binding
  • JINJA-Transformations
  • JSONPath-Transformations
This gives the Homeassistant MQTT binding https://www.openhab.org/addons/bindings ... assistant/ which is supported by SHRDZM.

You have to configure the MQTT broker "thing" in openhab:
  • Broker hostname/IP : As MQTT is on the same RPI as openhab, the IP is the same as the RPI (and the same as what is configured in SHRDZM gateway)
  • Broker port: 1883 (same as in mosquitto.conf)
  • Enable discovery: Yes (may need to view advanced)

After this, openhab auto-discovered 1 "thing" which I had to add.
Inside that thing there are 13 channels, each one representing one of the data points from the smartmeter.

Hope this helps someone to set up their system, I guess the steps are similar for HomeAssistant too.

Cheers
Will