Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[P044] Led settings and events without client, merged into [P020] #4283

Merged

Conversation

tonhuisman
Copy link
Contributor

@tonhuisman tonhuisman commented Oct 1, 2022

Resolves #4269
Resolves #4558

P044 - Communication - P1 WiFi Gateway
Features:

  • Configure Led pin (Enabled, Pin, Inverted)
  • Merged functionality into [P020] Communication - Serial Server to avoid code duplication
    • P044 is still available, is just uses P020 with a predefined, and somewhat limited, configuration options
    • Converts existing [P044] settings to [P020] on first settings-save after update.
  • Option to include P1 data in <taskname>#Data event (heavy on resources!)

P020 - Communication - Serial Server
Features:

  • Configure Led pin (Enabled, Pin, Inverted)
  • Adds 'P1 WiFi Gateway' option for Event processing
  • Increase max. buffer size
  • Add option for using Serial Port name as eventname (Generic events only)
  • Add option to append the task number to the eventname (Generic and RFLink events only)

Both plugins

  • Optionally include P1 data in #data event (could cause memory overflow issues, especially on ESP8266!), with newlines replaced by commas as P1 data doesn't have any commas
  • Select a replacement character for spaces and newlines in the data (before handing over to rules and sending out via TCP)
  • Introduce parseHexTextData() function in StringConverter
  • Add command serialsendmix,<"text content"|0xXX>[,...] to concatenate text and hex character values
    • Hex values can be a single byte, or multiple bytes, starting with 0x and separated by nothing, space, dash or colon.
  • Fix plugin initialization when USB (HW)CDC or I2C Serial is selected

TODO:

  • Convert settings on first run without prior settings-save
  • Documentation P020
    • Document commands
  • Documentation P044
  • Testing of new P1 WiFi Gateway using the Serial Server code (functionally merged)
  • Use buffering supplied by ESPEasySerial

Considering to also add: (feedback requested)

  • Fully configurable serial settings (done)
  • Process events without a network client connected (Forum thread)
  • Merge functionality of this plugin into P020 - Communication - Serial Server, as suggested here (done)

@tonhuisman tonhuisman changed the title Feature/p044 led and events without client [P044] Led settings and events without client Oct 1, 2022
@tonhuisman tonhuisman changed the title [P044] Led settings and events without client [P044] Led settings and events without client, merged into [P020] Oct 8, 2022
…feature/P044-led-and-events-without-client
…feature/P044-led-and-events-without-client
…feature/P044-led-and-events-without-client
…feature/P044-led-and-events-without-client
…feature/P044-led-and-events-without-client
@tonhuisman
Copy link
Contributor Author

@wdonker Can you retest this build, as I've finally been able to actually test (and fix...) the issues you've mentioned. I'm receiving the P1 data as intended/expected now 😃

@wdonker
Copy link
Contributor

wdonker commented Aug 12, 2023

I will test it next week since I am not at home right now.
Will report back my findings.

@wdonker
Copy link
Contributor

wdonker commented Aug 17, 2023

Sorry Ton, the result is still the same: a CR/LF seems to be missing after the last line of the P1 message (I think it is the checksum line).

Output from ESP_Easy_mega_20230409_normal_ESP8266_4M1M:

/KFM5KAIFA-METER

1-3:0.2.8(42)
0-0:1.0.0(230817110236S)
0-0:96.1.1(4530303039303030303133323439343134)
1-0:1.8.1(010739.484*kWh)
1-0:1.8.2(010988.776*kWh)
1-0:2.8.1(001732.340*kWh)
1-0:2.8.2(004047.350*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(00.000*kW)
1-0:2.7.0(00.221*kW)
0-0:96.7.21(00015)
0-0:96.7.9(00012)
1-0:99.97.0(9)(0-0:96.7.19)(221111154934W)(0000001027*s)(190322092317W)(00000016                                                                                                                               07*s)(181103094805W)(0000000981*s)(151021144211S)(0000002347*s)(150327105700W)(0                                                                                                                               000004700*s)(141224155411W)(0000004643*s)(141203111634W)(0000000787*s)(000101000                                                                                                                               001W)(2147483647*s)(000101000001W)(2147483647*s)
1-0:32.32.0(00000)
1-0:32.36.0(00001)
0-0:96.13.1()
0-0:96.13.0()
1-0:31.7.0(001*A)
1-0:21.7.0(00.000*kW)
1-0:22.7.0(00.224*kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303032333430313536373530333134)
0-1:24.2.1(230817100000S)(07995.090*m3)
!9B9C
/KFM5KAIFA-METER

1-3:0.2.8(42)
0-0:1.0.0(230817110246S)
etc.

Output from ESP_Easy_mega_20230812_normal_ESP8266_4M1M:

/KFM5KAIFA-METER

1-3:0.2.8(42)
0-0:1.0.0(230817110644S)
0-0:96.1.1(4530303039303030303133323439343134)
1-0:1.8.1(010739.484*kWh)
1-0:1.8.2(010988.776*kWh)
1-0:2.8.1(001732.340*kWh)
1-0:2.8.2(004047.368*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(00.000*kW)
1-0:2.7.0(00.350*kW)
0-0:96.7.21(00015)
0-0:96.7.9(00012)
1-0:99.97.0(9)(0-0:96.7.19)(221111154934W)(0000001027*s)(190322092317W)(0000001607*s)(181103094805W)(0000000981*s)(151021144211S)(0000002347*s)(150327105700W)(0000004700*s)(141224155411W)(0000004643*s)(141203111634W)(0000000787*s)(000101000001W)(2147483647*s)(000101000001W)(2147483647*s)
1-0:32.32.0(00000)
1-0:32.36.0(00001)
0-0:96.13.1()
0-0:96.13.0()
1-0:31.7.0(001*A)
1-0:21.7.0(00.000*kW)
1-0:22.7.0(00.350*kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303032333430313536373530333134)
0-1:24.2.1(230817100000S)(07995.090*m3)
!D87C/KFM5KAIFA-METER

1-3:0.2.8(42)
0-0:1.0.0(230817110654S)
etc.


@tonhuisman
Copy link
Contributor Author

Hm, I'll have a look, as I do have more time available currently, and the hardware to physically test it 😉

@tonhuisman
Copy link
Contributor Author

tonhuisman commented Aug 17, 2023

@wdonker I expect to have found the culprit, please set the RX Receive Timeout to 50-100 msec when using a DSMR 5 meter (115200 baud), so the checksum will be read & calculated in the same 'burst' as the rest of the data. At least my meter needs some time (> 100 msec) to generate the checksum before that's sent.
I've also added the missing CR/LF in the output, as that was read but not added to the buffer before sending it to the client...

@wdonker
Copy link
Contributor

wdonker commented Aug 17, 2023

I think this time you nailed it, Ton!
First I tried this firmware without the RX Receive Timeout but Domoticz complained about a bad CRC.
Than I set the Timeout to 50 mSec and now it works ok. My meter is a DSMR 4 btw.

@TD-er TD-er merged commit 274b1e8 into letscontrolit:mega Dec 29, 2023
164 checks passed
@tonhuisman tonhuisman deleted the feature/P044-led-and-events-without-client branch December 29, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RS232 command how it works ? [P044] Make status LED pin configurable
3 participants