MQTT: transmit several sensor values

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
jbaben
Normal user
Posts: 10
Joined: 07 Mar 2021, 09:45

MQTT: transmit several sensor values

#1 Post by jbaben » 09 May 2021, 15:45

Hello,

how can I transfer multiple sensor values (Temperature1, Temperatur2, Humidity, Pressure) ?
For one sensor value:
MQTT:
Controller Subscribe: %sysname%/#
Controller Publish: %sysname%/Temperature1

Kind Regards

Juergen B.

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

Re: MQTT: transmit several sensor values

#2 Post by Ath » 09 May 2021, 17:12

I would expect that the MQTT server can only receive 1 value per topic, unless you use the publish command to send a combined message, instead of the more regular way of letting a controller handle it. Via the controller all values of the sensor will be sent to their respective topic one after the other.
/Ton

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

Re: MQTT: transmit several sensor values

#3 Post by TD-er » 09 May 2021, 21:04

The default topic for OpenHAB to publish is like this:

Code: Select all

%sysname%/%tskname%/%valname%
I guess that's what you need?

jbaben
Normal user
Posts: 10
Joined: 07 Mar 2021, 09:45

Re: MQTT: transmit several sensor values

#4 Post by jbaben » 10 May 2021, 15:05

Hello,

Many thanks for your help.
With the topic publish:

Code: Select all

%sysname%/%tskname%/%valname%
all sensor values are transmitted.

Kind Regards
Juergen B.

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests