ESP Easy Ser2net no message in MQTT (P020)
Moderators: grovkillen, Stuntteam, TD-er
ESP Easy Ser2net no message in MQTT (P020)
Hello,
I want to use MQTT from serial P1 slimmemeter.
Ser2net is working, I see the message/characters in telnet
For test I send messages/character with Putty/Com port
Other plugin is working with MQTT
Binary Filename:⋄ ESP_Easy_mega_20220809_normal_ESP8266_4M1M
Controller Plugin 005: Home Assistant (openHAB) MQTT
Syslog
Aug 25 12:41:28 ESP-Easy-P1-20 EspEasy: Ser2Net : data send!
Aug 25 12:41:28 ESP-Easy-P1-20 EspEasy: Ser2Net : data send!
Aug 25 12:41:28 ESP-Easy-P1-20 EspEasy: Ser2Net : data send!
Is this an issue?
Many thanks
I want to use MQTT from serial P1 slimmemeter.
Ser2net is working, I see the message/characters in telnet
For test I send messages/character with Putty/Com port
Other plugin is working with MQTT
Binary Filename:⋄ ESP_Easy_mega_20220809_normal_ESP8266_4M1M
Controller Plugin 005: Home Assistant (openHAB) MQTT
Syslog
Aug 25 12:41:28 ESP-Easy-P1-20 EspEasy: Ser2Net : data send!
Aug 25 12:41:28 ESP-Easy-P1-20 EspEasy: Ser2Net : data send!
Aug 25 12:41:28 ESP-Easy-P1-20 EspEasy: Ser2Net : data send!
Is this an issue?
Many thanks
- Attachments
-
- telnet.JPG (16.09 KiB) Viewed 6237 times
-
- P20_Ser2net.JPG (115.66 KiB) Viewed 6237 times
Re: ESP Easy Ser2net no message in MQTT (P020)
What MQTT controller have you configured in ESPEasy?
/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
Controller Plugin 005: Home Assistant (openHAB) MQTT
Config
Config
- Attachments
-
- mqtt.JPG (100.09 KiB) Viewed 6232 times
Re: ESP Easy Ser2net no message in MQTT (P020)
Are you sure the ESP is receiving the data from the P1 port?
I know there was something with P1 like it was an inverted signal?
There is also P044, which is essentially the Ser2Net plugin, but then tailored for P1.
Maybe you want to use that one for initial testing to see it is working?
Also which MQTT topics are you expecting the messages to be sent to?
Maybe also check with a tool like MQTT Explorer to see if it might be sent to an unexpected topic?
As far as I know, this plugin was not (yet) adapted to support sending task values of type String.
I know there was something with P1 like it was an inverted signal?
There is also P044, which is essentially the Ser2Net plugin, but then tailored for P1.
Maybe you want to use that one for initial testing to see it is working?
Also which MQTT topics are you expecting the messages to be sent to?
Maybe also check with a tool like MQTT Explorer to see if it might be sent to an unexpected topic?
As far as I know, this plugin was not (yet) adapted to support sending task values of type String.
Re: ESP Easy Ser2net no message in MQTT (P020)
AFAICS, HA has support for the network interface/protocol provided by P1 monitor: https://www.home-assistant.io/integrations/p1_monitor/
I'm not a HA user, so haven't tried this at home...
I'm not a HA user, so haven't tried this at home...

/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
This project might also help: https://infi.nl/nieuws/hobbyproject-sli ... aar-later/ (I'm just guessing you're able to read Dutch
)

/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
@TD-er
For test I do not send data from P1 (I am aware about inverting signal)
I send data from a USB-COM port for test.
The P044 has no "Send to controller" = no MQTT
I have a Tasmota P1 sensor working, but I prefer ESP-Easy
I am working on a small local project measuring voltage and send the data (MQTT) to a central server
For 1 Fase I use a smart adapter with Tasmota and MQTT. (works perfect)
For 3 fase I am looking for a P1 sensor with MQTT (simple cheap ESP12/ESP32/NodeMCU)
@Ath see my PCB, it can also be also used for SDS011 (fijnstofmeter + temp .. etc more than 45 sensor are build this year Amersfoort/Leusden/Woudenberg)
For test I do not send data from P1 (I am aware about inverting signal)
I send data from a USB-COM port for test.
The P044 has no "Send to controller" = no MQTT
I have a Tasmota P1 sensor working, but I prefer ESP-Easy
I am working on a small local project measuring voltage and send the data (MQTT) to a central server
For 1 Fase I use a smart adapter with Tasmota and MQTT. (works perfect)
For 3 fase I am looking for a P1 sensor with MQTT (simple cheap ESP12/ESP32/NodeMCU)
@Ath see my PCB, it can also be also used for SDS011 (fijnstofmeter + temp .. etc more than 45 sensor are build this year Amersfoort/Leusden/Woudenberg)
- Attachments
-
- mqtt-explorer.JPG (73.58 KiB) Viewed 6217 times
-
- pcb.JPG (119.44 KiB) Viewed 6217 times
Re: ESP Easy Ser2net no message in MQTT (P020)
What does Tasmota send?
Is it the complete P1 telegram?
If so, then maybe you could look into the SerialProxy plugin.
This one does send the full string to a MQTT controller.
Is it the complete P1 telegram?
If so, then maybe you could look into the SerialProxy plugin.
This one does send the full string to a MQTT controller.
Re: ESP Easy Ser2net no message in MQTT (P020)
Test message Hello from...
- Attachments
-
- HelloFromCom.JPG (90.64 KiB) Viewed 6185 times
Re: ESP Easy Ser2net no message in MQTT (P020)
OK, so Tasmota does wrap the entire string into a JSON message.
Can you have a look at the SerialProxy plugin, to see if that's working for you?
I did have a quick look at the code for the P1 plugin and I think we can make a small modification to it to allow to send the received data as an eventvalue.
Or send it to a MQTT controller.
But it also seems like it offers a socket for some client to connect to and if it isn't connected it won't process the data from the serial port but just discard it.
So maybe it needs some slightly more changes to send it as a string to a controller...
Can you have a look at the SerialProxy plugin, to see if that's working for you?
I did have a quick look at the code for the P1 plugin and I think we can make a small modification to it to allow to send the received data as an eventvalue.
Or send it to a MQTT controller.
But it also seems like it offers a socket for some client to connect to and if it isn't connected it won't process the data from the serial port but just discard it.
So maybe it needs some slightly more changes to send it as a string to a controller...
Re: ESP Easy Ser2net no message in MQTT (P020)
I have installed the SerialProxy, it is not working yet
Need some RegEx rules!?
The new P020 Serial Server plugin has "Process events without client" feature.
Need some RegEx rules!?
The new P020 Serial Server plugin has "Process events without client" feature.
Re: ESP Easy Ser2net no message in MQTT (P020)
When you enable that setting, and set Event processing to Generic, you will see events like !Serial#(your incoming message is here) that you can handle in the Rules:
This will include the entire string received, from %eventvalue0%
NB: Untested...
Code: Select all
on !Serial* do
Publish,whatever/topic/you/need/%eventvalue0%
endon
NB: Untested...
/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
SerialProxy is a bit special as it will send to the first enabled MQTT controller.
N.B. it requires a line termination character like \n
If there is none from the P1 meter, then it will never end waiting for a complete telegram.
Not sure if the P1 telegram has such a line ending.
N.B. it requires a line termination character like \n
If there is none from the P1 meter, then it will never end waiting for a complete telegram.
Not sure if the P1 telegram has such a line ending.
Re: ESP Easy Ser2net no message in MQTT (P020)
I have data in MQTT (plugin P087)
Re: ESP Easy Ser2net no message in MQTT (P020)
I get data from the P1 meter.(plugin P087 SerialProxy)
After a few strings from the P1 meter data is missing in MQTT Explorer
On the Ser2Net you can change the RX buffer to 1024
The P1 test message is 883 characters /38 Lines
No errors in syslog
After a few strings from the P1 meter data is missing in MQTT Explorer
On the Ser2Net you can change the RX buffer to 1024
The P1 test message is 883 characters /38 Lines
No errors in syslog
Re: ESP Easy Ser2net no message in MQTT (P020)
Does that config change fix the issue, or is data still missing?
/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
Yes,it fix the data missing on Ser2Net (not MQTT)
In telnet I see the last line when buffer is 1024
On buffer is 256 it stops at line 10
In telnet I see the last line when buffer is 1024
On buffer is 256 it stops at line 10
Re: ESP Easy Ser2net no message in MQTT (P020)
Could be the buffers are not that large on the SerialProxy.
Will look at the code to see if this might be the issue.
Will look at the code to see if this might be the issue.
Re: ESP Easy Ser2net no message in MQTT (P020)
Yep, it seems to be set to something like 500 bytes.
Re: ESP Easy Ser2net no message in MQTT (P020)
Is this a simple fix to change?
Re: ESP Easy Ser2net no message in MQTT (P020)
There are at least these 2 possible approaches here: (1 should be enough too fix this though)
a) Enable receiving data, and generate events, for P044 "Communication - P1 WiFi Gateway", as that already correctly handles receiving P1 data, similar to P020 "Communication - Serial Server"
b) Add a size the buffer on P087 "Communication - Serial Proxy", but that would probably need some fine-tuning to properly handle the P1 data 'quirks'
I prefer to go for option a) as that is already working correctly with P1 data when using a network connection.
a) Enable receiving data, and generate events, for P044 "Communication - P1 WiFi Gateway", as that already correctly handles receiving P1 data, similar to P020 "Communication - Serial Server"
b) Add a size the buffer on P087 "Communication - Serial Proxy", but that would probably need some fine-tuning to properly handle the P1 data 'quirks'
I prefer to go for option a) as that is already working correctly with P1 data when using a network connection.
/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
Ok, who makes a Pull request?
Re: ESP Easy Ser2net no message in MQTT (P020)
I'll do the PR, I did the same feature for P020, can do that again.
/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
<sniff><sniff><sniff>
Hmm do I smell some code duplication?
<sniff><sniff><sniff>
Re: ESP Easy Ser2net no message in MQTT (P020)
Or make a common plugin struct which can have a validator object as optional member.
Hint... that could be re-used even more.
Hint... that could be re-used even more.
Re: ESP Easy Ser2net no message in MQTT (P020)
Is there a PR?
Re: ESP Easy Ser2net no message in MQTT (P020)
I've merged the features of P044 into P020, in this PR, while still keeping P044 available as a plugin (it does convert its settings, so can't revert...).
There is probably 1 feature still missing though, for P1 data processing; an event is generated, but that doesn't include the data (yet), as the message can be quite large (buffer is 2kB), so could be unstable in low memory conditions. I'll see if I can add an option to enable that, though.
There is probably 1 feature still missing though, for P1 data processing; an event is generated, but that doesn't include the data (yet), as the message can be quite large (buffer is 2kB), so could be unstable in low memory conditions. I'll see if I can add an option to enable that, though.
/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
I've added an option in the plugin to pass the data in the event, so you could use a rule like this to publish to a MQTT topic:
Code: Select all
on SerialServer#Data* do // Include * to process string values
Publish,"your/topic/goes here",`%eventvalue0%` // Wrap in quotes because of possible separators in data
endon
/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
Hi everybody! I've got the same problem (or similar, sorry I'm newbie)
I'm reading a serial data (from solar VE.DIRECT) and ser2net does its job, so I read it on telnet at the selected 1236 port, but I need to publish the data on mqtt (than I will read it from HmeAssistant and publish on my dash board)
So the mqtt doesnt' post nothing.
I only set "SEND to CONTROLLER 1" where 1 is the MQTT broker used also for other topics (an working good)
Where am I wrong???
thankyou
I'm reading a serial data (from solar VE.DIRECT) and ser2net does its job, so I read it on telnet at the selected 1236 port, but I need to publish the data on mqtt (than I will read it from HmeAssistant and publish on my dash board)
So the mqtt doesnt' post nothing.
I only set "SEND to CONTROLLER 1" where 1 is the MQTT broker used also for other topics (an working good)
Where am I wrong???
thankyou
Re: ESP Easy Ser2net no message in MQTT (P020)
- What version of ESPEasy are you using (.bin file installed please)
- Have you added the rule I posted a few messages up? You need to adjust the eventname, the Event processing option should be set to Generic, and the rule should then look like this:
Code: Select all
on !Serial* do // Include * to process string values
Publish,"your/topic/goes here",`%eventpar%` // Wrap in quotes because of possible separators in data
endon
/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
hi, thank for your reply!
I'm using
ESP_Easy_mega_20211105_normal_ESP32_4M316k
mega-20211105_c79d675
I'm using
ESP_Easy_mega_20211105_normal_ESP32_4M316k
mega-20211105_c79d675
Re: ESP Easy Ser2net no message in MQTT (P020)
please let me know about "your/topic/goes here"
the serial gets strings like these:
---------------------------
PID 0xA053
FW 159
SER# HQ213436EP4
V 6380
I 0
VPV 30
PPV 0
CS 0
MPPT 0
OR 0x00000001
ERR 0
--------------------------
I need to extract "V ", "6380" and some other like VPV, PID etc
the MQTT should be something like this: "ESP_easy/input/vict1"
the serial gets strings like these:
---------------------------
PID 0xA053
FW 159
SER# HQ213436EP4
V 6380
I 0
VPV 30
PPV 0
CS 0
MPPT 0
OR 0x00000001
ERR 0
--------------------------
I need to extract "V ", "6380" and some other like VPV, PID etc
the MQTT should be something like this: "ESP_easy/input/vict1"
Re: ESP Easy Ser2net no message in MQTT (P020)
Can you please use a more recent release, preferably from the latest Github Actions build, here (you will need a (free) Github account to be able to download the Binaries.zip file)
/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
thanks, it works
Now, a step forward:
the mqtt publish strings, scrambled:
!Serial#
PID 0xA053
FW 159
SER# HQ2
then:
!Serial#
CS 0
MPPT 0
OR 0x00000001
ERR 0
LOAD ON
IL 0
H19 66
H20 1
H21 10
H22 0
H23 4
HSDS 33
or:
!Serial#
PPV 0
CS 0
MPPT 0
OR 0x00000001
ERR 0
LOAD ON
IL 0
H19 66
H20 1
H21 10
H22 0
H23 4
HSDS 33
Checksum
HOW can I collect only some data?example H20 (value=1) and H19 (value=66)

Code: Select all
on !Serial* do // Include * to process string values
Publish,'ESP_Easy/input/vict1',%eventvalue%
endon
the mqtt publish strings, scrambled:
!Serial#
PID 0xA053
FW 159
SER# HQ2
then:
!Serial#
CS 0
MPPT 0
OR 0x00000001
ERR 0
LOAD ON
IL 0
H19 66
H20 1
H21 10
H22 0
H23 4
HSDS 33
or:
!Serial#
PPV 0
CS 0
MPPT 0
OR 0x00000001
ERR 0
LOAD ON
IL 0
H19 66
H20 1
H21 10
H22 0
H23 4
HSDS 33
Checksum
HOW can I collect only some data?example H20 (value=1) and H19 (value=66)
Re: ESP Easy Ser2net no message in MQTT (P020)
P.S. update OTA to latest



Re: ESP Easy Ser2net no message in MQTT (P020)
so now I can't move:
data flows but they are mixed. How can I extract only some strings?
data flows but they are mixed. How can I extract only some strings?
Re: ESP Easy Ser2net no message in MQTT (P020)
is there any debug tools to learn the syntax of RULES ?
Re: ESP Easy Ser2net no message in MQTT (P020)
This should get you going: https://espeasy.readthedocs.io/en/lates ... terpreting
But for learning to work with rules, you can also start reading at the top of that page

/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
On the latest builds, there is syntax highlighting and code completion in the rules edit dialog when using a desktop browser.
Re: ESP Easy Ser2net no message in MQTT (P020)
And here (https://raw.githack.com/chromoxdor/Easy ... rcode.html) you find the online code-editor.
If you click there on the ? , you´ll find some basic instructions.
If you click on the "!" you´ll have code-editor and rules documentation side by side.
If you click there on the ? , you´ll find some basic instructions.
If you click on the "!" you´ll have code-editor and rules documentation side by side.
Re: ESP Easy Ser2net no message in MQTT (P020)
question: the only event I can get is %eventValue% that give me back my value.
%Eventname% and %eventpar% doesn't give me back nothing. Am I right? depends from SER2NET?
eventvalueN doesn't works too
%Eventname% and %eventpar% doesn't give me back nothing. Am I right? depends from SER2NET?
eventvalueN doesn't works too
Re: ESP Easy Ser2net no message in MQTT (P020)
You need a newer ESPEasy release to be able to use %eventname% and/or %eventpar%, try a merge build after the 20221105 release please
You can also test the PR build that adds some new features: https://github.com/letscontrolit/ESPEas ... 3610186170
Edit: Removed 1 link
Last edited by Ath on 07 Dec 2022, 11:40, edited 1 time in total.
/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
For ESP32 please try a later GitHub Actions build as the 20221105 build did have some funky issues with ESP32.
For example this one: https://github.com/letscontrolit/ESPEas ... 3634254620
For example this one: https://github.com/letscontrolit/ESPEas ... 3634254620
Re: ESP Easy Ser2net no message in MQTT (P020)
works go ahead: extracting and publishing over mqtt than got from nodered in HA and posted in my dashboard. BUT..... lock !!!
A new problem now: the mqtt sometimes seems to "lock" and the data flow to the broker stops to arrive.
Than, later, it restarts seem randomly. Any idea? is there any "overflows" or "overbuffer" in espeasy ?
(I'm really a newbie...)
A new problem now: the mqtt sometimes seems to "lock" and the data flow to the broker stops to arrive.
Than, later, it restarts seem randomly. Any idea? is there any "overflows" or "overbuffer" in espeasy ?
(I'm really a newbie...)
Re: ESP Easy Ser2net no message in MQTT (P020)
What options did you enable in your Device configuration page?
Can you collect the logs (info level is fine) by opening the Tools/Log page?
Have you increased the RX Buffer size? Not sure if the 1kB current max. size is large enough, though it may also be the cause of any crashes.
What other plugins are enabled?
Can you collect the logs (info level is fine) by opening the Tools/Log page?
Have you increased the RX Buffer size? Not sure if the 1kB current max. size is large enough, though it may also be the cause of any crashes.
What other plugins are enabled?
/Ton (PayPal.me)
Re: ESP Easy Ser2net no message in MQTT (P020)
pls do I need to compile ? isn't available the bin for OTA?Ath wrote: ↑07 Dec 2022, 07:43You need a newer ESPEasy release to be able to use %eventname% and/or %eventpar%, try a merge build after the 20221105 release please
You can also test the PR build that adds some new features: https://github.com/letscontrolit/ESPEas ... 3610186170
Edit: Removed 1 link
Re: ESP Easy Ser2net no message in MQTT (P020)
OPTIONS? only 1 device: Communication - Serial ServerAth wrote: ↑13 Dec 2022, 23:00 What options did you enable in your Device configuration page?
Can you collect the logs (info level is fine) by opening the Tools/Log page?
Have you increased the RX Buffer size? Not sure if the 1kB current max. size is large enough, though it may also be the cause of any crashes.
What other plugins are enabled?
Have you increased the RX Buffer size? it was 256B, now I try increasing to 1024B
Other plugins? Ii'm using only the seriale and the MQTT
Controller Queue
Minimum Send Interval:
100
[ms]
Max Queue Depth:
10
Max Retries:
10
Full Queue Action:
Ignore New
Allow Expire:
De-duplicate:
Check Reply:
Ignore Acknowledgement
Client Timeout:
100
[ms]
Re: ESP Easy Ser2net no message in MQTT (P020)
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?????
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?????
Who is online
Users browsing this forum: No registered users and 0 guests