ESP Easy Ser2net no message in MQTT (P020)

Moderators: grovkillen, Stuntteam, TD-er

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

Re: ESP Easy Ser2net no message in MQTT (P020)

#51 Post by Ath » 14 Dec 2022, 07:39

giorgino wrote: 13 Dec 2022, 23:32 hey something happend: it was "locked", with MQTT explorer muted, than I connect PUTTY to the telnet port.

data stars to flow on the monitor of Putty and at the same time mqtt explorer starts to reporte the flow !

Is this useful for your debug?


----------------the flag!!!!! connected client?????
That's what that flag was introduced for, some time ago, when not having another process connected & listening at the TCP port of the plugin. ;)
/Ton (PayPal.me)

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

Re: ESP Easy Ser2net no message in MQTT (P020)

#52 Post by Ath » 14 Dec 2022, 22:39

I've added a feature to the plugin to be able to replace spaces or newlines by a different character, updated .bin can be downloaded from here: https://github.com/letscontrolit/ESPEas ... 3698876078 (Binaries.zip)

Can you (also) test the P1 WiFi Gateway plugin (P044)? (when having an energy meter available that uses the P1 protocol)
/Ton (PayPal.me)

fredduin
Normal user
Posts: 15
Joined: 21 Aug 2022, 14:30
Location: NL

Re: ESP Easy Ser2net no message in MQTT (P020)

#53 Post by fredduin » 31 May 2023, 15:56

I download the files and I get an error in PlatformIO (Core 6.16 Home 3.4.4 and Visual Studio Code 1.78.2)

"Assembler messages:
Fatal error: can't create .pio\build\normal_ESP8266_4M1M\libb53\SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library\SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library.cpp.o: No such file or directory
*** [.pio\build\normal_ESP8266_4M1M\libb53\SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library\SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library.cpp.o] Error 1"

I have no problem with the latest ESPEasy 20230508
Attachments
ErrorPlatformIO.JPG
ErrorPlatformIO.JPG (125.12 KiB) Viewed 5018 times

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

Re: ESP Easy Ser2net no message in MQTT (P020)

#54 Post by TD-er » 31 May 2023, 16:24

Recently there was some breaking change in PlatformIO 6.17, so I had to change a few things to make it work with the latest PlatformIO again.
So I wonder what you're trying to do here?
Why trying to compile older code, or using an older PlatformIO version?
How did you download the source? Check the libs are included in the download and if not please use the "Code" button on the main repo page: https://github.com/letscontrolit/ESPEasy
This allows you to download everything in the repo in a single ZIP file.
And also don't copy files of just any version over an existing folder with a previous download or else you may have some file duplicates when a file was moved or renamed.

fredduin
Normal user
Posts: 15
Joined: 21 Aug 2022, 14:30
Location: NL

Re: ESP Easy Ser2net no message in MQTT (P020)

#55 Post by fredduin » 01 Jun 2023, 08:19

