Any value other than the above types will be interpreted as static text, in which case this text is used as the message content.
So just put the JSON after the last “:” where you would normally put default or reference to a transformation. You will probably have to escape the : and " using \.
The thing I’ll never understand is why spend time trying to figure out stuff on a deprecated binding when you could use that time figuring out the new version which you will have to move to at some point anyway? It uses more of your time in the long run. And since you can run both bindings at the same time you don’t even have to migrate everything all at once.
i am also using this old action according the number
why ? invest time on deprecated binding? because i don’t understand what changes should be done on a thing so simple like a mqtt message. it worked. on the long term, it means to update the mqtt channels of existing items to the new binding.
will publish the JSON (the stuff after the ON) on an ON command. You may need to escape the curly brackets too.
Be careful with terminology. There is an MQTT Embedded Broker (you should not use) and the MQTT Binding.
See the bottom of the MQTT v2 Binding’s documentation for examples for how to call the publsihMQTT Action. You don’t have to install the Action separately like you did with MQTT v1.
In the MQTT v2 binding, there is a field for switch type Channels that let’s you define a custom value to be published for ON and OFF commands. You would put your JSON string there.
which might also be a good option which might work in other circumstances, not your specific one here though.
Except it doesn’t work or, in this case, you didn’t understand what changes should be done on the old binding to achieve what you want to do. So you could:
spend the time figuring out how to make it work on the old binding, which is time that will be wasted in the long run because it’s throw away once you move to the new binding
spend the time figuring out how to make it work on the new binding, which may take a bit more time up front but the skills and knowledge you gain isn’t throw away; you will be able to apply that when you decide to move your other Items to the new binding.
2 always seems like a better choice. Spend some time now to save wasted effort and save time later. But that’s just me.
There should be enough information here to get it working with either binding. If not, come back and I’ll answer what I can.
Not only correct, but please keep your Mosquitto broker.
Absolutely. That’s what most of us do.
Yes but if you use a 1.x format, it will only use the 1.x binding. If you use the 2.5 format it will use the 2.5 binding. You cannot use the 1.x format with the 2.5 binding.
Thanks a lot for your guidance and your clarification. You opened my horizons
Yes but if you use a 1.x format, it will only use the 1.x binding. If you use the 2.5 format it will use the 2.5 binding. You cannot use the 1.x format with the 2.5 binding.
`
And since you can run both bindings at the same time you don’t even have to migrate everything all at once.
to be clear, i can install both but only one format will be active at the time.
it’s not possible to have for example my irobot items 1.x and my tuya items in 2.5.
it means that all the items should be in format 1.x or in format 2.5. so, maybe i miss the point but yes i need to migrate/standardize all at once
Moreover, i have installed mqtt 2.5 even after the openhab restart the mqtt broker thing is not active
2020-01-10 12:11:30.513 [vent.ChannelTriggeredEvent] - logreader:reader:openhablog:newErrorEvent triggered 2020-01-10 12:11:26.500 [ERROR] [st.core.internal.thing.ThingResource] - Exception during HTTP PUT request for update config at 'things/mqtt:broker:83940817/config'
2020-01-10 12:11:30.517 [vent.ItemStateChangedEvent] - openhablogreaderLastError changed from 2020-01-10 03:47:15.942 [ERROR] [org.quartz.core.ErrorLogger ] - Job (DEFAULT.Timer 9 2020-01-10T03:47:15.839+02:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | { to 2020-01-10 12:11:26.500 [ERROR] [st.core.internal.thing.ThingResource] - Exception during HTTP PUT request for update config at 'things/mqtt:broker:83940817/config'
2020-01-10 12:12:13.053 [hingStatusInfoChangedEvent] - 'mqtt:broker:83940817' changed from UNINITIALIZED to REMOVING
2020-01-10 12:12:46.768 [vent.ItemStateChangedEvent] - lastseen_Gil changed from 2020-01-10T12:11:26.011+0200 to 2020-01-10T12:12:46.733+0200
==> /var/log/openhab2/openhab.log <==
2020-01-10 12:13:09.032 [WARN ] [ore.thing.internal.ThingRegistryImpl] - Cannot create thing. No binding found that supports creating a thing of type 'mqtt:broker'.
No. If you have an Item with { mqtt=">[blah blah blah]" } that Item will use the 1.x binding. If you have an Item with { channel="mqtt:blah:blah:blah" } that Item will use the 2.x binding. You cannot use the first configuration with the 2.x binding.
This is totally possible.
Double check that your 2.5 binding is still installed.
i have uninstalled the mqtt 2.5 binding and try to reinstall it
2020-01-12 00:43:48.099 [ERROR] [org.openhab.binding.mqtt ] - bundle org.openhab.binding.mqtt:2.5.0 (359)[org.openhab.binding.mqtt.internal.MqttBrokerHandlerFactory(401)] : Error during instantiation of the implementation object
java.lang.NoClassDefFoundError: org/openhab/binding/mqtt/MqttBindingConstants
at org.openhab.binding.mqtt.internal.MqttBrokerHandlerFactory.<clinit>(MqttBrokerHandlerFactory.java:52) ~[?:?]
Caused by: java.lang.ClassNotFoundException: org.openhab.binding.mqtt.MqttBindingConstants cannot be found by org.openhab.binding.mqtt_2.5.0
i have kept the existing items with the 1.x format
i have added some new items in the 2.5 format to support my tuya items like explained below
till now, all my conf folder is stored in git .
All my things, items, rules are only defined in files.
so, till now in case of the new installation i had just to download the last openhabian version and a pull from git.
why? because it seems to be the most simple approach and with all the git advantages.
on the second side, i have to admit that it was really simple with the paper ui to define the mqtt things.
Just add /var/lib/openhab2/jsondb to your git. There is more in there you might want to add too in order to have"everything" in git. The stuff in etc and config in particular but some bindings have their own stuff in there own folder too. Just don’t include cache and tmp.