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] HA: add transformation to incoming topics, where needed #4990

Merged
merged 4 commits into from
Mar 19, 2019

Conversation

jochen314
Copy link
Contributor

This change adds a transformation from a value_template to an incoming message, where needed.

As I do not have a working PaperUI right now, I could not fully test this step including the front-end...

channels.put(sensorChannelID,
new CChannel(this, sensorChannelID, new OnOffValue(config.payload_on, config.payload_off),
config.state_topic, null, config.name, config.unit_of_measurement, channelStateUpdateListener));
CChannel sensorChannel = new CChannel(this, sensorChannelID,
Copy link
Member

Choose a reason for hiding this comment

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

Note to myself: Use a channel builder pattern

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 thought about this also.
One of my next request would add specialiezed constructors for read only/write only channels.
But I will thing this through again.

Copy link
Member

@davidgraeff davidgraeff left a comment

Choose a reason for hiding this comment

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

LGTM

@davidgraeff
Copy link
Member

If you are ready, can you remove the [WIP] for others to perform a review? Oh, and Travis fails atm

@jochen314
Copy link
Contributor Author

I have not actually run the code in openhab and test it in the gui. That is why I put the wip there in the first place.
It seems, that the ui migration is not finished yet, right?
Is it ok to remove WIP without the testings?

@wborn wborn added the mqtt label Feb 24, 2019
@davidgraeff
Copy link
Member

Could you, if possible, not force push, please. As a reviewer you never know what has changed from the last review otherwise. We can at the end merge join all commits.

A UI test can be fully replaced by an equivalent integration test. I do even prefer that.

@wborn had success building the recent state, including UIs, if I've read him correctly in the forum

@wborn
Copy link
Member

wborn commented Feb 24, 2019

In the latest snapshots builds (1534,1535) the UIs are working again.

They also worked while launching the runtime in my Eclipse today. You might need to build/import the openhab-webui projects for that locally.

@davidgraeff davidgraeff added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Mar 10, 2019
@davidgraeff
Copy link
Member

@jochen314 Can you notify me when we start to tackle this pr? Thanks.

Signed-off-by: Jochen Klein <git@jochen.susca.de>
@jochen314 jochen314 changed the title [mqtt][WIP] HA: add transformation to incoming topics, where needed [mqtt] HA: add transformation to incoming topics, where needed Mar 16, 2019
@jochen314
Copy link
Contributor Author

I think, this is ready now.

* "{name:'Name',state_topic:'homeassistant/switch/0/object/state',command_topic:'homeassistant/switch/0/object/set'".
* @param thingUID The Thing UID that this component will belong to.
* @param haID The location of this component. The HomeAssistant ID contains the object-id, node-id and
* component-id.
Copy link
Member

Choose a reason for hiding this comment

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

Not a problem for me, but for others probably. Go to eclipse window->preferences->Java->code style->formatter and make sure that "ESH" is the active profile. Click apply, even if it is. Then go back to this file and let it be reformatted again.

@davidgraeff
Copy link
Member

davidgraeff commented Mar 16, 2019

Some unrelated problems in travis:

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: org.openhab.binding.plclogo 2.5.0.qualifier
[ERROR]   Missing requirement: org.eclipse.xtext.util 2.17.0.v20190304-0545 requires 'osgi.bundle; com.google.guava [21.0.0,22.0.0)' but it could not be found
[ERROR]   Cannot satisfy dependency: org.eclipse.xtext 2.17.0.v20190304-0545 depends on: osgi.bundle; org.eclipse.xtext.util 0.0.0
[ERROR]   Cannot satisfy dependency: org.openhab.binding.plclogo 2.5.0.qualifier depends on: java.package; org.eclipse.smarthome.model.script.actions 0.0.0
[ERROR]   Cannot satisfy dependency: org.openhab.core.model.item 2.5.0.201903150831 depends on: osgi.bundle; org.eclipse.xtext 0.0.0
[ERROR]   Cannot satisfy dependency: org.openhab.core.model.script 2.5.0.201903150823 depends on: osgi.bundle; org.openhab.core.model.item 0.0.0
[ERROR] 

There was a xtext update in openhab-distro afaik, not sure. I'll retrigger in a day.

Signed-off-by: Jochen Klein <git@jochen.susca.de>
Signed-off-by: Jochen Klein <git@jochen.susca.de>
Copy link
Member

@davidgraeff davidgraeff left a comment

Choose a reason for hiding this comment

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

@openhab/2-x-add-ons-maintainers Can someone have a second look? Before migrating mqtt, all PRs need to be in. Thanks.

@cweitkamp cweitkamp removed the work in progress A PR that is not yet ready to be merged label Mar 18, 2019
Copy link
Member

@martinvw martinvw left a comment

Choose a reason for hiding this comment

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

One minor comment, thanks!

@@ -41,6 +42,7 @@
@NonNullByDefault
public abstract class AbstractComponent<C extends BaseChannelConfiguration> {
// Component location fields
private ComponentConfiguration componentConfiguration;
Copy link
Member

Choose a reason for hiding this comment

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

Any reason why its not final?

Copy link
Member

Choose a reason for hiding this comment

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

Dis you also see this one?

Copy link
Member

@davidgraeff davidgraeff Mar 19, 2019

Choose a reason for hiding this comment

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

Can you merge this PR nevertheless please? There are 1-5 more PRs to come and this code will be touched again anyhow.

The initial 3000 LOC PR was presented a month ago now and allows us to be almost 100% MQTT HA compliant and I asked Jochen to split it up into smaller pieces, easier to review for me.
And he did and his PRs are of really good quality.

There will always be the one small imperfection somewhere, but I will make sure that it is always functional correct and resource efficient.

Please let me do my job as mqtt maintainer and decide when to merge a PR, as I know the greater plan for this module. (It's not actually a critic towards you Martin, but the general process that I observe here, where contributors loose interest, because the patch flow is slowed down for nitpick reasons)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@martinvw Yes, I saw it, but I could not fix it while at work.
Not special reason, just a late addition and I forgot to make it final.
I have no problem to change it ;-)

Copy link
Member

Choose a reason for hiding this comment

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

Given you responded on the other one I just wanted to make sure that we could wrap up quick I did not realize more would be commng soon

Signed-off-by: Jochen Klein <git@jochen.susca.de>
@martinvw martinvw merged commit 0ea0bd1 into openhab:master Mar 19, 2019
@wborn wborn added this to the 2.5 milestone Apr 14, 2019
Pshatsillo pushed a commit to Pshatsillo/openhab-addons that referenced this pull request Jun 19, 2019
…ab#4990)

Signed-off-by: Jochen Klein <git@jochen.susca.de>
Signed-off-by: Pshatsillo <pshatsillo@gmail.com>
@jochen314 jochen314 deleted the addValueTransformation branch August 22, 2019 14:44
ne0h pushed a commit to ne0h/openhab-addons that referenced this pull request Sep 15, 2019
…ab#4990)

Signed-off-by: Jochen Klein <git@jochen.susca.de>
Signed-off-by: Maximilian Hess <mail@ne0h.de>
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.

None yet

5 participants