Integrate HA in a self-made domotic system

Hello

I’m using :

  • a homemade home automation system developed in Windev.
  • Home Assistant on a Raspberry 3+
  • a Sonoff key and a dozen peripherals
    The 2 systems work correctly but independently.

In my self-made domotic application I would like:

  • retrieve values from temperature sensors, door contacts, motion detectors
  • operate the sockets
  • retrieve the consumption values of the outlets.

The first step is to test if I can retrieve data with MQTT Explorer.
When I try to connect in MQTT Explorer I receive the message :
« Disconnected from the server »

I have added these lines in configuration.yaml

mqtt_statestream: base_topic: homeassistant publish_attributes: true publish_timestamps: true

Parameters in MQTT Explorer :
Protocol : mqtt://
Host : http://homeassistant.local
Port : 8123
Validate certificate est ON
Encryption est OFF
Homeassistant login and password .

Do you know where the problem could come from?
Thanks for your help

port 8123 is the port of HA, you need to use the port of your mqtt broker, which is normally 1883.
(i am also wondering, are you running a mqtt broker at all, asking as HA doesn’t run it by itself, however it is available as add-on :thinking:)
And just to be sure, use the IP address (as i found that mDNS is not really reliable)

I had similar issue and I added “allow_anonymous true” to the configuration.yaml for my Mosquitto MQTT Broker running on a separate Raspberry Pi. You don’t specify which MQTT Broker you are using though so I don’t know if that will fix your problem.

Hello thanks for your reply.
I’m using HA operating system on a Raspberry 3. Nothing else.
I have added these lines to the configuration.yaml of HA

mqtt_statestream:
  base_topic: homeassistant
  publish_attributes: true
publish_timestamps: true

If I add ‘allow_anonymous: true’ in the configuration.yaml of HA I get an error message.
I’m totally new to HA. I thought that the modification of yaml was enough. But I have to install a mqtt broker ?
Mosquitto broker is correct ?

Thanks

You are telling HA to publish states to mqtt, but there is no broker listening for mqtt topics…

so yes, for mqtt you always need a broker !

No colon “:” Just “allow_anonymous true”

I have tried “allow_anonymous true”
I get this message :
The system cannot restart because the configuration is not valid: Error loading /config/configuration.yaml: while scanning a simple key
in “/config/configuration.yaml”, line 21, column 3
could not find expected ‘:’
in “/config/configuration.yaml”, line 21, column 23

I have installed Mosquitto
When I go to add-ons I can see Mosquitto Broker
I’m searching how to establish a link between Moquitto and HA… that’s not very clear for me …

1 - Install addon
2 - Fill in a username/password:


For now I advice to not use a certificate, you can always try to do that once it is up and running,
3 - Make sure the addon has started:

4 - The Broker should now have appeared under Integrations:
image
(Since this is HA’s own Mqtt broker, there is no need to configure it; just leave as is)

You should now be able to use MQTT Explorer, using the username/password in 2
Use HA’s IP address, port 1883
image