Custom Component: Nikobus

Hello Everyone,

Welcome to the thread for discussing Nikobus custom integrations. Nikobus is the predecessor of Niko Home Control.

To install this custom integration, please use HACS. The repository to add is: GitHub - fdebrus/Nikobus-HA.

For detailed installation instructions, refer to the GitHub page.

Your feedback is welcome!

1 Like

Hello,

Thank you for creating this addon.
Now I’m using OpenHAB with Nikobus, since HA couldn’t handle Nikobus.
I’m setting up an VM-ware to test HA, so I can see how this works, and that i can do the same as OpenHAB. Most integrations already working, only Nikobus has to been implemented. I have already a problem with the first setup sceen.
NikobusHA
I tested it with /dev/ttyUSB0, but get an unknown error. What do I have to use if I test in on a VM-ware. I use a Serial to USB device ‘Future Devices FT232R USB UART’. This is the same that I use with OpenHAB tha work withou any problem.

According to the hardware list in HA, /dev/ttyUSB0 sound be fine
NikobusHA1

Never mind. I got it to work.
My mistake. I forgot to copy the configuration-file :face_with_hand_over_mouth:

I need more tester to discover potential issues. Please revert with any findings, I will enhance the error reporting so it reports on the missing configuration file vs unkwown error :slight_smile:

Do you have a feedback module with feedback led’s ?

New release is out. With this new release as a button get pressed you can choose between various triggers to be used on your automation.

Check readme on github for full details.

  • nikobus_button_pressed
  • nikobus_button_released
  • nikobus_long_button_pressed
  • nikobus_short_button_pressed

I don’t have any feedmodules with led’s.
It’s very nice that you added nikobus_long_button_pressed, nikobus_shot_button_pressed

The only problem that that you can configure 4 types of duration in the Nikobus software.

  • 0 seconds
  • 1 second
  • 2 seconds
  • 3 seconds

I have used those 4 types in my configuration. It’s no problem to update the modules when pressing 0,1,2 or 3 seconds, because I can include all modules that have impact with all combinations.
The only thing that I can think about is that I use a 3 seconds press for the ‘All out’.
Now I use OpenHAB and there it can be detected. Then I trigger also a rule that shut off also all the other devices, besides Nikobus, that are connected. Like Shelly’s, Music amplifiers…

Thank you very much for the addon. I wrote a little program to convert the OpenHab config-file to ‘nikobus_button_config.json’, and ‘nikobus_module_config.json’ so I don’t have to config all modules an buttons again, because I have 152 device of nikobus now in HA.

We can modify the code to add trigger for

  • 0 seconds
  • 1 second
  • 2 seconds
  • 3 seconds

in the latest release, check nkbactuator.py

this piece of code is waiting for a button to be released, and calcule the time between start and end of press.

So today, it only uses self._long_press_threshold_ms which is defined by default to 500ms.

We could add
self._press_threshold_1000ms
self._press_threshold_2000ms
self._press_threshold_3000ms

and trigger nikobus_1sec_button_pressed, nikobus_2sec_button_pressed, nikobus_3sec_button_pressed, … accordingly

Let me know, I can code a new release if this matches your requirements

    async def _wait_for_release(self, address: str):
        try:
            start_time = self._last_press_time
            while True:    
                await asyncio.sleep(self._debounce_time_ms / 1000)
                current_time = time.monotonic()
                time_diff = (current_time - self._last_press_time) * 1000
                
                if time_diff >= self._debounce_time_ms:
                    _LOGGER.debug(f"Button release detected for address: {address}")
                    
                    # Calculate press duration
                    press_duration = (current_time - start_time) * 1000
                    
                    if press_duration >= self._long_press_threshold_ms:
                        _LOGGER.debug(f"Button long press detected for address: {address}")
                        self._hass.bus.async_fire('nikobus_long_button_pressed', {'address': address})
                    else:
                        _LOGGER.debug(f"Button short press detected for address: {address}")
                        self._hass.bus.async_fire('nikobus_short_button_pressed', {'address': address})
                    
                    await self._button_discovery_callback(address)

                    self._last_address = None
                    self._press_task_active = False
                    self._press_task = None
                    break

New release,…

Added events to be used in your automation trigger

  • nikobus_button_pressed

  • nikobus_button_released

  • nikobus_long_button_pressed

  • nikobus_short_button_pressed

  • nikobus_button_pressed_0 Button press detected for less than 1 second

  • nikobus_button_pressed_1 Button press detected for 1 second

  • nikobus_button_pressed_2 Button press detected for 2 seconds

  • nikobus_button_pressed_3 Button press detected for 3 seconds

Also fully support button with feedback leds

Thank you, I will try it.

Is it possible that I can’t install it via HACS, and that the automatic update also is not working. It’s no problem, I can always download it from github, but it would be easyer that I get a message that there is a newer version.

In HACS I only see this if I search for Niko.

You need to add my custom repository to HACS,

3 dots top right in the HACS screen then

Updated the readme file on the github accordingly

Setup Process

  1. Install the custom integration using HACS. Use the custom link below, or copy the repository to custom_repository/nikobus

Add to HACS

  1. Navigate to custom_repository/nikobus.
  2. Copy nikobus_module_conf.json.default to your Home Assistant configuration directory, remove the .default extension.
  3. Update the file to reflect your specific installation settings.
  4. Add Nikobus under Settings/Devices & services - Add Integration

Hey! I am sorry to ask these super basic questions, but:

My parents bought a Nikobus System when it was super new but have zero tech skills. i dont have a lot of knowledge with electrician skills, but i am a software dev. How does the hardware side of this work? for example, Nikobus-Interface für Niko Home Control I requires a pc link, pc logic or feedback module. What does this integration need? how does it(home assistant server) communicate with nikobus, using cable, wires?? how can i check if i have the module?

these are the notes from my electrician:

Ira
Wohnhaus
Bedienungsanleitungen
Nikobus Schaltaktoren Schaltmodul 05-000-02 Rollladenmodul 05-001-02 Dimcontroller Compact 05-008-02 Dimmer 05-707
Nikobus Bustaster, Sensoren, Interfaces Bustaster 05-060, 05-061, 05-064, 05-081, 05-085 UP-Bewegungsmelder Sensor XX-784 und Actor 05-785 UP-Interface 05-056, 05-057
Moeller Steuerrelais Steuerelais EASY512-DC-R Netzgerät EASY200-POW Dokumentation Programm
Busch-Rauchalarm Busch-Rauchalarm 6820 mit Relaismodul 6822
Elkron Sirene mit Netzgerät Elkron Sirene HP202LG Elkron Netzgerät AS02-S
TerraneoTorsprechanlage Sprechanlagen-Set 312124 Kabelbelegungsverzeichnis
Velux Kabelanschluß und Schaltplan

in english:

Residence
Operating instructions
Nikobus switch actuators Switch module 05-000-02 Roller shutter module 05-001-02 Dimcontroller Compact 05-008-02 Dimmer 05-707
Nikobus bus push-buttons, sensors, interfaces Bus push-buttons 05-060, 05-061, 05-064, 05-081, 05-085 Flush-mounted motion detector Sensor XX-784 and Actor 05-785 Flush-mounted interface 05-056, 05-057
Moeller control relay Control relay EASY512-DC-R Power supply unit EASY200-POW Documentation Program
Busch-Smoke alarm Busch-Smoke alarm 6820 with relay module 6822
Elkron siren with power supply unit Elkron siren HP202LG Elkron power supply unit AS02-S
TerraneoTor intercom system Intercom set 312124 Cable assignment directory
Velux cable connection and wiring diagram

Übersetzt mit DeepL DeepL The right app or extension for every translation

You will need a PC-Link module, a Feedback module or a PC-Logic module, they all look the same

image

From the list of components you shared, it seams you do not have any. Then go for a PC-Link module. They are plenty on second hand market.

Next, your need to connect this module towards your HomeAssistant server, 2 options over USB or TCP/IP with a bridge.

Common to both
RJ11 cable
RJ11 to DB9
Here is a tutorial about the USB cable
(Home-Made Cable RJ11 / RS232 (DB9) for Niko PC-Link - MForge)

There are many cable configuration possible, if you go for home made, you will be sure of the config of the cable. If you buy already made rj11 to DB9 make sure it matches the wiring diagram as descripbed in the tutorial.

if USB
USB 2 SERIAL
image

if TCP/IP
HF2211

Detailled config for HF2211 is available on my github

At the moment I am using openhab as integration for my nikobus setup, but I really want to drop that setup for this custom Nikobus Integration. I am using a serial-to-usb connector between the feedback module and the Pi running my home assistant. Everything seems fine configuration wise, however, I don’t seem to be able to read or write the outputs of the controllers. Every entity is indicated as OFF, and switching it to ON and OFF again doesn’t have any effect on my lights.
The hardware works fine with openhab, so I don’t think anything is wrong there.

Any idea what I am missing?

Here is some logging:

2024-06-27 13:54:46.765 DEBUG (MainThread) [custom_components.nikobus.config_flow] Starting options step with input: None
2024-06-27 13:54:46.766 DEBUG (MainThread) [custom_components.nikobus.config_flow] Creating entry with data: {'connection_string': '/dev/ttyUSB0', 'has_feedback_module': True}
2024-06-27 13:54:46.767 DEBUG (MainThread) [custom_components.nikobus] Starting setup of the Nikobus integration
2024-06-27 13:54:46.768 DEBUG (MainThread) [custom_components.nikobus.nikobus] Creating Nikobus instance with connection string: /dev/ttyUSB0
2024-06-27 13:54:46.774 INFO (MainThread) [custom_components.nikobus.nkbconnect] Connected to serial port /dev/ttyUSB0
2024-06-27 13:54:46.774 INFO (MainThread) [custom_components.nikobus.nkbconnect] Nikobus handshake successful
2024-06-27 13:54:46.775 INFO (MainThread) [custom_components.nikobus.nkbconfig] Loading module data from /config/nikobus_module_config.json
2024-06-27 13:54:46.780 INFO (MainThread) [custom_components.nikobus.nkbconfig] Loading button data from /config/nikobus_button_config.json
2024-06-27 13:54:46.781 INFO (MainThread) [custom_components.nikobus.nkbconfig] Button configuration file not found: /config/nikobus_button_config.json. A new file will be created upon discovering the first button.
2024-06-27 13:54:46.781 INFO (MainThread) [custom_components.nikobus.nikobus] Nikobus instance created and connected successfully
2024-06-27 13:54:46.782 INFO (MainThread) [homeassistant.components.switch] Setting up nikobus.switch
2024-06-27 13:54:46.785 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_1
2024-06-27 13:54:46.786 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_2
2024-06-27 13:54:46.789 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_3
2024-06-27 13:54:46.790 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_4
2024-06-27 13:54:46.792 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_5
2024-06-27 13:54:46.795 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_6
2024-06-27 13:54:46.796 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_7
2024-06-27 13:54:46.798 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_8
2024-06-27 13:54:46.800 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_9
2024-06-27 13:54:46.802 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_10
2024-06-27 13:54:46.803 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_11
2024-06-27 13:54:46.804 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_boven_out_12
2024-06-27 13:54:46.807 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_1
2024-06-27 13:54:46.809 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_2
2024-06-27 13:54:46.810 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_3
2024-06-27 13:54:46.812 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_4
2024-06-27 13:54:46.813 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_5
2024-06-27 13:54:46.815 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_6
2024-06-27 13:54:46.818 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_7
2024-06-27 13:54:46.819 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_8
2024-06-27 13:54:46.820 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_9
2024-06-27 13:54:46.822 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_10
2024-06-27 13:54:46.824 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_11
2024-06-27 13:54:46.825 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_12_onder_out_12
2024-06-27 13:54:46.827 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_4_out_1
2024-06-27 13:54:46.829 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_4_out_2
2024-06-27 13:54:46.830 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_4_out_3
2024-06-27 13:54:46.842 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nikobus entity: switch.nbs_4_out_4
2024-06-27 13:54:46.843 INFO (MainThread) [homeassistant.components.light] Setting up nikobus.light
2024-06-27 13:54:46.844 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.nikobus entity: light.nbd_out_1
2024-06-27 13:54:46.846 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.nikobus entity: light.nbd_out_2
2024-06-27 13:54:46.848 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.nikobus entity: light.nbd_out_3
2024-06-27 13:54:46.850 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.nikobus entity: light.nbd_out_4
2024-06-27 13:54:46.851 INFO (MainThread) [homeassistant.components.cover] Setting up nikobus.cover
2024-06-27 13:54:46.852 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up nikobus.binary_sensor
2024-06-27 13:54:46.852 INFO (MainThread) [homeassistant.components.button] Setting up nikobus.button
2024-06-27 13:54:46.861 INFO (MainThread) [custom_components.nikobus.nkbcommand] Nikobus Command Processing starting
2024-06-27 13:54:46.861 INFO (MainThread) [custom_components.nikobus.nkblistener] Nikobus Event Listener starting
2024-06-27 13:55:13.726 DEBUG (MainThread) [custom_components.nikobus.nkblistener] Listener - Receiving message: $0511$1C20E503EAFFF0000000975379
2024-06-27 13:55:13.727 DEBUG (MainThread) [custom_components.nikobus.nkblistener] Adding message to response queue: $0511$1C20E503EAFFF0000000975379
2024-06-27 13:55:46.700 DEBUG (MainThread) [custom_components.nikobus.nkblistener] Listener - Receiving message: $1CAD9100FFF00000000D7F94A
2024-06-27 13:55:46.700 DEBUG (MainThread) [custom_components.nikobus.nkblistener] ** Feedback module refresh command answer: $1CAD9100FFF00000000D7F94A
2024-06-27 13:55:46.700 DEBUG (MainThread) [custom_components.nikobus.nikobus] Processing feedback module data: module_address=91AD, group=1, module_state=FFF00000000D
2024-06-27 13:56:20.394 DEBUG (MainThread) [custom_components.nikobus.nkblistener] Listener - Receiving message: $1CE18202FFFFFF000000E3B1A6
2024-06-27 13:56:20.395 DEBUG (MainThread) [custom_components.nikobus.nkblistener] ** Feedback module refresh command answer: $1CE18202FFFFFF000000E3B1A6
2024-06-27 13:56:20.395 DEBUG (MainThread) [custom_components.nikobus.nikobus] Processing feedback module data: module_address=82E1, group=1, module_state=FFFFFF000000
2024-06-27 13:56:45.697 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Setting output state - Address: AD91, Channel: 8, Value: 255
2024-06-27 13:56:45.698 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Queueing command: $1E1691AD00FF00000000FF9BBDA8
2024-06-27 13:56:45.700 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Processing command: $1E1691AD00FF00000000FF9BBDA8
2024-06-27 13:56:45.700 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Sending command: $1E1691AD00FF00000000FF9BBDA8
2024-06-27 13:56:45.703 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Command sent successfully
2024-06-27 13:56:45.703 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Command executed: $1E1691AD00FF00000000FF9BBDA8
2024-06-27 13:56:46.992 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Setting output state - Address: AD91, Channel: 8, Value: 0
2024-06-27 13:56:46.993 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Queueing command: $1E1691AD000000000000FFCF02B7
2024-06-27 13:56:46.994 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Processing command: $1E1691AD000000000000FFCF02B7
2024-06-27 13:56:46.995 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Sending command: $1E1691AD000000000000FFCF02B7
2024-06-27 13:56:46.995 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Command sent successfully
2024-06-27 13:56:46.995 DEBUG (MainThread) [custom_components.nikobus.nkbcommand] Command executed: $1E1691AD000000000000FFCF02B7
2024-06-27 13:56:53.367 DEBUG (MainThread) [custom_components.nikobus.nkblistener] Listener - Receiving message: $0516$0516$1CAD9100FFFFFF00FFFF8155F1
2024-06-27 13:56:53.368 INFO (MainThread) [custom_components.nikobus.nkblistener] Ignored message: $0516$0516$1CAD9100FFFFFF00FFFF8155F1

What’s your module address in the module_config.json file ? Have you copied it from openhab integration or Nikobus software ?

You need to record it as in the nikobus software, not openhab.

eg module with address 91AD in openhab is AD91 in Nikobus software and must be AD91 for this integration to work.

Could you confirm ?

Party-time … indeed, I was using the openhab address, as I don’t think I can use the original nikobus software anymore :upside_down_face:
It is working now, thanks a lot!

Do you have button with feedback ? since you setup with ‘has_feedback_module’: True.

If you do, I’m very interested at received your experience, button with feedback integration is a new feature, not fully tested yet.

thanks !

I had 3 of them, 2 are totally broken and cannot be used anymore.
That’s a little off-topic, but more and more of those bus-push-buttons are falling apart, and cannot be replaced anymore :face_with_symbols_over_mouth:

I’ll test the last one later on, and let you know.

There are some on 2ememain.be, pitty it’s pickup only… too far for me.

2nd hand … I wouldn’t do that anyway, chances are they will also fall apart after a short period.

Anyway, I have a technical remark, not related to the feedback leds yet: I have 2 controllers with 12 outputs, 1 controller with 4 outputs and 1 dimmer with 4 outputs.
I don’t have any buttons registered just yet, so the state of my outputs is based on the interval reading, I guess?

I have the feeling that:

  • outputs 7-12 are never read, for instance the room I am sitting in right now is output 8, and it is always indicated as OFF.
  • outputs 1-6 are read, however, their ON/OFF-indication flips sometimes without any trigger to do so, as if reading the state of controller 1 also changes state of controller 2 or something like that

If your buttons are not defined yet, and you use feedback module refresh rate, which is default to Nikobus and cannot be changed. It could be up to 30min for a specific module refresh. That’s why it’s important to define your buttons that will keep the integration in sync with Nikobus.

To your problem, try « configure » in the integration, remove feedback module and try a refresh rate of 120secs, so all modules will be refreshed every 2minutes.

See how that behave, next share your modules configuration file and a debug log over a full refresh period.