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

I was able to successfully integrate the MQTT binding with the new version 2.5.0 into my system with RbP3.
The Sonoff switches work, now I still have RGB LED bands and IR transmitters on Sonoff.
Has anyone done that on the new MQTT?
I would be grateful for any tips! :slight_smile:

In Mysensors bindings, you cans send UP/DOW/STOP and percentage direct to the bindings (and the mysensors firmware have to handle message correctly). https://github.com/tobof/openhab2-addons/tree/MySensors_Binding/addons/binding/org.openhab.binding.mysensors

Thanks, i check this now

Is there any update on this? I updated to the 2.5.0 snapshot version of OH because I had both MQTT1 and MQTT2 bindings running to allow me to use my MQTT rollershutter (a Shelly2) with openHAB 2.4.0. After a reboot a few days ago somehow the old binding wouldn’t really work anymore, so the device (and others which I haven’t converted to MQTT2 yet) stopped working…

I have now created an MQTT thing:

    Thing mqtt:topic:shelly1_rollladen_kuechentuer_topics "Shelly 1 Rollladen Küchentür" {
        Channels:
            Type rollershutter : rollershutter [ stateTopic="shellies/shellyswitch-135267/roller/0/pos", commandTopic="shellies/shellyswitch-135267/roller/0/command", transformationPattern="MAP:shellies.map" ] //on="up", off="down",stop="stop", 
    }

and I am not sure what to do about the problem that only 0 and 100 are published to the command topic. The Shelly2 needs “open” (100) and “close”. I do have those mappings in the shellies.map file, but it looks like that isn’t used.

You need an outgoing transformation, not a receive transformation.

And no, there is no progress. I will not do any MQTT stuff this month and do care about all the MQTT issues (about 12 on github) next month.

Ok, thanks.

So I cannot use the binding for the rollershutters yet? You said in another post:

If I understand correctly, that hasn’t been integrated yet? I guess I will have to find out why the MQTT1 does not work anymore until you get to implementing the outgoing transformation?

That should work already. The other PR is still on hold unfortunately.

How do I use an outgoing transformation? “transformationPattern” is for incoming transformation, if I understood correctly.

Ah my mistake, outgoing transformation was not separated but is part of that bigger PR.

Hi,

any update on this topic?
When will it be able to use mqtt with UP/DOWN/STOP command/state?
Hopefully soon.

Cheers,
kamil

You could provide your coding skills and submit a PR. :sleeping:

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.

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?

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 ?

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

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

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

Is there any update on this topic?

Thanks.

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.

Fixed in master