MQTT doc / eamples

Hi, trying to setup Homehabit to use MQTT to connect to an existing broker with IOT devices. So far no luck. Connection is up and running but no devices are shown. Has anyone a sort of documentation on how to set this up on Homehabit ? What are the minimum fields to configure ? Examples of a running config ?

@Danny_Borremans All required fields should be marked as required in UI.
Did you add item configurations when setting up the integration?
Can you share a JSON part for MQTT integration from Remote Config editor (enabled in Settings)?

Hi Igor, thanks for your reply but not sure I understand all of them :

All required fields should be marked as required in UI : What UI are you referring too ? The Integration editor ? Don’t see any fields marked as required.
Did you add item configurations when setting up the integration : I assume you mean the integration editor ? I completed the Host, port and then added an item published/subscribed on the MQTT server.
Can you share a JSON part for MQTT integration from Remote Config editor (enabled in Settings) : Not sure I can identify this editor. Am I missing something ?
I believe some documentation on how to setup this MQTT on Homehabit would certainly help.
Thanks,

{
          "name": "OffTest",
          "type": "sensor",
          "sensorType": "binary",
          "subscribe": {
            "topic": "zigbee2mqtt/Office",
            "filter": {
              "type": "none"
            },
            "value": {
              "payload": "json",
              "path": "$.occupancy",
              "map": {
                "on": "true",
                "off": "false"
              }
            }
          },
          "qos": 0
        }

MQTT part is:

zigbee2mqtt/Office
{
  "battery": 100,
  "device_temperature": 15,
  "illuminance": 36,
  "illuminance_lux": 36,
  "linkquality": 33,
  "occupancy": false,
  "power_outage_count": 544,
  "voltage": 3005
}

occupancy or $.occupancy and some other variations don’t get the value to be displayed on the Dash. Other values (non-json in the same mqtt-message is no problem).

Sorry for the late reply. Below my test config from remote config editor. What do you mean exactly with : All required fields should be marked as required in UI? And yes I added an item configuration in the integration with one topic.

"1a8fyi73x1jil1xof3bxpcyrzn": {
      "name": "MQTT",
      "type": "mqtt",
      "enabled": true,
      "host": "192.168.3.253",
      "port": 1883,
      "protocol": "tcp",
      "items": [
        {
          "name": null,
          "type": "dimmer",
          "subscribe": {
            "topic": "homie/homey",
            "filter": {
              "type": "none"
            },
            "value": {
              "payload": "json",
              "path": "$[licht-zithoek]",
              "converter": null
            }
          },
          "publish": {
            "topic": "homie/homey",
            "payload": {
              "converter": {
                "type": "none"
              },
              "template": "{{value}}"
            },
            "retain": false
          },
          "qos": 0
        }
      ]
    }
  },

Guys, I want to control an mqtt light or switch , exposed by the mqtt discovery stream from HA…
But I’m lost how to define payload Ann subscribe…

Can anyone post a working example how to define it?

{
“uniq_id”: “mqtt_light.wasplaats”,
“name”: “Wasplaats”,
“stat_t”: “homeassistant/light/wasplaats/state”,
“avty_t”: “homeassistant/light/wasplaats/availability”,
“cmd_t”: “homeassistant/light/wasplaats/set_light”,
“schema”: “json”
}

trying the mqtt integration…

With the mqtt discovery stream in HACS, i’m publishing the lights/switches to MQTT
with mqtt explorer i can send payload to turn on/off

mosquitto_pub -h localhost -p 1883 -t "hikvision/light/badkamer/set_light" -m '{ "state": "ON" }'

But having difficulties creating it in HomeHabit, i did the UI wizard, it gave me this, but it doesnt turn the light on/off, i dont see any messages at all ? Mqtt is connected state…


      "items": [
        {
          "name": "Bad Mqtt",
          "type": "light",
          "lightType": "switch",
          "subscribe": {
            "topic": "hikvision/light/badkamer/state",
            "filter": {
              "type": "none"
            },
            "value": {
              "payload": "json",
              "path": "",
              "map": {
                "on": "{\"state\": \"ON\"}",
                "off": "{\"state\": \"OFF\"}"
              }
            }
          },
          "publish": {
            "topic": "hikvision/light/badkamer/set_light",
            "payload": {
              "map": {
                "on": "{\"state\": \"ON\"}",
                "off": "{\"state\": \"OFF\"}"
              }
            },
            "retain": false
          },
          "qos": 0
        }