Analog mqtt message does not have unit number

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Zodiac69
Normal user
Posts: 85
Joined: 13 Jun 2016, 17:20

Analog mqtt message does not have unit number

#1 Post by Zodiac69 » 24 Jul 2020, 11:57

Hi All

I hope that you can point me in the right direction.
I have the internal Analog enabled under "Devices" and i am trying to send it to a mqtt broker.
The issue is that it seems that the Analog message does not include the "unit number" so i am just getting the value under the "Unit name" as all my unis have the same name, but each one has an unique unit number.
How do i send the Analog value to the broker that include the Unit name and the unit number so that i can read the correct value per unit?

Or am i going about this wrong?

Z69

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

Re: Analog mqtt message does not have unit number

#2 Post by TD-er » 24 Jul 2020, 12:50

Not sure how you try to send it to the broker.
If no controller fits your needs, you can also create a message in rules and "publish" the data.
For example you can use the analog input plugin to create a task and refer to that value from within the rules.
If you use a VCC build, you can also use the %vcc% to create a MQTT message.

Zodiac69
Normal user
Posts: 85
Joined: 13 Jun 2016, 17:20

Re: Analog mqtt message does not have unit number

#3 Post by Zodiac69 » 25 Jul 2020, 13:20

Hi TD-er
Here is my setup
ESPEasy mqtt setup as Home Assistant (openHAB) MQTT
Under "Devices" Analog input - internal, with "Send to Controller" enabled

In mqtt - i use MQTT Explorer to see the info, the Analog value is posted under the Device name and not under the Unit number.
mqtt broker ------->192.xxx.yyy.xxx
Device Name -------->ESP
Device Number-------->1
Topic--------------------->cmd = pwm,12,1023
Analog Name---------->Power
Topic---------------------> Analog = 8.00

As you can see, Power should be one level lower, under the "Device Number" level and not under the "Device Name" level.
If i have four ESP's, all four of them are under the Device name level and i am unable to differentiate between them.

Any assitance will be appreciated

Z69

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

Re: Analog mqtt message does not have unit number

#4 Post by Ath » 25 Jul 2020, 13:32

A few more questions:
- What version (.bin filename is the most informative) of ESPEasy do you have installed on your ESP's?
- What type of ESP's do you have, ESP8266 or ESP32?
/Ton (PayPal.me)

Zodiac69
Normal user
Posts: 85
Joined: 13 Jun 2016, 17:20

Re: Analog mqtt message does not have unit number

#5 Post by Zodiac69 » 25 Jul 2020, 22:00

Hi Ath
ESP_Easy_mega_20200703_normal_ESP8266_4M1M

Zodiac69
Normal user
Posts: 85
Joined: 13 Jun 2016, 17:20

Re: Analog mqtt message does not have unit number

#6 Post by Zodiac69 » 02 Aug 2020, 22:00

Please close the Topic, i have resolved the issue by making some changes to the mqtt subscribe topic

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

Re: Analog mqtt message does not have unit number

#7 Post by Ath » 02 Aug 2020, 22:37

We would appreciate if you could share the details, please.
/Ton (PayPal.me)

Zodiac69
Normal user
Posts: 85
Joined: 13 Jun 2016, 17:20

Re: Analog mqtt message does not have unit number

#8 Post by Zodiac69 » 03 Aug 2020, 22:56

Hi Ath

In my setup, all the ESP's have the same Sysname and each one has it's own number as in 1,2,3...
I have NOT set "Append Unit Number to hostname:"

Here is my mqtt setup, i am still new to mqtt, but this work for me, if there is a better way i am open to any way to do it better.
I had to add the %unit% to the "Controller Publish" to get it to work this way.

Controller Subscribe: %sysname%/%unit%/#
Controller Publish: %sysname%/%unit%/%tskname%/%valname%
Controller LWT Topic: %sysname%/%unit%/


This way, i have one Sysname, the units with their unit numbers are one level lower and each unit messages are under each one's number.
mqtt broker ----->192.xxx.yyy.xxx
Device Name ------>ESP
Device Number------>1
Topic------------------->cmd = pwm,12,1023
Analog Name---------->Power
Topic---------------------> Analog = 8.00
Device Number------>2
Topic------------------->cmd = pwm,12,1023
Analog Name---------->Power
Topic---------------------> Analog = 8.00

Z69

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests