Serial Server: No events without a networkclient connected
Moderators: grovkillen, Stuntteam, TD-er
Serial Server: No events without a networkclient connected
Good evening!
I am currently trying to make a serial sensor smart.
So far, I have the sensor connected to the RX pins of a wemos d1 mini running ESP_Easy_mega_20220427_normal_ESP8266_4M1M
While a telnet client is connected to the serverport, I do get the characters from my sensor on the client and esp-easy generates events I can work with in rules.
However, with the client disconnected esp-easy does not generate the events anymore.
Is there a way around this? I only need to process the events.
Cheers, elfrinjo
I am currently trying to make a serial sensor smart.
So far, I have the sensor connected to the RX pins of a wemos d1 mini running ESP_Easy_mega_20220427_normal_ESP8266_4M1M
While a telnet client is connected to the serverport, I do get the characters from my sensor on the client and esp-easy generates events I can work with in rules.
However, with the client disconnected esp-easy does not generate the events anymore.
Is there a way around this? I only need to process the events.
Cheers, elfrinjo
Re: Serial Server: No events without a networkclient connected
Have to look into the source code, but I think this one might have a check in there for network connectivity.
Given your use case that should be made either optional or removed.
Maybe Ton can also have a look at it, as I'm busy today.
Given your use case that should be made either optional or removed.
Maybe Ton can also have a look at it, as I'm busy today.
Re: Serial Server: No events without a networkclient connected
There is indeed an explicit check when handling data. I'll add an option to make that optional.
/Ton (PayPal.me)
Re: Serial Server: No events without a networkclient connected
I've added a config setting to enable event processing even when no network client is connected, please try this test-build:
(Improved version below)
Configuration option looks like this:
Last edited by Ath on 26 May 2022, 13:24, edited 1 time in total.
/Ton (PayPal.me)
Re: Serial Server: No events without a networkclient connected
Wow, you guys are amazing. Thank you very much!!
Re: Serial Server: No events without a networkclient connected
Please let us know if it is working as expected (no side effects), so we can merge the code.
Re: Serial Server: No events without a networkclient connected
I'll do!
However, at the moment the UI does not seem to save the checkbox when submitting.
/ Cheers, elfrinjo
However, at the moment the UI does not seem to save the checkbox when submitting.
/ Cheers, elfrinjo
Re: Serial Server: No events without a networkclient connected
Yep, that's indeed plausible.
The plugin now needs some changes in the PLUGIN_WEB_SAVE part too.
The plugin now needs some changes in the PLUGIN_WEB_SAVE part too.
Re: Serial Server: No events without a networkclient connected
That is tested, and worked here
I'll have a look.
I'll have a look.
/Ton (PayPal.me)
Re: Serial Server: No events without a networkclient connected
And I need a new coffee as it was indeed implemented, so no idea why it may not be working...
Re: Serial Server: No events without a networkclient connected
Something to do with the bool not being understood correctly, somewhere. Worked fine on ESP32 when tested, had not explicitly tested on ESP8266, only uploaded on ESP8266 and it showed up as intended
New upload: (has the same filename, so you may need to clear the browser cache)
New upload: (has the same filename, so you may need to clear the browser cache)
/Ton (PayPal.me)
Re: Serial Server: No events without a networkclient connected
This version works for me!
I'll test it over the weekend and provide feedback.
/ Cheers, elfrinjo
I'll test it over the weekend and provide feedback.
/ Cheers, elfrinjo
Re: Serial Server: No events without a networkclient connected
Hi,
so far, I did not find weird side-effects on the serial rx.
What I did find is an issue with event-generation when cr/lfs (or maybe just crs) are present:
An event is generated for the string before the first cr/lf only. The rest seems to be discarded from the events but is transferred to the network client.
Cheers, elfrinjo
so far, I did not find weird side-effects on the serial rx.
What I did find is an issue with event-generation when cr/lfs (or maybe just crs) are present:
An event is generated for the string before the first cr/lf only. The rest seems to be discarded from the events but is transferred to the network client.
Cheers, elfrinjo
Re: Serial Server: No events without a networkclient connected
OK, I guess that would make sense to generate events on every part.
Just consider each received text upto CR/LF as a seperate text.
It doesn't make sense to make it dependent on how fast data is being processed (thus if there is still something in the buffer)
Just consider each received text upto CR/LF as a seperate text.
It doesn't make sense to make it dependent on how fast data is being processed (thus if there is still something in the buffer)
Re: Serial Server: No events without a networkclient connected
That should then also be optional, as the current behavior should stay unchanged for those that expect it that way.
I'll add a setting for that.
I'll add a setting for that.
/Ton (PayPal.me)
Re: Serial Server: No events without a networkclient connected
I've done a first attempt to implement multi line processing, can you test, please? Has to be enabled in the Serial Server task settings.
(removed, see below)
And please also test if the existing behavior is unchanged, don't have a matching setup available
(removed, see below)
And please also test if the existing behavior is unchanged, don't have a matching setup available
Last edited by Ath on 29 May 2022, 14:34, edited 1 time in total.
/Ton (PayPal.me)
Re: Serial Server: No events without a networkclient connected
Hi Ton,
this version crashes when
- the new setting is enabled
- and when serial data comes in
With the new setting disabled I did not see those problems.
When enabling the setting these are the last and the first line from the log:
When serial data comes in, there is no additional output:
Cheers, elfrinjo
this version crashes when
- the new setting is enabled
- and when serial data comes in
With the new setting disabled I did not see those problems.
When enabling the setting these are the last and the first line from the log:
Code: Select all
2022-05-29T10:50:26.104639+00:00 espeasy-1 EspEasy: EVENT: TaskExit#serial=2,1 Processing time:104 milliSeconds
2022-05-29T10:50:33.637873+00:00 espeasy-1 EspEasy: firstLoopConnectionsEstablished
Code: Select all
2022-05-29T10:55:06.237499+00:00 espeasy-1 EspEasy: WiFi : Set TX power to 12dBm sensitivity: -69dBm RSSI: -61dBm
2022-05-29T10:55:17.521029+00:00 espeasy-1 EspEasy: firstLoopConnectionsEstablished
Cheers, elfrinjo
Re: Serial Server: No events without a networkclient connected
Hm, I'll have a look, and try to set up a testing environment for this for debugging purposes.
/Ton (PayPal.me)
Re: Serial Server: No events without a networkclient connected
Made some improvements, and did some testing, please re-test:
(Updated, see below)
(Updated, see below)
Last edited by Ath on 29 May 2022, 22:55, edited 2 times in total.
/Ton (PayPal.me)
Re: Serial Server: No events without a networkclient connected
The crash when submitting the enable multilineprosessing setting seems to be gone
but when receiving data the controller still reboots.
Cheers, elfrinjo
but when receiving data the controller still reboots.
Cheers, elfrinjo
Re: Serial Server: No events without a networkclient connected
What message length do you typically receive?
It could be an issue with out of memory?
I think the message should be processed immediately as soon as a newline is received and not keep on capturing followed by processing it.
If these messages occur shortly one after the other, then the memory requirements are probably too much to handle. Especially when copying messages from an already long string.
It could be an issue with out of memory?
I think the message should be processed immediately as soon as a newline is received and not keep on capturing followed by processing it.
If these messages occur shortly one after the other, then the memory requirements are probably too much to handle. Especially when copying messages from an already long string.
Re: Serial Server: No events without a networkclient connected
That is very unlikely. I am receiving data from a blood pressuremonitor, the typical datastream looks like this:
(With long pauses where I put the newlines)
(With long pauses where I put the newlines)
Code: Select all
O N [0D] [0A]
C H K [0D] [0A]
I N F [0D] [0A]
D E F [0D] [0A]
E X H [0D] [0A] r x 0 0 4 4 0 0 2 F 0 0 5 C [0D] [0A] r a 0 0 0 0 [0D] [0A]
W A I [0D] [0A]
O F F [0D] [0A]
Re: Serial Server: No events without a networkclient connected
I've tried to improve string-handling by using pointers, but didn't have enough sanity checks included.
That is now corrected, please test this version:
(Updated, see below)
NB: Same filename as previous download, you may need to clear the browser cache.
That is now corrected, please test this version:
(Updated, see below)
NB: Same filename as previous download, you may need to clear the browser cache.
Last edited by Ath on 30 May 2022, 23:02, edited 1 time in total.
/Ton (PayPal.me)
Re: Serial Server: No events without a networkclient connected
No, sorry, I am still getting reboots when data arrives.
Re: Serial Server: No events without a networkclient connected
Just to make sure you have the correct .bin file installed, what is the Git Build shown on the Main tab?
With the previous build I had reboots too, after receiving a few characters, but then I was under the impression it had to do with my poor testing environment, but with the latest build I couldn't crash it anymore, so it felt like I fixed it...
With the previous build I had reboots too, after receiving a few characters, but then I was under the impression it had to do with my poor testing environment, but with the latest build I couldn't crash it anymore, so it felt like I fixed it...
/Ton (PayPal.me)
Re: Serial Server: No events without a networkclient connected
I did find some room for improvement, though I didn't see any crashes during testing, but here is an update:
/Ton (PayPal.me)
Re: Serial Server: No events without a networkclient connected
Hi Ton, Hi TD-er,
this release works flawlessly for me!
The events are generated with the new option turned on and no client connected.
The cr/lfs are recognized as a delimiter for events when the option for that is activated.
And I still see the old behavior when the options are turned off.
Thank you very much for your efforts once again!
Cheers, elfrinjo
this release works flawlessly for me!
The events are generated with the new option turned on and no client connected.
The cr/lfs are recognized as a delimiter for events when the option for that is activated.
And I still see the old behavior when the options are turned off.
Thank you very much for your efforts once again!
Cheers, elfrinjo
Re: Serial Server: No events without a networkclient connected
Great, thanks for the feedback
/Ton (PayPal.me)
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 0 guests