THIS PAGE IS OUTDATED
Integrate HAN-port of Aidon, Kaifa and Kamstrum meters used in Norway with Home Assistant. The integration uses local push, and Home Assistant will be notified as soon as a new measurement is available (2 sec, 10 sec and every hour depending on sensor type and meter type).
This integration supports connecting to M-BUS (also called Meter-Bus) device using serial port (often USB) or TCP-IP address/port.
You need to have a M-BUS slave device connected to to the HAN (Home Area Network) port of your meter. The HAN-port is a RJ45 socket where only pin 1 and 2 is used. Connect wires from pin 1 and 2 to the M-BUS slave device. Then connect the M-BUS device to your computer. Most USB devices become a serial device when connected. You can then relay (i.e. using net2ser and socat) the signal to TCP/IP if your device is connected to a remote computer.
This integration has been tested with several simple USB devices sold on e-bay. Search for M-BUS USB slave. Note that some devices uses EVEN parity (default is ODD) when connecting.
Search for AMSHAN on Configuration/Integrations page after installing (most simple is to use HACS). Please not that some M-BUS serial devices uses EVEN parity (the default is ODD).
When using serial device setup, it is often usefull to use a device-by-id device name on Linux to have a stable device name. You then use a device name starting with /dev/serial/by-id/. You can find the device id in hardware menu of the host if you are running Hassio (select Supervisor -> System -> Host -> ... -> Hardware).
It is possible to configure a scale factor of currents, power and energy measurements. Some meters are known to not be connected directly to main power, but through a current transformer with a reduction factor of 50. In that case you can use the scale factor to get correct values.
You can connect to a remote M-BUS device using TCP/IP by selecting connection type "network" in setup.
If your device is connected to a Linux host, then ser2net is a good choice to run on the host to bridge the typical M-BUS serial interface to TCP/IP. This ser2net config (/etc/ser2net.conf) line makes a 2400 baud, even parity, 8 data bits and one stop bit serial M-BUS device available on TCP/IP port 3001:
3001:raw:600:/dev/ttyUSB0:2400 8DATABITS EVEN 1STOPBIT
Similar for ser2net yaml config (/etc/ser2net.yaml):
connection: &han
accepter: tcp,3001
enable: on
options:
kickolduser: true
connector: serialdev,/dev/ttyUSB0,2400e81,local