8 relay next mqtt

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
bledad
Normal user
Posts: 82
Joined: 23 Nov 2020, 10:57
Location: France

8 relay next mqtt

#1 Post by bledad » 23 Nov 2022, 16:18

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 ?

bledad
Normal user
Posts: 82
Joined: 23 Nov 2020, 10:57
Location: France

Re: 8 relay next mqtt

#2 Post by bledad » 24 Nov 2022, 11:25

i use mosqitto broker on linux
is what openhab is good with mosquitto ?
because i have nothing , not even a mistake in log espeasy

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: 8 relay next mqtt

#3 Post by TD-er » 24 Nov 2022, 11:40

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)

bledad
Normal user
Posts: 82
Joined: 23 Nov 2020, 10:57
Location: France

Re: 8 relay next mqtt

#4 Post by bledad » 24 Nov 2022, 11:52

ma config :
esp1.jpg
esp1.jpg (106.53 KiB) Viewed 1886 times
esp2.jpg
esp2.jpg (93.17 KiB) Viewed 1886 times
i receiv with mqtt broser
mqtt.jpg
mqtt.jpg (38.84 KiB) Viewed 1886 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: 8 relay next mqtt

#5 Post by TD-er » 24 Nov 2022, 11:58

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.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: 8 relay next mqtt

#6 Post by TD-er » 24 Nov 2022, 11:59

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.

bledad
Normal user
Posts: 82
Joined: 23 Nov 2020, 10:57
Location: France

Re: 8 relay next mqtt

#7 Post by bledad » 24 Nov 2022, 14:14

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 #?

bledad
Normal user
Posts: 82
Joined: 23 Nov 2020, 10:57
Location: France

Re: 8 relay next mqtt

#8 Post by bledad » 24 Nov 2022, 15:15

or give me the format that I have to publish of mqtt server
thank you

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: 8 relay next mqtt

#9 Post by Ath » 24 Nov 2022, 15:39

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
/Ton (PayPal.me)

bledad
Normal user
Posts: 82
Joined: 23 Nov 2020, 10:57
Location: France

Re: 8 relay next mqtt

#10 Post by bledad » 29 Nov 2022, 15:53

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

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: 8 relay next mqtt

#11 Post by TD-er » 29 Nov 2022, 16:00

Maybe your MQTT broker has a really short timeout configured?

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: 8 relay next mqtt

#12 Post by Ath » 29 Nov 2022, 16:06

'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
/Ton (PayPal.me)

bledad
Normal user
Posts: 82
Joined: 23 Nov 2020, 10:57
Location: France

Re: 8 relay next mqtt

#13 Post by bledad » 29 Nov 2022, 19:13

ok , it works ,I had forgotten to put in controllers > mqtt > controller subcribe > actions_bouton

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests