Repository navigation
fix(features): event payload checks for key values, characteristics and value states - #266
Open
nils-prommersberger wants to merge 1 commit into
Open
nils-prommersberger wants to merge 1 commit into
nils-prommersberger wants to merge 1 commit into
Conversation
…nd value states - DeviceConfiguration: the payload check matched every key value that carried a value, because `||` was used instead of `&&`, so events were triggered for unrelated keys - ElectricalConnection: the characteristic payload check only compared the parameter id, characteristics sharing a parameter id (e.g. all characteristics of an entity) triggered events for each other, now the characteristic id is compared as well if set - Measurement: a notify that only carries a value state (e.g. "error" without a value) marks the value as invalid and is now reported as a data change, too These change the events of existing use cases: cem/vapd (DeviceConfiguration), eg/lpc and eg/lpp (ElectricalConnection characteristics) and ma/mpc, ma/mgcp, ma/mdt, cem/vabd and cem/vapd (Measurement). Co-authored-by: Robin Bendel <robin.bendel@enqs.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three small fixes in the
CheckEventPayloadData…helpers infeatures/internal. Thesehelpers decide whether an incoming notify concerns a given data point and therefore
whether a use case raises an event. The getters were not affected; only the events were
wrong.
DeviceConfigurationCommon.CheckEventPayloadDataForFilter(deviceconfiguration.go:54)KeyId == desc.KeyId || Value != nil: every key value carrying a value matched, so an update of any key raised the events of all keys||→&&ElectricalConnectionCommon.CheckEventPayloadDataForFilterDescriptionList(electricalconnection.go:85–89)parameterIdwas compared, so characteristics sharing a parameter id raised events for each other. Use case specs require this sharing, e.g. MOI uses the MPC parameter id for several entity characteristicscharacteristicIdif set on both sidesMeasurementCommon.CheckEventPayloadDataForFilter(measurement.go:56)valuewere ignored. A notify that only setsvalueStatetoerrorraised no event, so the application kept showing a value it has to ignorevalueorvalueStatecount as a changeImpact on existing use cases
These are intentional behaviour changes in events (fewer wrong events or an additional
correct event). No API changes.
cem/evcc,cem/vapd,cs/lpc,cs/lpp,eg/lpc,eg/lpp,ma/mgcpeg/lpc,eg/lppcem/evcem,cem/evsoc,cem/vabd,cem/vapd,ma/mdt,ma/mgcp,ma/mpcAll existing tests pass unchanged.
Relation to MA-MOI / MA-MOB / MA-MPS
The new use cases are based on this commit. Without it their event tests fail:
If this PR is merged first, the commit drops out of the use case PRs on rebase.
Tests
Test_CheckEventPayloadDataForFilter(DeviceConfiguration): a key value with a different key id no longer matchesTest_CheckEventPayloadDataForFilterDescriptionList(ElectricalConnection): same parameter id with a different characteristic id no longer matchesTest_CheckEventPayloadDataForFilter_ValueStateWithoutValue(Measurement): an entry with onlyvalueStatematches, an entry with neither value nor value state does not