Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

[mqtt] Rollershutter STOP command, outgoing transform, chained incoming transformations #6695

Merged
merged 3 commits into from
Jan 18, 2019

Conversation

davidgraeff
Copy link
Contributor

@davidgraeff davidgraeff commented Dec 18, 2018

The Rollershutter channel stores its value as percentage.
UP/DOWN/STOP commands received via MQTT do not change that state.

Instead of trying to handle those commands, they are now
posted to the framework.

  • Allow outgoing transformations.
  • Allow chained incoming transformations.
  • Add more examples to the readme.
  • Homie: Remove $stats handling
  • Percentage channel: Return value between min/max instead of 0..100.

Signed-off-by: David Gräff david.graeff@web.de

return;
}
state = newState;
throw new IllegalStateException("Cannot call update() with UpDownType");
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? UpDownType implements State, so updates are valid (and correspond to 0 and 100).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So they are not meant to be move commands like "move up", "move down" but more like states meaning "completely up" and "completely down"?
A user wrote me a pm saying that stop doesn't work for him (which is absolutely correct) and that up/down sends his rollershutters up/down (which is correct so far) but also updates the state to 0% and 100% which he was not expecting.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the commands UP/DOWN mean that it should move to UP (=0) or DOWN (=100) position.

also updates the state to 0% and 100%

The binding itself should indeed not update the state, but by default the "autoupdate" feature of the framework does it - if it sees an UP event, it will do a state auto-update to 0%.

Note that since #5011, the binding can define an auto-update policy, so you can actually configure channels in a way that the framework suppresses the auto-update behavior. This is probably what should usually be done for rollershutters as the state is reached much later than the command has been received, so the state update should better come from the physical device.

Copy link
Contributor

Choose a reason for hiding this comment

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

@davidgraeff What's the status here now? Are you waiting for anything from my side?

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 have changed the code already and was waiting for another review. Have no time for the rebase right now though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I cannot see any code change, this is why I was asking. The line that I commented still throws an IllegalStateException...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah ok, must have overlooked that line. When I do the rebase, I'll look into it again :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Any news here?

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 have added some changes

@davidgraeff davidgraeff force-pushed the mqttrollershutter branch 2 times, most recently from 96de2c6 to ea345ef Compare December 19, 2018 18:28
@davidgraeff davidgraeff changed the title MQTT: Rollershutter channel. Proper STOP command support. MQTT: Rollershutter STOP command, outgoing transform, chained incoming transformations. Dec 19, 2018
@openhab-bot
Copy link
Contributor

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/mqtt-2-5/60365/1

@openhab-bot
Copy link
Contributor

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/binding-mqtt-2-5-0-snapshot-rollershutter-command-is-sent-wrong/61091/5

@openhab-bot
Copy link
Contributor

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/mqtt2-in-openhab-2-4-rollershutter-map/61311/5

1 similar comment
@openhab-bot
Copy link
Contributor

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/mqtt2-in-openhab-2-4-rollershutter-map/61311/5

@kaikreuzer kaikreuzer changed the title MQTT: Rollershutter STOP command, outgoing transform, chained incoming transformations. [mqtt] Rollershutter STOP command, outgoing transform, chained incoming transformations Jan 11, 2019
@kaikreuzer
Copy link
Contributor

@davidgraeff Could you please check the compilation failures on Travis?

@davidgraeff
Copy link
Contributor Author

Yes of course.

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.2.0:compile (default-compile) on project org.eclipse.smarthome.binding.mqtt.generic.test: Compilation failure: Compilation failure: 
[ERROR] /home/travis/build/eclipse/smarthome/extensions/binding/org.eclipse.smarthome.binding.mqtt.generic.test/src/test/java/org/eclipse/smarthome/binding/mqtt/generic/internal/values/ValueTests.java:[86] 
[ERROR] 	PercentageValue v = new PercentageValue(null, null, null);
[ERROR] 	                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The constructor PercentageValue(null, null, null) is undefined
[ERROR] /home/travis/build/eclipse/smarthome/extensions/binding/org.eclipse.smarthome.binding.mqtt.generic.test/src/test/java/org/eclipse/smarthome/binding/mqtt/generic/internal/values/ValueTests.java:[98] 
[ERROR] 	PercentageValue v = new PercentageValue(null, null, null);
[ERROR] 	                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The constructor PercentageValue(null, null, null) is undefined
[ERROR] /home/travis/build/eclipse/smarthome/extensions/binding/org.eclipse.smarthome.binding.mqtt.generic.test/src/test/java/org/eclipse/smarthome/binding/mqtt/generic/internal/values/ValueTests.java:[183] 
[ERROR] 	PercentageValue v = new PercentageValue(new BigDecimal(10.0), new BigDecimal(110.0), new BigDecimal(1.0));
[ERROR] 	                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The constructor PercentageValue(BigDecimal, BigDecimal, BigDecimal) is undefined
[ERROR] /home/travis/build/eclipse/smarthome/extensions/binding/org.eclipse.smarthome.binding.mqtt.generic.test/src/test/java/org/eclipse/smarthome/binding/mqtt/generic/internal/values/ValueTests.java:[192] 
[ERROR] 	PercentageValue v = new PercentageValue(new BigDecimal(0.1), new BigDecimal(1.0), new BigDecimal(0.1));
[ERROR] 	                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The constructor PercentageValue(BigDecimal, BigDecimal, BigDecimal) is undefined
[ERROR] /home/travis/build/eclipse/smarthome/extensions/binding/org.eclipse.smarthome.binding.mqtt.generic.test/src/test/java/org/eclipse/smarthome/binding/mqtt/generic/internal/values/ValueTests.java:[203] 
[ERROR] 	PercentageValue v = new PercentageValue(new BigDecimal(10.0), new BigDecimal(110.0), new BigDecimal(1.0));
[ERROR] 	                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The constructor PercentageValue(BigDecimal, BigDecimal, BigDecimal) is undefined
[ERROR] /home/travis/build/eclipse/smarthome/extensions/binding/org.eclipse.smarthome.binding.mqtt.generic.test/src/test/java/org/eclipse/smarthome/binding/mqtt/generic/internal/generic/ChannelStateTests.java:[195] 
[ERROR] 	PercentageValue value = new PercentageValue(new BigDecimal(-100), new BigDecimal(100), new BigDecimal(10));
[ERROR] 	                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The constructor PercentageValue(BigDecimal, BigDecimal, BigDecimal) is undefined
[ERROR] /home/travis/build/eclipse/smarthome/extensions/binding/org.eclipse.smarthome.binding.mqtt.generic.test/src/test/java/org/eclipse/smarthome/binding/mqtt/generic/internal/generic/ChannelStateTransformationTests.java:[109] 
[ERROR] 	assertThat(channelConfig.transformations.get(0).pattern, is(jsonPathPattern));
[ERROR] 	                         ^^^^^^^^^^^^^^^
[ERROR] transformations cannot be resolved or is not a field
[ERROR] /home/travis/build/eclipse/smarthome/extensions/binding/org.eclipse.smarthome.binding.mqtt.generic.test/src/test/java/org/eclipse/smarthome/binding/mqtt/generic/internal/generic/ChannelStateTransformationTests.java:[121] 
[ERROR] 	ChannelStateTransformation transformation = channelConfig.transformations.get(0);
[ERROR] 	                                                          ^^^^^^^^^^^^^^^

@kaikreuzer
Copy link
Contributor

@davidgraeff I "saw" them myself, my request was rather to fix them...

@davidgraeff
Copy link
Contributor Author

I'm sure you saw them. That was my way of avoiding to lookup travis again for a later fix.

@openhab-bot
Copy link
Contributor

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/mqtt-2-5/60365/12

David Gräff added 3 commits January 17, 2019 14:48
The Rollershutter channel stores its value as percentage.
UP/DOWN/STOP commands received via MQTT do not change that state.

Instead of trying to handle those commands, they are now
posted to the framework.

* Allow outgoing transformations.
* Allow chained incoming transformations.
* Add more examples to the readme.

Signed-off-by: David Gräff <david.graeff@web.de>
…ndling completely. Readme: Add retain and isCommand and some more mqtt1 details. Rollershutter: Fix

Signed-off-by: David Graeff <david.graeff@web.de>
@davidgraeff
Copy link
Contributor Author

@kaikreuzer All tests fixed

Copy link
Contributor

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

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

Thanks!

@kaikreuzer kaikreuzer merged commit d739f6a into eclipse-archived:master Jan 18, 2019
@davidgraeff davidgraeff deleted the mqttrollershutter branch January 18, 2019 08:41
@openhab-bot
Copy link
Contributor

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/mqtt-2-chained-transformations/84861/4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants