Binding-mqtt - 2.5.0.SNAPSHOT; rollershutter command is sent wrong

mqtt
rollershutter
Tags: #<Tag:0x00007f1e5bca9560> #<Tag:0x00007f1e5bca93a8>
(David Graeff) #21

This should work. The mentioned PR is already merged since a while. You need 2.5M1 at least. If it still not work you need to issue another bug report stating your configuration etc.

But just FYI: MQTT development is on hold at the moment until the ESH reintegration has been completed.

0 Likes

(Jan Tiri) #22

I’m migrating an OH2.0 to OH2.5M1 as a docker container but run into the same issue.


old default.items:
Rollershutter r12 (gRoll_boven_all) { mqtt=">[xxx:/rolluik/r/12/u:command:UP:30],>[primus:/rolluik/r/12/d:command:DOWN:30],>[xxx:/rolluik/r/12/s:command:STOP:0],<[xxx:/rolluik/h/12:state:default]", autoupdate=“false” } /* gang */

I wrote my own rollershutter interface with arduino & pubsubclient (16 devices). As you can see, it expects /rolluik/r/12/u, d or s and the amount of seconds. The arduino publishes the state in percent on /rolluik/h/12 on a regular interval.


new default.things:
Bridge mqtt:broker:mosquitto “bridge: mosquitto” [ host=“xxx”, secure=false ]
{
Thing topic rollershutters “thing: rolluiken” {
Channels:
Type rollershutter : r12 “Rolluik gang” [ stateTopic="/rolluik/h/12", commandTopic="/rolluik/r/12/u" ]
}
}

new default.items:
Rollershutter r12 { channel=“mqtt:topic:mosquitto:rollershutters:r12” }

events.log when clicking each button:
[ome.event.ItemCommandEvent] - Item ‘r12’ received command DOWN
[nt.ItemStatePredictedEvent] - r12 predicted to become DOWN
[vent.ItemStateChangedEvent] - r12 changed from 0 to 100
[ome.event.ItemCommandEvent] - Item ‘r12’ received command STOP
[ome.event.ItemCommandEvent] - Item ‘r12’ received command UP
[nt.ItemStatePredictedEvent] - r12 predicted to become UP
[vent.ItemStateChangedEvent] - r12 changed from 100 to 0

I only see the values change in the Paper UI (d: 100, s: no change, u: 0) there is nothing published on mqtt itself. This is probably related to the error below, I might need to change my code above

openhab.log when clicking a button:
[ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.handleCommand()’ on ‘org.eclipse.smarthome.binding.mqtt.generic.internal.handler.GenericThingHandler@2168d4’: Cannot call update() with custom stop/move/up/down
java.lang.IllegalStateException: Cannot call update() with custom stop/move/up/down

What do I have to change in my new code to at least already publish something in mqtt? Can I get some example code? If the above should work, I can create a PR.

And what’s the best next step here?

  • wait for transformations to work on outgoing messages?
  • try to make it work via buttons and rules? like:
val mqttActions = getActions("mqtt", "mqtt:broker:mosquitto")
mqttActions.publishMQTT("topic", "payload") 
  • rewrite my rollershutter arduino code? (really? nah. Perhaps in the future to comply to homie v3)
  • stick with the mqtt 1 binding for the rollershutters for now?
0 Likes

(furax54) #23

I’m using 2.5M1 but same error :

14:49:49.074 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()'
on'org.eclipse.smarthome.binding.mqtt.generic.internal.handler.GenericThingHandler@7fa565a7': Cannot call update() with custom stop/move/up/down

@David_Graeff, can you confirm it works with 2.5M1 ?

0 Likes

(David Graeff) #24

I haven’t tried it myself, I have only added a test case that tested for the STOP command and if a percentage value is accepted. I will start MQTT development end of the week again and fix all the accumulated problems.

Just make sure to open an Issue on Github, describing exactly which commands work and which don’t.

Cheers, David

0 Likes

(furax54) #25

For github issue, on which repo ? Smarthome ? openhab-addons ? openhab-core ? Thank you

0 Likes

(David Graeff) #26

Good question, thanks for asking. Eclipse Smarthome is not longer part of this project. The mqtt bindings are in the openhab-addons repository now.

Cheers

0 Likes

(kamil) #27

Is there any update on this topic?

Thanks.

0 Likes

(Niklas) #28

Hey! I Have the same problem.
Is there still any solution?
I migrated OH to 2.5M1 to try if there is a new “stop”-state for the rollershutter-item. But it seams like it is not working basically.

By the way, great job, David. Thank you.

0 Likes

(David Graeff) #29

Fixed in master

0 Likes

(Niklas) #30

Thanks a lot. So I am a little bit confused now. What do I have to do to get it working with your changes?
I downloaded this file and put it into the openhab2-addons directory.

https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.mqtt/2.5.0-SNAPSHOT/org.openhab.binding.mqtt-2.5.0-SNAPSHOT.jar

It seem to install the MQTT binding from this location, but the embedded broker did not work. In my Generic MQTT Thing I am not able to select any broker.
I also tried the latest build of OH, but it has to many bugs right now for daily use.

0 Likes

(David Graeff) #31

Exactly.

The tl;dr: The issue is fixed but cannot be used at the moment, until the buildsystem migration has finished, openhab-core is repaired and the remaining buildsystem related problems with the mqtt binding are resolved.

0 Likes

(Niklas) #32

Thank you David. Okay, I will wait until the migration has finished. I adapted my scripts, so the roller shutter switches will basically work for now.

0 Likes