I had problems/errors with 6.17 so I have downgrade PlatformIO to 6.16 (also needed for older projects)
(see https://letscontrolit.com/forum/viewtop ... mio#p64514)

I want to use MQTT with ser2net so I follow the link https://github.com/letscontrolit/ESPEas ... 3698876078
Source code (probably changed) https://github.com/tonhuisman/ESPEasy-1 ... out-client

Change log P020 (missing on new source P020 file?)
Attachments
changeLog020.JPG
changeLog020.JPG (77.42 KiB) Viewed 5005 times

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

Re: ESP Easy Ser2net no message in MQTT (P020)

#56 Post by TD-er » 01 Jun 2023, 08:31

When you look at the commits for that pull request, you'll see the commits since 2023-03-25 were just 'merge mega' commits or in other words they are just to keep the PR in sync with other merges to the main branch.
So no changes since the 25th seem OK to me.

Downloading ZIP files is always a bit tricky as you never know whether you create issues by not deleting previous files which have been renamed.
The better way is to use any Git tool to checkout specific branches.

I myself am very pleased with GitKraken (can be used for free for personal/open source projects)
But there are many other Git tools available.

fredduin
Normal user
Posts: 15
Joined: 21 Aug 2022, 14:30
Location: NL

Re: ESP Easy Ser2net no message in MQTT (P020)

#57 Post by fredduin » 01 Jun 2023, 13:06

I allays download and extract in a new directory.
Normally no problem

How can I test ser2net with MQTT?

I use ESP32 and ESP12

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

Re: ESP Easy Ser2net no message in MQTT (P020)

#58 Post by TD-er » 01 Jun 2023, 13:38

I have never used this Ser2Net plugin myself, but it looks like it will send out an event per received line of text.

Such an event looks like it will be something like this:

Code: Select all

!Serial#bla
For received code like "bla"
There seems to be an event like this per piece of text until there is a newline, or the buffer is full.

In rules this should be available as %eventpar%
See: https://espeasy.readthedocs.io/en/lates ... r-eventpar

N.B. this is what I take from reading the source code, never tried it myself.

fredduin
Normal user
Posts: 15
Joined: 21 Aug 2022, 14:30
Location: NL

Re: ESP Easy Ser2net no message in MQTT (P020)

#59 Post by fredduin » 01 Jun 2023, 17:50

I am lost. (please look at the history of this topic)

This topic start by me, ser2net is not working with MQTT

There is a PR (#4097), but the source code (https://github.com/tonhuisman/ESPEasy-1 ... out-client) does not work ( building bin file with PlatformIO)

See (other message) https://letscontrolit.com/forum/viewtop ... lem#p63251

I want to test the "pull request"
Attachments
ser2net_mqtt.JPG
ser2net_mqtt.JPG (81.82 KiB) Viewed 4989 times

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

Re: ESP Easy Ser2net no message in MQTT (P020)

#60 Post by Ath » 01 Jun 2023, 20:10

fredduin wrote: 01 Jun 2023, 17:50 There is a PR (#4097), but the source code (https://github.com/tonhuisman/ESPEasy-1 ... out-client) does not work ( building bin file with PlatformIO)

See (other message) https://letscontrolit.com/forum/viewtop ... lem#p63251

I want to test the "pull request"
I've pulled the mega branch into the PR, so a new build is cooking. You can download it from this Actions run in a short while.

NB: I have added a chapter Get a pull request by someone else on your system in the PlatformIO / development documentation, some months ago, on how to pull a specific PR to your system if you would want to create a specific Custom build from that.
/Ton (PayPal.me)

sincze
Normal user
Posts: 43
Joined: 15 Jul 2016, 12:54

Re: ESP Easy Ser2net no message in MQTT (P020)

#61 Post by sincze » 04 Mar 2024, 16:59

Thanks so much for all the help in this thread.

I recently installed the 20240229 - Mega with the Communication - Serial Server to read data from my P1 port.
Domoticz has direct access to this communication serial server, but I also wanted a second controller (Homeassistant) to be able to see the data.

By putting the Communication - Serial Server Event Processing on 'Generic' and adding the rule:

Code: Select all

on !Serial* do // Include * to process string values
  PublishR,ESP_Easy/%sysname%/P1,%eventvalue%
endon
All the data is now shown by my MQTT broker and Homeassistant is able to retrieve data from it.

Code: Select all

PublishR
has been recently added to Publish with Retain, however this seems not to work for !serial but does work for other mqtt messages that is publish.

To process it I only needed to create some interpretation rules.
https://github.com/sincze/Homeassistant ... nergy.yaml

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

Re: ESP Easy Ser2net no message in MQTT (P020)

#62 Post by Ath » 04 Mar 2024, 21:04

Thanks for sharing your info and configuration, that'll be helpful to a lot of people.

But this remark is unclear to me:
sincze wrote: 04 Mar 2024, 16:59 however this seems not to work for !serial but does work for other mqtt messages that is publish.
I don't see the relation between the PublishR command and !serial, other than to publish data to the MQTT server. Why wouldn't it send out the message?

You can of course add a line

Code: Select all

  logentry,'Sending to MQTT: %eventvalue%'
to your event, to see what's actually sent in the logging.
/Ton (PayPal.me)

sincze
Normal user
Posts: 43
Joined: 15 Jul 2016, 12:54

Re: ESP Easy Ser2net no message in MQTT (P020)

#63 Post by sincze » 04 Mar 2024, 21:52

Ath wrote: 04 Mar 2024, 21:04 Thanks for sharing your info and configuration, that'll be helpful to a lot of people.

But this remark is unclear to me:
sincze wrote: 04 Mar 2024, 16:59 however this seems not to work for !serial but does work for other mqtt messages that is publish.
I don't see the relation between the PublishR command and !serial, other than to publish data to the MQTT server. Why wouldn't it send out the message?

You can of course add a line

Code: Select all

  logentry,'Sending to MQTT: %eventvalue%'
to your event, to see what's actually sent in the logging.
Let me try to explain.

It publishes !serial message just fine
However retain flag is not set. I just dont see that with mqtt browser.

The other messages that i publish with same command publishr do set the Retain flag. :)

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

Re: ESP Easy Ser2net no message in MQTT (P020)

#64 Post by Ath » 04 Mar 2024, 23:24

Hm, can this be a setting on HA side, not retaining messages larger then a specific size? As I've been unable to find something similar in ESPEasy, and as it was me that added the PublishR command, I'm pretty sure there's no special condition for the retain flag not being set for the PublishR command 8-) iow: PublishR always sends out the message with the retain flag set.
/Ton (PayPal.me)

sincze
Normal user
Posts: 43
Joined: 15 Jul 2016, 12:54

Re: ESP Easy Ser2net no message in MQTT (P020)

#65 Post by sincze » 05 Mar 2024, 10:10

Ath wrote: 04 Mar 2024, 23:24 Hm, can this be a setting on HA side, not retaining messages larger then a specific size? As I've been unable to find something similar in ESPEasy, and as it was me that added the PublishR command, I'm pretty sure there's no special condition for the retain flag not being set for the PublishR command 8-) iow: PublishR always sends out the message with the retain flag set.
Sir I am truly happy with your modification ;-) and can thank you enough.
Please find attached the rules I used with PublishR and the monitored result in MQTT Browser.
ESP-Demonstrate.png
ESP-Demonstrate.png (230.45 KiB) Viewed 4196 times
As you can see for FLOW it sets RETAINED flag the other for P1 it did not.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests