Publish. Where am I going wrong?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
uxhamby
Normal user
Posts: 44
Joined: 29 Dec 2016, 18:13
Location: Toronto Canada

Publish. Where am I going wrong?

#1 Post by uxhamby » 28 Nov 2019, 20:12

ESPEASY version is as follows:
mega-20180809
Has been working for quite a while but now I am trying to add an MQTT publish to the rule set as follows:
on FurnaceBurner#Flame=1 do
sendTo 10,relay,0,1
sendTo 12,TaskValueSet,1,1,1
SendToHTTP 192.168.55.152,80,/cm?cmnd=Power1%200
Publish FurnBurn, "Flame: On"
endOn

on FurnaceBurner#Flame=0 do
sendTo 10,relay,0,0
sendTo 12,TaskValueSet,1,1,0
Publish FurnBurn, "Flame: Off"
SendToHTTP 192.168.55.152,80,/cm?cmnd=Power1%201
endOn
I have the following mosquitto_pub /_sub verification that my MQTT connections are workking:
bjh@laptop2:~$ mosquitto_pub -h broker.hivemq.com -p 1883 -t EnzoStuff/FurnBurn -m "Hello"
bjh@laptop2:~$ mosquitto_pub -h broker.hivemq.com -p 1883 -t EnzoStuff/FurnBurn -m "WTF?"
bjh@laptop2:~$
bjh@laptop2:~$ mosquitto_sub -h broker.hivemq.com -p 1883 -t EnzoStuff/FurnBurn
Hello
WTF?
I have my controller setup as follows:
Screenshot from 2019-11-28 14-07-37.png
Screenshot from 2019-11-28 14-07-37.png (67.68 KiB) Viewed 468 times
No publishing is going on that I can see, where am I going wrong?

Thanks, Brian H.

User avatar
grovkillen
Core team member
Posts: 3324
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Publish. Where am I going wrong?

#2 Post by grovkillen » 28 Nov 2019, 20:19

Do you have a space after the comma?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
ThomasB
Normal user
Posts: 444
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Publish. Where am I going wrong?

#3 Post by ThomasB » 28 Nov 2019, 21:09

I see that the rule's publish command has an incomplete topic name. See this example:

Code: Select all

Publish EnzoStuff/FurnBurn,"Flame: Off"
- Thomas

User avatar
uxhamby
Normal user
Posts: 44
Joined: 29 Dec 2016, 18:13
Location: Toronto Canada

Re: Publish. Where am I going wrong?

#4 Post by uxhamby » 28 Nov 2019, 23:51

I see that the rule's publish command has an incomplete topic name. See this example:
CODE: SELECT ALL

Publish EnzoStuff/FurnBurn,"Flame: Off"
Is that not covered by the "EnzoStuff/" in the Publish field of the controller setup panel?

User avatar
uxhamby
Normal user
Posts: 44
Joined: 29 Dec 2016, 18:13
Location: Toronto Canada

Re: Publish. Where am I going wrong?

#5 Post by uxhamby » 29 Nov 2019, 00:02

Do you have a space after the comma?
Yes there is.

BJH

User avatar
grovkillen
Core team member
Posts: 3324
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Publish. Where am I going wrong?

#6 Post by grovkillen » 29 Nov 2019, 02:46

uxhamby wrote:
29 Nov 2019, 00:02
Do you have a space after the comma?
Yes there is.

BJH
Please remove it.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

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

Re: Publish. Where am I going wrong?

#7 Post by TD-er » 29 Nov 2019, 09:21

Just to clearify a bit (or make it more confusing... I never know)

See the "Parameter Parsing" here: https://espeasy.readthedocs.io/en/lates ... er-parsing
(Also to Jimmy)

Have you tried the suggestion made by TomasB ? viewtopic.php?p=41029#p41029

User avatar
grovkillen
Core team member
Posts: 3324
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Publish. Where am I going wrong?

#8 Post by grovkillen » 29 Nov 2019, 13:22

TD-er wrote:
29 Nov 2019, 09:21
Just to clearify a bit (or make it more confusing... I never know)

See the "Parameter Parsing" here: https://espeasy.readthedocs.io/en/lates ... er-parsing
(Also to Jimmy)

Have you tried the suggestion made by TomasB ? viewtopic.php?p=41029#p41029
Thanks for clearing that to me :)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
uxhamby
Normal user
Posts: 44
Joined: 29 Dec 2016, 18:13
Location: Toronto Canada

Re: Publish. Where am I going wrong?

#9 Post by uxhamby » 29 Nov 2019, 16:26

Have you tried the suggestion made by TomasB ?
I think so. Please see:

viewtopic.php?f=4&t=7256#p41037

User avatar
uxhamby
Normal user
Posts: 44
Joined: 29 Dec 2016, 18:13
Location: Toronto Canada

Re: Publish. Where am I going wrong?

#10 Post by uxhamby » 29 Nov 2019, 16:52

I am now configured as follows:
Screenshot from 2019-11-29 10-40-24.png
Screenshot from 2019-11-29 10-40-24.png (76.04 KiB) Viewed 377 times
No spaces after comma.

Screenshot from 2019-11-29 10-40-46.png
file1
Screenshot from 2019-11-29 10-40-46.png (68.02 KiB) Viewed 377 times

I have done a reset of the esp.

I see no difference in behaviour so far.

BJH

User avatar
uxhamby
Normal user
Posts: 44
Joined: 29 Dec 2016, 18:13
Location: Toronto Canada

Re: Publish. Where am I going wrong?

#11 Post by uxhamby » 29 Nov 2019, 20:53

From the log on my ESP surrounding an event that should (or I want to) "Publish".
2379963: EVENT: H2OBurner#WFlame=0.00
2382365: SW : Switch state 1 Output value 0
2382369: EVENT: FurnaceBurner#Flame=0.00
2382379: ACT : sendTo 10,relay,0,0
2382392: ACT : sendTo 12,TaskValueSet,1,1,0
2382403: ACT : Publish,EnzoStuff/FurnBurn,'Flame: Off'
2382416: ACT : SendToHTTP 192.168.55.152,80,/cm?cmnd=Power1%201
2382439: Command: sendto
2382508: Command: sendto
2382576: Command: publish
2382579: Command: sendtohttp
2384963: SW : State 0.00
2384966: EVENT: H2OBurner#WFlame=0.00
2389961: SW : State 0.00
2389964: EVENT: H2OBurner#WFlame=0.00
2394961: SW : State 0.00
2394964: EVENT: H2OBurner#WFlame=0.00
2395859: EVENT: Clock#Time=Fri,14:40

User avatar
uxhamby
Normal user
Posts: 44
Joined: 29 Dec 2016, 18:13
Location: Toronto Canada

Re: Publish. Where am I going wrong?

#12 Post by uxhamby » 29 Nov 2019, 21:01

I randomly tried giving the ESP an MQTT topic to subscribe to, (in the controllers panel) from other work I am doing.


Screenshot from 2019-11-29 15-02-19.png
Screenshot from 2019-11-29 15-02-19.png (71.41 KiB) Viewed 347 times


This seems to have made a difference. I now seem to be "Publishing"
bjh@laptop2:~$ mosquitto_sub -h broker.hivemq.com -p 1883 -t EnzoStuff/FurnBurn
Hello
WTF?
WTF2?
test
"Flame: Off"
"Flame: On"
"Flame: Off"
"Flame: On"
"Flame: Off"
"Flame: On"
Not sure what it means but I feel like I've made some progress. I'll keep you posted.

Cheers,

BJH

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

Re: Publish. Where am I going wrong?

#13 Post by TD-er » 29 Nov 2019, 21:48

Just a few remarks based on the screenshots you showed here: viewtopic.php?p=41056#p41056

sendTo is sending a command, so the last part should be considered as a single parameter.

Code: Select all

sendto 10,"relay,0,0"
sendto 12,"taskvalueset,1,1,1"
Your sendtohttp command. Is that one sending to another ESPEasy node?
If so, then the url must be more like ...,/tools?cmd=...

Just as a test, can you add something like this:

Code: Select all

on starttest do
logentry "starttest publish"
publish "EnzoStuff/FurnBurn","Flame: On"
endon
Then trigger this event via the command text box on the Tools tab:

Code: Select all

event,starttest

User avatar
uxhamby
Normal user
Posts: 44
Joined: 29 Dec 2016, 18:13
Location: Toronto Canada

Re: Publish. Where am I going wrong?

#14 Post by uxhamby » 30 Nov 2019, 00:30

Your sendtohttp command. Is that one sending to another ESPEasy node?
No, it is not. It sends to a non 'ESPEASY' device. This is working just fine for my purposes as is.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests