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