Hello Friends,
Up to now I have used UDP to communicate between ESP units.
Looking at the forum it seems that using MQTT is a better solution.
I have a MQTT broker on NAS and I check it ... it works
I found examples to communicate with Domoticz : like : Publish domoticz/in,{"command": "switchlight", "idx": 96, "switchcmd": "Off" }
But not really to communicate between ESP units.
I should like to have example to communicate a value from one Esp to another.
I supposed we can used event and event value but what should be the message ?
On ESP1 ( the sender)
On Temp#°C do
Let,1,[Temp#°C]
Publish ??? // I want to send this temp to ESP2
Endon
On ESP2 ( the receiver)
What do I need to write ?
Can somebody help me ?
Thanks in advance
Patou
MQTT command to communicate between esp units
Moderators: grovkillen, Stuntteam, TD-er
Re: MQTT command to communicate between esp units
I use mqtt to communicate with my fhem server.
... and the ESP talks to itself to check MQTT communication.
i send the uptime from rules using:
Publish fhem/sensors/sonoff_S20_01/in/UPTIME,%uptime%
i receive using a "Generic - MQTT Import" device named "MQTT-IN"
MQTT Topic 1: fhem/sensors/sonoff_S20_01/in/UPTIME
named: uptimePong
Controller is configured as "openHAB MQTT"
Subscribe: fhem/sensors/%sysname%/#
publish: fhem/sensors/%sysname%/in/%valname%
now i can use the result within rules:
on UPTIME#UPTIME do //will run every 1 minutes
TaskValueSet 6,1,[UPTIME#UPTIME]-[MQTT-IN#uptimePong]
if [Dummy#Watchdog] > 60
reboot
endif
endon
... and the ESP talks to itself to check MQTT communication.
i send the uptime from rules using:
Publish fhem/sensors/sonoff_S20_01/in/UPTIME,%uptime%
i receive using a "Generic - MQTT Import" device named "MQTT-IN"
MQTT Topic 1: fhem/sensors/sonoff_S20_01/in/UPTIME
named: uptimePong
Controller is configured as "openHAB MQTT"
Subscribe: fhem/sensors/%sysname%/#
publish: fhem/sensors/%sysname%/in/%valname%
now i can use the result within rules:
on UPTIME#UPTIME do //will run every 1 minutes
TaskValueSet 6,1,[UPTIME#UPTIME]-[MQTT-IN#uptimePong]
if [Dummy#Watchdog] > 60
reboot
endif
endon
Re: MQTT command to communicate between esp units
Thanks for your answer
I will try this way and look at some other post.
Patou
I will try this way and look at some other post.
Patou
Who is online
Users browsing this forum: Ahrefs [Bot] and 124 guests