Home Assistant Community

Add Integration for Niko Home Control 2

#1

Hi,

I would like to use HA with my Niko Home Control installation, it uses the TCP protocol.
I have found this Python library, so it looks like its possible to integrate it.
https://github.com/NoUseFreak/niko-home-control

Anyone else needed this integration?

Thanks!

0 Likes

#2

Hi Sen,

NoUseFreak (who wrote the Python library you mention) seems to have added Niko HC platform support and did a pull request to have it merged into Home Assistant. There is some discussion to improve error handling and to add documentation. That’s just from April ago, so let’s hope it makes it into HA sooner or later.

Alternatively, OpenHAB2 supports Niko HC already and it works great! If you love HA and wouldn’t switch to something else (count me in), you could bridge HA and the Niko HC components on OH together using MQTT. It should work, but direct support in HA would be even better of course.

Niko HC is the only (but an important) part of my HA setup missing, I’m gonna give the HA-MQTT-bridge-OH-NikoHC a try soon, unless that pull request is in the pipeline.

Regards,
Hannes

0 Likes

#3

Hi,

I know OpenHAB2 support NHC, but its NHC 1 and I have an installation at home with HNC 2. So it doesn’t work for me.
I have had another look at the code of NoUseFreak and it looks like it’s also for NHC 1…
The biggest reason I wanted to integrate NHC into HA is for the use of google assistant. I have read on Tweakers.net that Niko is currently trying to integrate NHC 2 with Google assistant. https://gathering.tweakers.net/forum/list_messages/1800723

Regards,
Sen

0 Likes

#4

For those stumbling on this thread looking for a way to integrate Niko Home Control 1: here’s how I got it working :slight_smile:

I’m running this for several months now, and it’s surprisingly stable and responsive, despite of the extra layer required due to lack of direct support for Niko HC 1.

  • Needed a little help of OpenHAB, which I run on another Pi, solely to be able to interface with Niko HC (imho this could theoretically run on the same Pi as well, but mine was overloaded already so I went for the safer / easier way of a seperate Pi). OpenHAB has Niko HC 1 integration and is fairly easy to setup. Next you need OpenHAB to publish state information and listen for commands using MQTT. I use the Hass.io MQTT addon and let OpenHAB use this as the MQTT broker. The idea for this setup comes from this thread: Home Assistant - MQTT - openHAB: Switch example, where you can find details on how to setup the OpenHAB MQTT part.
  • Next you need the MQTT broker setup in HA: https://www.home-assistant.io/components/mqtt.
  • Finally you need MQTT lights and switches configured in HA. Here’s config for this (as a package). This was fairly straight forward, except for dimmable lights, as for those OpenHAB does not put any on/off state on the MQTT eventstream, only the brightness level. So I needed to derive the state from the brightness level (if brightness = 0 then state = OFF, else state = ON). This is done using state_value_template for those dimmable lights.
################################################################
## Packages / Niko I via OpenHAB MQTT
################################################################

################################################
## CUSTOMIZE
################################################

homeassistant:
  customize:

    ################################################
    ## Node Anchors
    ################################################

    package.node_anchors:
      customize:                     &customize
        package:                     'niko_mqtt'

      spot_niko:                     &spot_niko
        <<:                          *customize
        icon:                        mdi:spotlight

      dim_niko:                      &dim_niko
        <<:                          *customize

      plug_niko:                     &plug_niko
        <<:                          *customize
        icon:                        mdi:power-socket-eu

      scene_niko:                    &scene_niko
        <<:                          *customize
        icon:                        mdi:movie

    ################################################
    ## Lights
    ################################################

    light.bunker_niko_ceiling:
      <<:                            *spot_niko
      friendly_name:                 "Bunker spots"

    light.bath_niko_ceiling_shower:
      <<:                            *dim_niko
      friendly_name:                 "Shower dimmable spots"

    ################################################
    ## Switches
    ################################################

    switch.living_niko_wallplug_r:
      <<:                            *plug_niko
      friendly_name:                 "Wall plugs right"

    switch.scene_niko_bedtime:
      <<:                            *scene_niko
      friendly_name:                 "Bedtime scene"


################################################
## Lights
################################################

light:

    ## Dimmable light
  - platform:                        mqtt
    name:                            bath_niko_ceiling_shower
    state_topic:                     "openHAB/out/nikohomecontrol_dimmer_440e003a291e_54_brightness/state"
    command_topic:                   "openHAB/in/nikohomecontrol_dimmer_440e003a291e_54_brightness/command"
    on_command_type:                 brightness
    state_value_template:            >
      {% if value|int > 0 %}1{% else %}0{% endif %}
    payload_on:                      "1"
    payload_off:                     "0"
    brightness_state_topic:          "openHAB/out/nikohomecontrol_dimmer_440e003a291e_54_brightness/state"
    brightness_command_topic:        "openHAB/in/nikohomecontrol_dimmer_440e003a291e_54_brightness/command"
    brightness_scale:                100
    qos:                             1
    retain:                          true
    optimistic:                      false

    ## Non-dimmable light
  - platform:                        mqtt
    name:                            bunker_niko_ceiling
    state_topic:                     "openHAB/out/nikohomecontrol_onOff_440e003a291e_63_switch/state"
    command_topic:                   "openHAB/in/nikohomecontrol_onOff_440e003a291e_63_switch/command"
    qos:                             1
    payload_on:                      "ON"
    payload_off:                     "OFF"
    retain:                          true
    optimistic:                      false

################################################
## Switches
################################################

switch:

    ## Wall plug
  - platform:                        mqtt
    name:                            living_niko_wallplug_r
    state_topic:                     "openHAB/out/nikohomecontrol_onOff_440e003a291e_60_switch/state"
    command_topic:                   "openHAB/in/nikohomecontrol_onOff_440e003a291e_60_switch/command"
    qos:                             1
    payload_on:                      "ON"
    payload_off:                     "OFF"
    retain:                          true
    optimistic:                      false

    ## Scene
  - platform:                        mqtt
    name:                            scene_niko_bedtime
    state_topic:                     "openHAB/out/nikohomecontrol_onOff_440e003a291e_69_switch/state"
    command_topic:                   "openHAB/in/nikohomecontrol_onOff_440e003a291e_69_switch/command"
    qos:                             1
    payload_on:                      "ON"
    payload_off:                     "OFF"
    retain:                          true
    optimistic:                      false

0 Likes

Home Assistant - MQTT - openHAB: Switch example
#5

I see that some people have found a solution for communication between NHC2 and OpenHAB:

Maybe this can be helpfull to implement this in Home Assistant

1 Like

#6

I’ve started work on a Custom Integration of NHC2 into hass.
It will take some time to get to the levels we all want it to be.
But I’m searching for volunteers to help me get this done.
Level of expertise does not matter, only not giving up.
Please send me a PM with your name, native language and scope of your project.
Also what you can do… from simple testing the integration to co-authoring (code and/or docs)

0 Likes

#7

will it also work on NHC1 ?
because current platform now official in HA doesnt work

0 Likes

#8

I do not know howe NHC1 works, from what I understand it works different.
You can upgrade your NHC1 -> NHC2 but it’ll cost you and not all old devices are compatible.
Since I don’t have a NHC1 controller, and not a lot of time, I probably can’t help you :frowning_face:

0 Likes

#9

You can follow my efforts on

0 Likes

#10

@sen & @dstammen - working on NHC2 - willing to help me test/improve ? :slight_smile:

0 Likes

#11

I don’t think I will use HA for my NHC2 installation. Niko is adding default google assistant integration (he only reason I wanted to use HA) and it’s scheduled to release this summer. I will wait and see if it meets all my needs. If not I might come back to HA.
Good luck with the development.

0 Likes

#12

i know someone with NHC1 , he is on vacation now for 3 weeks, afterwards he will do upgrade to 2 to test

0 Likes

#14

I your only intent is a google home integration, that probably would be the best.
The reason I’m not waiting for that is, not only do I have that today, but more control, automatisation and… integration… like, for example, soft-linking NHC2 ‘buttons’ to IKEA smart lights/gateway (or any other smart lights). The socket always gets power (some nhc2 logic/conf) and the button actually toggles lamp through software.

0 Likes

#15

seems like a expensive operation
https://www.niko.eu/enus/help-and-advice/faq/niko-home-control-ii/kan-ik-een-bestaande-niko-home-control-installatie-upgraden

No first generation touchscreens are supported on NHC2. And replacing the controller is about €600
While, there seems to be someone who has a custom implementation of NHC1, as you can see on post nr 2 on this thread.

I would hope there are other reasons than HA integration to do the upgrade?

0 Likes

#16

That seems like a nice integration. I didn’t know it was possible to link a IKEA smart light to a NHC2 light switch.
Maybe I’ll take a look at HA. But I’m completely new to HA, so it will take some time to get started…

0 Likes

#17

Everything is possible once it’s available in HA!

0 Likes

#18

Also integration in google will be much better, you can have control on your names and rooms much easier

0 Likes

#19

There is no real one way to do this. But i did the following:
First I configured a ‘lamp’ to aways turn on in NHC2.
29
The two conditionals: if virtuals output is true, turn on the light, if is false… turn on the light.
Now the light is “always on”.
In HA we “see” the “Basic Action” between the Virtual Output and the switch.
Using some config, (a group, automation, and hiding some entities,…) I made the IKEA Light(s) (through the hub they sell) follow the state of that switch.
If you use switches without LED, i would do it a bit different, use the button like a toggle signal to HA.

In theory you can link anything together. In our bathroom, we have a dumb LED bulb, controlled by NHC2. But we have a IKEA Tradfri Control outlet (203.644.76) that cuts power to the electric heater when the light is off.

0 Likes

#20

yes, doing this kinde stiuff too
i have this dumb ikea smart remote controller, normally used for dimmer in the closet
in my case i use it to turn on my denon receiver/internet radio volume up/down and favorite stations :slight_smile:

0 Likes

#21

As far as I know, you actually need a lamp for that?

0 Likes