Publish not working anymore

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Rampler
Normal user
Posts: 32
Joined: 31 Dec 2016, 07:13

Publish not working anymore

#1 Post by Rampler » 30 Oct 2019, 10:06

Hi,
i am using ESP_Easy_mega-20191028_normal_ESP8266_4M1M.bin.
Publish command is not working !
The command "publish /HMUART3/Taster,1" publishes nothing.

Debug Messages from Broker:
Client mosqsub|12301-Raspberry received PUBLISH (d0, q0, r0, m0, '/Gartenhaus/Count_Wind', ... (1 bytes))
/Gartenhaus/Count_Wind 2
Client mosqsub|12301-Raspberry received PUBLISH (d0, q0, r0, m0, 'Publish', ... (15 bytes))
Publish /HMUART3/Taster
Seems to be a parsing problem.
Back to ESP_Easy_mega-20180506_normal_ESP8266_4096.bin, all is working fine.

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

Re: Publish not working anymore

#2 Post by TD-er » 30 Oct 2019, 10:12

Have you also tried a version from let's say 20190928 (1 month ago) ?

Rampler
Normal user
Posts: 32
Joined: 31 Dec 2016, 07:13

Re: Publish not working anymore

#3 Post by Rampler » 30 Oct 2019, 10:21

Have you also tried a version from let's say 20190928 (1 month ago) ?
Version 20190928 is working, see debug log:

Code: Select all

Client mosqsub|12488-Raspberry received PUBLISH (d0, q0, r0, m0, '/HMUART3/Taster', ... (1 bytes))
/HMUART3/Taster 1

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

Re: Publish not working anymore

#4 Post by TD-er » 30 Oct 2019, 11:16

I hope to have a test build ready later today.

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

Re: Publish not working anymore

#5 Post by TD-er » 30 Oct 2019, 12:01

Found the bug.
It is the same issue as this one: https://github.com/letscontrolit/ESPEasy/issues/2662

I just started a test build, which will be ready in less than an hour.

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

Re: Publish not working anymore

#6 Post by TD-er » 30 Oct 2019, 13:13

Can you try this test build: https://www.dropbox.com/s/7cbfjvg5ytlqc ... 8.zip?dl=0
Please let me know if it does work and it would be great if you could do some more thorough testing so I can merge it for tomorrow's build.

Rampler
Normal user
Posts: 32
Joined: 31 Dec 2016, 07:13

Re: Publish not working anymore

#7 Post by Rampler » 30 Oct 2019, 14:22

Publish again working with the test build.
Congratulations !!!

I cannot see any other errors....

waspie
Normal user
Posts: 115
Joined: 09 Feb 2017, 19:35

Re: Publish not working anymore

#8 Post by waspie » 30 Oct 2019, 14:59

thank you for resolving this TD-er

Rampler
Normal user
Posts: 32
Joined: 31 Dec 2016, 07:13

Re: Publish not working anymore

#9 Post by Rampler » 01 Nov 2019, 10:37

TD-er wrote:
30 Oct 2019, 13:13
Can you try this test build: https://www.dropbox.com/s/7cbfjvg5ytlqc ... 8.zip?dl=0
Please let me know if it does work and it would be great if you could do some more thorough testing so I can merge it for tomorrow's build.
Good morning, did you forget that?

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

Re: Publish not working anymore

#10 Post by TD-er » 01 Nov 2019, 13:51

Rampler wrote:
01 Nov 2019, 10:37
[...]

Good morning, did you forget that?
What did I forget?

User avatar
dynamicdave
Normal user
Posts: 184
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: Publish not working anymore

#11 Post by dynamicdave » 01 Nov 2019, 14:38

I tried the version you mentioned and it does NOT work for me when I try to publish via a rule.

Note:
This is using a rule-set that works fine in a previous release (mega-20191003)

Rampler
Normal user
Posts: 32
Joined: 31 Dec 2016, 07:13

Re: Publish not working anymore

#12 Post by Rampler » 01 Nov 2019, 14:47

TD-er wrote:
01 Nov 2019, 13:51
Rampler wrote:
01 Nov 2019, 10:37
[...]

Good morning, did you forget that?
What did I forget?
.... so I can merge it for tomorrow's build. I thought we get a new build...

waspie
Normal user
Posts: 115
Joined: 09 Feb 2017, 19:35

Re: Publish not working anymore

#13 Post by waspie » 01 Nov 2019, 15:45

TD-er wrote:
30 Oct 2019, 13:13
Can you try this test build: https://www.dropbox.com/s/7cbfjvg5ytlqc ... 8.zip?dl=0
Please let me know if it does work and it would be great if you could do some more thorough testing so I can merge it for tomorrow's build.
As a side note:
Whatever has changed since 9/28 has also made my two main nodes *much* more reliable. My uptimes were generally sub 6 hours and neither one has rebooted since I updated with this pre-release
One is at 50 hours and the other 19 (didn't update it until much later)

User avatar
dynamicdave
Normal user
Posts: 184
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: Publish not working anymore

#14 Post by dynamicdave » 01 Nov 2019, 16:10

I've just tried again with release... ESP_Easy_mega-20191028-21-PR_2698_normal_ESP8266_4M1M.bin

I have a publish command in a rule-set to publish a 'json' string.

It would seem if the payload is just a single item, then it works.
Publish,node24/ir_detector,{"ssid":"%ssid%"}

If it's more than one item, then is fails with "Failed to parse JSON string" appearing in Node-RED.
Publish,node24/ir_detector,{"ssid":"%ssid%","node_number":"node%unit%"}

Hope this helps to narrow-down the issue.

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

Re: Publish not working anymore

#15 Post by TD-er » 01 Nov 2019, 17:47

dynamicdave wrote:
01 Nov 2019, 16:10
[...]
If it's more than one item, then is fails with "Failed to parse JSON string" appearing in Node-RED.
Publish,node24/ir_detector,{"ssid":"%ssid%","node_number":"node%unit%"}
[...]
Like I posted in the other topic

Code: Select all

Publish,node24/ir_detector,'{"ssid":"%ssid%","node_number":"node%unit%"}'
Try this one.

To explain it, I check for quotes (single or double) to wrap an argument, which does allow to use the "other" quotes in a parameter, or a comma.
I think your comma was considered as a parameter separator.

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

Re: Publish not working anymore

#16 Post by TD-er » 01 Nov 2019, 17:52

Rampler wrote:
01 Nov 2019, 14:47
TD-er wrote:
01 Nov 2019, 13:51
Rampler wrote:
01 Nov 2019, 10:37
[...]

Good morning, did you forget that?
What did I forget?
.... so I can merge it for tomorrow's build. I thought we get a new build...
Well yesterday was way too hectic for me, and I did find some other small issues I also wanted to include in the new build.
So I did not want to rush a merge while also occupied with a lot of other things happening.
On top of that, I do want to have a proper look at some other report (also with the test build) where it does seem some rules parsing of multiple " and " or " or " in a line is not working like before.

I really don't like it what happened to the last (2) nightly builds, where I had people test the testbuilds and there appeared to be a number of other bugs I introduced in the last (huge) refactoring of rules code.
So better have an extra check here.

User avatar
dynamicdave
Normal user
Posts: 184
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: Publish not working anymore

#17 Post by dynamicdave » 01 Nov 2019, 18:37

Thanks for pointing out that I should have surrounded the json string (in the Publish command) with single quote marks.

I can confirm that the json string publishes correctly in this release ( ESP_Easy_mega-20191028-21-PR_2698_normal_ESP8266_4M1M.bin ).

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

Re: Publish not working anymore

#18 Post by TD-er » 01 Nov 2019, 20:56

Great!
So I should also have a look at the documentation regarding rules argument parsing to make it clear how the argument parsing is done.
One of the changes in the publish command is also that it does only read the publish arguments as single arguments.

Code: Select all

Publish,<topic>,<value>
In older builds it only parsed the <topic> argument and the rest was considered the <value>
Now the <value> parameter is parsed as a single argument, meaning it does allow later to add more parameters if we like.
But most importantly it will now yield a predictable result where older implementations could give different results depending on whether you had a single/double qoute or a square bracket at the end of the parameter. Also trailing space or comment could have an effect on how the argument would have been parsed.

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

Re: Publish not working anymore

#19 Post by TD-er » 02 Nov 2019, 22:59

Rampler wrote:
01 Nov 2019, 14:47
TD-er wrote:
01 Nov 2019, 13:51
Rampler wrote:
01 Nov 2019, 10:37
[...]

Good morning, did you forget that?
What did I forget?
.... so I can merge it for tomorrow's build. I thought we get a new build...
It has been merged.

User avatar
Sasch600xt
Normal user
Posts: 92
Joined: 10 Sep 2018, 16:37

Re: Publish not working anymore

#20 Post by Sasch600xt » 07 Nov 2019, 18:16

Sorry to bring it up again but it is still not working for me.

Clean install of ESPEasy mormal buld 1M4M 04112019 and this:

Code: Select all

on System#Boot do
timerSet,2,10
endon


On Rules#Timer=2 do
Publish,%sysname%/status/Build_date, "%sysbuild_date%"
Publish,%sysname%/status/Ip_Adresse, %ip%
timerSet,2,10
endon
is not working.

older version from 27082019 and this:

Code: Select all

on System#Boot do
timerSet,2,10
endon


On Rules#Timer=2 do
Publish,%sysname%/status/Build_date, %sysbuild_date%
Publish,%sysname%/status/Ip_Adresse, %ip%
timerSet,2,10
endon
is working perfect
"the flat earth society has members all around the globe"

Rampler
Normal user
Posts: 32
Joined: 31 Dec 2016, 07:13

Re: Publish not working anymore

#21 Post by Rampler » 08 Nov 2019, 11:19

Hi,
this is working on my side, new and old releases..

Code: Select all

on Taster#Taster do
 if [Dummy#Buttonpress] = 0   //Erster Tastendruck
    oledcmd,on
    TaskValueSet 5,1,1 
    timerSet,1,20
 else
    publish /HMUART3/Taster,1
 endif
endon

User avatar
Sasch600xt
Normal user
Posts: 92
Joined: 10 Sep 2018, 16:37

Re: Publish not working anymore

#22 Post by Sasch600xt » 08 Nov 2019, 14:58

Hello,

i guess i found the problem which brings me into trouble right now.

i try to explain.

i have spaces in my sysname (Kompressor Raum 1)

So this works now for also newer firmwares:

Code: Select all

On Rules#Timer=2 do
publish,"%sysname%"/status/Build_date, "%sysbuild_date%"
publish,"%sysname%"/status/Ip_Adresse, %ip%
timerSet,2,3600
endon
as you see i had also to add quotes to the sysname.

but the different to the "%sysbuild_date%" is that the quoutes not disapear after ariving in my open hub controller.

so before with older firmware i had a variable in my Open hub controller like this: Kompressor Raum 1
Now i have: "Kompressor Raum 1"
But at the same time "%sysbuild_date%" is working and shows me the build date without quotes.

This quotes are an issue because for my controller they are a totally new variable.

i can´t change the sysname because then i have totally new devices in my open hub controller which is much more worst.

So at the moment i have something about 200 publish messages from 5 ESPEasy devices.

Would be hell if all would be new variables for me in the open hub controller.


I hope you guys can help out here.

Thank you very much and have a great day
"the flat earth society has members all around the globe"

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

Re: Publish not working anymore

#23 Post by TD-er » 08 Nov 2019, 20:28

Use quotes to separate a parameter if it is ambiguous.

Code: Select all

On Rules#Timer=2 do
publish,"%sysname%/status/Build_date","%sysbuild_date%"
publish,"%sysname%/status/Ip_Adresse",%ip%
timerSet,2,3600
endon
Also try not to use spaces between parameters.
So use the same quote " or ' at the begin and end of a parameter to make sure it is not split into multiple parameters.
In JSON you need ", so then you should wrap the argument in single quotes.

User avatar
Sasch600xt
Normal user
Posts: 92
Joined: 10 Sep 2018, 16:37

Re: Publish not working anymore

#24 Post by Sasch600xt » 08 Nov 2019, 22:21

dear TD-er,

i am sooooooo sorry :(
i feel a little stupid now
You are totally right and now all works again.

i am really so sorry to waste your time always :(
I am not that deep into programming.

You are always very kind and answere all my (sometimes stupid) questions within minutes or hours.

Thank you so much for your help
Have a great day

(let me know when you wanna make vacations, so i will not type questions then :))
"the flat earth society has members all around the globe"

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

Re: Publish not working anymore

#25 Post by TD-er » 09 Nov 2019, 01:02

Sasch600xt wrote:
08 Nov 2019, 22:21
[...]
(let me know when you wanna make vacations, so i will not type questions then :))
Well, if you don't mind, I would like to go to bed right now ;)

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

Re: Publish not working anymore

#26 Post by TD-er » 09 Nov 2019, 23:31

Just as a reference, I added an issue to explain these changed in rules parameter parsing: https://github.com/letscontrolit/ESPEasy/issues/2724

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests