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

feat!: Rework result post-processing and publishing (REST, MQTT, InfluxDB) #57

Merged
merged 27 commits into from
Aug 13, 2023

Conversation

Slider0007
Copy link
Owner

@Slider0007 Slider0007 commented Aug 11, 2023

  • Generally rename of all preValue name variants to fallbackValue in code and WebUI
  • Renaming of internal variable names:
Old name New name
ReturnValue sActualValue
ReturnRawValue sRawValue
ErrorMessageText sValueStatus
ReturnPreValue sFallbackValue
ReturnRateValue sRatePerMin
ReturnChangeAbsolute sRateperProcessing
timeStamp sTimeProcessed
lastvalue sTimeFallbackValue
PreValueOkay isFallbackValueValid
... --> All functions and further variants of these variables are renamed in similar style
  • Remove unused parameter ErrorMessage in code and WebUI
  • WebUI: Parameter Use FallbackValue delcare as expert parameter, because usage is strongly recommended (active by default)
  • WebUI: Add Raw value to graph
  • Adapat test cases to new namings
  • Some translations

⚠️ BREAKING CHANGES:

1. Result value behaviour:

  • In any case actual value is set to valid value every processing cycle, either to the new valid raw value or in case of a reading deviation to the valid fallback value -> No empty result value anymore
  • Resulting rates (rate/min + rate/processing interval) have always a value, either a new calculated value derived from new valid raw value reading or 0.0 if a deviation was detected -> No empty values anymore

2. Value status (legacy name: ErrorMessageText)

  • Adapted status texts and include status number:
Old text New text
no error 000 Valid
No data to substitude N E90 No data to substitude N
Neg. Rate: ... E91 Rate negative
Rate too high: ... E92 Rate too high (<)
Rate too high: ... E93 Rate too high (>)
  • In data logging only number of value status (e.g. 000 or E91) is logged, no text anymore
2023-08-11T14:36:07+0200,main,096.292,96.293,96.293,0.0000,0.000,E91,0.2,9.1,6.3,2.8,9.2
2023-08-11T14:38:07+0200,main,096.295,96.295,96.295,0.0010,0.002,000,0.2,9.1,6.2,2.9,9.5
2023-08-11T14:40:07+0200,main,096.296,96.296,96.296,0.0005,0.001,000,0.2,9.1,6.3,2.9,9.6
2023-08-11T14:42:07+0200,main,096.300,96.300,96.300,0.0020,0.004,000,0.2,9.1,6.3,2.9,0.0
2023-08-11T14:44:07+0200,main,096.301,96.301,96.301,0.0005,0.001,000,0.2,9.1,6.3,2.9,0.1
2023-08-11T14:46:07+0200,main,096.305,96.305,96.305,0.0020,0.004,000,0.2,9.1,6.3,2.9,0.5
2023-08-11T14:47:42+0200,main,096.305,96.305,96.305,0.0000,0.000,000,0.2,9.1,6.3,3.0,0.5
2023-08-11T14:49:42+0200,main,096.304,96.305,96.305,0.0000,0.000,E91,0.2,9.1,6.2,2.9,0.4
2023-08-11T14:51:42+0200,main,096.305,96.305,96.305,0.0000,0.000,000,0.2,9.1,6.2,2.9,0.5
2023-08-11T14:53:42+0200,main,096.318,96.318,96.318,0.0065,0.013,000,0.2,9.1,6.2,3.0,1.8
2023-08-11T14:55:42+0200,main,096.318,96.318,96.318,0.0000,0.000,000,0.2,9.1,6.3,3.0,1.8
2023-08-11T14:57:42+0200,main,096.318,96.318,96.318,0.0000,0.000,000,0.2,9.1,6.3,3.2,1.8
2023-08-11T14:59:42+0200,main,096.328,96.328,96.328,0.0050,0.010,000,0.2,9.1,6.3,3.2,2.8
2023-08-11T15:01:42+0200,main,096.332,96.332,96.332,0.0020,0.004,000,0.2,9.1,6.3,3.2,3.2
2023-08-11T15:03:42+0200,main,096.332,96.332,96.332,0.0000,0.000,000,0.2,9.1,6.2,3.2,3.2
2023-08-11T15:05:42+0200,main,096.335,96.335,96.335,0.0015,0.003,000,0.2,9.1,6.3,3.2,3.5
2023-08-11T15:07:43+0200,main,096.344,96.344,96.344,0.0045,0.009,000,0.2,9.1,6.3,3.5,4.4
2023-08-11T15:09:42+0200,main,096.347,96.347,96.347,0.0015,0.003,000,0.2,9.1,6.3,3.4,4.7
2023-08-11T15:11:43+0200,main,096.347,96.347,96.347,0.0000,0.000,000,0.2,9.1,6.2,3.3,4.7
2023-08-11T15:13:43+0200,main,096.347,96.347,96.347,0.0000,0.000,000,0.2,9.1,6.3,3.3,4.7
2023-08-11T15:15:43+0200,main,096.347,96.347,96.347,0.0000,0.000,000,0.2,9.1,6.3,3.5,4.7
2023-08-11T15:18:21+0200,main,096.346,96.347,96.347,0.0000,0.000,E91,0.2,9.1,6.3,3.5,4.6
2023-08-11T15:20:21+0200,main,096.347,96.347,96.347,0.0000,0.000,000,0.2,9.1,6.3,3.3,4.7
2023-08-11T15:20:38+0200,main,096.347,96.347,96.347,0.0000,0.000,000,0.2,9.1,6.2,3.3,4.7
2023-08-11T15:22:38+0200,main,096.348,96.348,96.348,0.0005,0.001,000,0.2,9.1,6.3,3.3,4.8

3. Indication of rate deviation

  • At smaller negative rates, no special threshold evaluation is performed anymore (independed of extended resolution switc on or off). Any negative deviation which is smaller than max. rate threshold will lead to status E91 rate negative. Fallback Value can be used to cover this circumstance and provide still a valid actual value.
    Note: Timestamp of fallback value is going to be updated.
  • Therefore status E91 Rate negative is only debug level, because it doesn't hurt.
  • Rate too high (rate > max. rate threshold) status is splitted into two states, negative and positive deviation.
    • A negative rate too high deviation result in same reaction than E91 Rate negative, using the fallback value, but additionally can be used for diagnostic purpose (e.g. automatically save respective images (feature, not implemented yet)
      Note: Timestamp of fallback value is going to be updated.
    • At positive rate too high deviation, also fallback value is used. Fallback value and respective timestamp will not be updated.
  • Additional NOTE:
    • Rate per minute: actual value - fallback value / time difference between now and the last modification of fallback value
    • Rate per processing: actual value - fallback value (time difference is processing interval, therefore the rate per processing is equal to the absolute difference between two valid readings)

4. InfluxDBv1 + InfluxDBv2

  • Due to the fact that actual value is always set to a value, actual value is published now at every cycle.
    Exception: If actual value cannot be converted to a number (e.g. N replacement not possible) no publish will be triggered
  • Timestamp generally represents the time of last processing

5. MQTT result publishing:

  • Changed topic names / json element:
Old topic name New topic name
value actual_value
raw raw_value
error value_status
changeabsolut / rate_per_digitalization_round rate_per_processing
rate rate_per_min
timestamp timestamp_processed
elements of json topic element names are also adapted to identical topic names
  • HA discovery adapted to new naming as well
  • Timestamp generally represents the time of last processing

6. REST API

  • Changed API name (due to renaming)
Old name New name
/SetPreValue /set_fallbackvalue
  • Changed API option of API /value (due to renaming)
Old option New option
type=error type=status

-> /value?all=true&type=status
-> /value?all=true&type=status&numbersname=main

BEGIN_COMMIT_OVERRIDE
feat!: Rework result post-processing and publishing (REST, MQTT, InfluxDB)
refactor!: Changed MQTT topic names
refactor!: Renamed REST API /value option: error -> status
refactor!: Adapted data log structure (value status only status number)
refactor!: Rename of preValue name variants to fallbackValue in code and WebUI
fix(webui): Config: Remove unused parameter ErrorMessage in code and WebUI
refactor(webui): Overview: Show round counter in separate line
feat(webui): Data Graph: Add Raw value + refactor
chore(webui): Config: Parameter Use FallbackValue delcare as expert parameter
END_COMMIT_OVERRIDE

@Slider0007 Slider0007 changed the title Refactor result post-processing and result publishing (MQTT, InfluxDB) Refactor result post-processing and related result publishing (MQTT, InfluxDB) Aug 11, 2023
@Slider0007 Slider0007 changed the title Refactor result post-processing and related result publishing (MQTT, InfluxDB) Refactor result post-processing and publishing (MQTT, InfluxDB) Aug 11, 2023
@Slider0007 Slider0007 changed the title Refactor result post-processing and publishing (MQTT, InfluxDB) Refactor result post-processing and publishing (REST, MQTT, InfluxDB) Aug 11, 2023
@Slider0007 Slider0007 merged commit d07b86f into develop Aug 13, 2023
@Slider0007 Slider0007 deleted the prevalue branch August 20, 2023 11:57
@Slider0007 Slider0007 changed the title Refactor result post-processing and publishing (REST, MQTT, InfluxDB) feat!: Rework result post-processing and publishing (REST, MQTT, InfluxDB) Sep 7, 2023
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.

1 participant