NHC2 - MQTT connection

Hey all, I am struggling somewhat with connecting my HA with Niko NHC2 MQTT broker. With MQTT Explorer I can connect to NHC2 broker with the option TLS enabled and validate certificate disabled. Now in my configuration.yaml I have entered the following config:

mqtt:
   broker: 10.10.11.93
   port: 8884
   username: 'hobby'
   password: api_password
   certificate: /config/ca-chain.crt
   tls_insecure: true

But in the logs I can see that HA can’t connect to the MQTT broker, am I missing something?

The full error log entry is

2020-11-09 16:44:05 ERROR (Thread-6) [paho.mqtt.client] failed to receive on socket: [Errno 104] Connection reset by peer
2020-11-09 16:44:05 WARNING (Thread-6) [homeassistant.components.mqtt] Disconnected from MQTT server 10.10.11.93:8884 (1)
2020-11-09 16:44:29 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2877573152] Error talking to MQTT: The client is not currently connected.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1448, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1483, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 583, in async_publish_service
await hass.data[DATA_MQTT].async_publish(msg_topic, payload, qos, retain)
File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 793, in async_publish
_raise_on_error(msg_info.rc)
File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 1062, in _raise_on_error
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Error talking to MQTT: The client is not currently connected.

In the form of good spirit, I solved my issue through a work arround.
It seems that the mqtt integration has probles with connecting directly to NHC2. So I’ve installed mosquito and configured it as a bridge device for all topics (#)

Afterwards with using MQTT explorer and the niko app, I’ve searched for the correct UID’s and created the payload for on / off.
JSON formatting and escape characters play a big role in this, searched a while untill I found the correct formatting.

For example, turning on and off a light is then the following in the configurations.yaml

mqtt:
   broker: 10.10.11.83
   port: 1883
   discovery: true
   client_id: hass
   keepalive: 60

switch:
 - platform: mqtt
   name: "Office Thomas Lights"
   state_topic: "hobby/control/devices/cmd"
   command_topic: "hobby/control/devices/cmd"
   payload_on: "{\"Method\": \"devices.control\",\"Params\": [{\"Devices\": [{\"Properties\": [{\"Status\": \"On\"}],\"Uuid\": \"ceadc919-4e90-4ae6-80bf-630a3a2123c9\"}]}]}"
   payload_off: "{\"Method\": \"devices.control\",\"Params\": [{\"Devices\": [{\"Properties\": [{\"Status\": \"Off\"}],\"Uuid\": \"ceadc919-4e90-4ae6-80bf-630a3a2123c9\"}]}]}"

Hopefully some else can use this now as well untill NHC2 is integrated in HA

Hi,

I’m trying to bridge my niko home control to my HA with a MQTT bridge. I’m now struggling with the encryption part to connect to NHC MQTT. Can you give me the configuration file you use for the bridge to understand how it works ?

Thank you