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

[mqtt.homeassistant] Fix MQTT Vacuum serialization names #11550

Merged
merged 1 commit into from
Nov 10, 2021

Conversation

t2000
Copy link
Contributor

@t2000 t2000 commented Nov 9, 2021

While integrating the review comments, I did not remember that some
variable names are written as they are because they result from some
deserialization.

This small PR fixes this.

Signed-off-by: Stefan Triller [email protected]

protected @Nullable String sendCommandTopic; // for custom_command
// variable names are with "_" by intention to avoid code cluttering with serialization annotations
protected @Nullable String command_topic;
protected String state_topic = "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use the @SerializedName("state_topic") annotation to point the parser to the right name. Then, you can stick to the code guidelines with the variable names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you see my comment? :)

// variable names are with "_" by intention to avoid code cluttering with serialization annotations

IMHO adding one annotation per variable is just spamming the code and makes it unreadable. If there would only be one or two such variables I would agree with you, but since there are more I would prefer to leave it like that.

Let me know what I should do, i.e. merge it or comment so I add some spam to the code... :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also call it future proofing instead of spam.
It is not uncommon that the default (de)serialization strategies change over time. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine. I have changed the MR to use annotations, please have a look again. Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for changing it! The code might look less "spammy" if the DTO classes were in separate files. But that's a matter of personal taste.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, that was just copy&paste from other integrated homeassistant mqtt devices, hence all in one class+package ;)

While integrating the review comments, I did not remember that some
variable names are written as they are because they result from some
deserialization.

This small PR fixes this.

Signed-off-by: Stefan Triller <[email protected]>
@fwolter fwolter merged commit 062f454 into openhab:main Nov 10, 2021
@t2000 t2000 deleted the fixMqttVacuum branch November 10, 2021 16:20
jpg0 pushed a commit to jpg0/openhab-addons that referenced this pull request Nov 10, 2021
While integrating the review comments, I did not remember that some
variable names are written as they are because they result from some
deserialization.

This small PR fixes this.

Signed-off-by: Stefan Triller <[email protected]>
@wborn wborn added this to the 3.2 milestone Nov 10, 2021
NickWaterton pushed a commit to NickWaterton/openhab-addons that referenced this pull request Dec 30, 2021
While integrating the review comments, I did not remember that some
variable names are written as they are because they result from some
deserialization.

This small PR fixes this.

Signed-off-by: Stefan Triller <[email protected]>
Signed-off-by: Nick Waterton <[email protected]>
mischmidt83 pushed a commit to mischmidt83/openhab-addons that referenced this pull request Jan 9, 2022
While integrating the review comments, I did not remember that some
variable names are written as they are because they result from some
deserialization.

This small PR fixes this.

Signed-off-by: Stefan Triller <[email protected]>
Signed-off-by: Michael Schmidt <[email protected]>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this pull request Jan 28, 2022
While integrating the review comments, I did not remember that some
variable names are written as they are because they result from some
deserialization.

This small PR fixes this.

Signed-off-by: Stefan Triller <[email protected]>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
While integrating the review comments, I did not remember that some
variable names are written as they are because they result from some
deserialization.

This small PR fixes this.

Signed-off-by: Stefan Triller <[email protected]>
andan67 pushed a commit to andan67/openhab-addons that referenced this pull request Nov 6, 2022
While integrating the review comments, I did not remember that some
variable names are written as they are because they result from some
deserialization.

This small PR fixes this.

Signed-off-by: Stefan Triller <[email protected]>
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.

3 participants