Page 1 of 1

8 relay next mqtt

Posted: 23 Nov 2022, 16:18
by bledad
hello ,
always next project 8 relay with esp8266 , where i thank's TD-er and chromo23 for the post viewtopic.php?t=9359

now I go for it with mqtt , but it doesn't go the way I want
i have put in "Home Assistant (openHAB) MQTT" IP , port , Controller Subscribe "actions_bouton" enable
in Devices " Generic - MQTT Import " , MQTT Topic 1: " sonnette " , values " value1" enable
when send , in my mqtt server , " actions_bouton = sonnette#1 "
I do not receive anything

what I didn't do ?

Re: 8 relay next mqtt

Posted: 24 Nov 2022, 11:25
by bledad
i use mosqitto broker on linux
is what openhab is good with mosquitto ?
because i have nothing , not even a mistake in log espeasy

Re: 8 relay next mqtt

Posted: 24 Nov 2022, 11:40
by TD-er
Mosquitto is a perfectly fine MQTT broker.
But -in theory- it shouldn't matter which MQTT broker package you're using as long as it does work according to the standards.
Anyway, Mosquitto is a good MQTT broker.

The OpenHAB/HomeAssistant MQTT controller in ESPEasy is the most commonly used MQTT controller in ESPEasy as it allows to receive commands via MQTT and also has the most common/flexible way of interacting with MQTT. (the other MQTT controllers do pre-format the messages for those specific platforms like Domoticz, etc.)

I'm not 100% what you're trying to do, nor what problem you're having.

First you have to create a controller on the Controller tab of the ESPEasy web interface, which I think you did.
Make sure to also check the checkbox to enable the controller.

With that being configured, you now go to one of your tasks (on the "Devices" tab in ESPEasy) and check to send the task data to the controller.
With a controller configured, you now have these checkboxes in the task config page. (only for plugins that actually have data to send, so a display plugin will not have any output values to send)

Re: 8 relay next mqtt

Posted: 24 Nov 2022, 11:52
by bledad
ma config :
esp1.jpg
esp1.jpg (106.53 KiB) Viewed 2226 times
esp2.jpg
esp2.jpg (93.17 KiB) Viewed 2226 times
i receiv with mqtt broser
mqtt.jpg
mqtt.jpg (38.84 KiB) Viewed 2226 times

Re: 8 relay next mqtt

Posted: 24 Nov 2022, 11:58
by TD-er
The MQTT import Topic you set has a leading /
I don't think it has a leading slash, based on the MQTT explorer screenshot.

Also, your topic is "actions_bouton" and the message is "sonnette#1"
You are trying to import from the topic "/actions_bouton/sonnete"
Not only does it start at a different level (the leading /) but also the last part isn't part of the topic, but of the message.
When you click on the topic in MQTT explorer, it will show you what the exact topic is and what the message is.

Re: 8 relay next mqtt

Posted: 24 Nov 2022, 11:59
by TD-er
Just another thing...
It is way simpler to only have numbers in the message and trying to split up what you're now sending as a message to make "sonnette" actually part of the topic.

Re: 8 relay next mqtt

Posted: 24 Nov 2022, 14:14
by bledad
i've delete slash
and device put " sonnette#1 "
now in log i

Code: Select all

86259575: MQTT : Connected to broker with client ID: relais_8_0
86259576: Subscribed to: actions_bouton
86259582: EVENT: MQTT#Connected
86259592: IMPT : [rel2#Value1] subscribed to sonnette#1
86259830: MQTT : Connection lost, state: Disconnected
Is it possible to recover the number after the #?

Re: 8 relay next mqtt

Posted: 24 Nov 2022, 15:15
by bledad
or give me the format that I have to publish of mqtt server
thank you

Re: 8 relay next mqtt

Posted: 24 Nov 2022, 15:39
by Ath

Code: Select all

topic: actions_bouton/sonette
payload: 1
Then ESPEasy can handle it correctly, and you will get that 1 in your Value1

Edit: Changed 'value' to 'payload', as that's the MQTT terminology

Re: 8 relay next mqtt

Posted: 29 Nov 2022, 15:53
by bledad
ok ,i try but in log error MQTT : Connection lost

Code: Select all

6996172: ACT : Publish 'actions_bouton/sonnette/status', 3
6996204: ACT : Publish 'actions_bouton/fontaine/status', 0
6996226: MQTT : Connection lost, state: Disconnected
6996254: ACT : Publish 'actions_bouton/bassin/status', 2
6996374: IMPT : Error subscribing to actions_bouton/fontaine/status
6996374: EVENT: MQTT#Disconnected
6996904: IMPT : Error subscribing to actions_bouton/sonnette/status
6997411: IMPT : Error subscribing to actions_bouton/bassin/status

Re: 8 relay next mqtt

Posted: 29 Nov 2022, 16:00
by TD-er
Maybe your MQTT broker has a really short timeout configured?

Re: 8 relay next mqtt

Posted: 29 Nov 2022, 16:06
by Ath
'Connection lost' is just that, the server is not visible from ESPEasy. This can have many causes.

To avoid trying to publishing from rules when the MQTT connection isn't available, you can check using:

Code: Select all

  if %ismqtt%=1
    publish,(topic),(value)
  endif

Re: 8 relay next mqtt

Posted: 29 Nov 2022, 19:13
by bledad
ok , it works ,I had forgotten to put in controllers > mqtt > controller subcribe > actions_bouton