Hey I want to send some values from wheather app to mqtt broker. How to create the topic and how to send ?
Thank you
Is this openHAB related?
You don’t create topics. When you publish a message to a topic, if it doesn’t exist it will be created.
To send a message, it depends. If you are using the OH MQTT binding and a Generic MQTT Thing you configure a Channel with a commandTopic and anything you send to an Item linked to that Channel will be published to that topic.
Alternatively you can use the publishMQTT()
Thing action from a rule.
Thank you. Is it correct that when I link an item to the channel of the mqtt think the values are not published when changing ? What to do ? Defining a rule ?
You have to use the sendCommand method to actually send a command or value to the linked addon.
If you get the value from another openHAB addon, use profile="system:follow"
at the link to mqtt. This profile will issue a sendCommand to this specific Channel for each update from another linked channel or the item itself.
If you want to use a rule, simply use myItem.sendCommand(value)
instead of myItem.postUpdate(value)
Thank you very much. The problem is solved !
BLEIBEN SIE GESUND Klaus-Dieter Brinkmann
Isn’t that supposed to be profile=system:follow
now?
Yes, typo… Thanks for the hint
However, the format is dependent of the way to configure… there is no code view for profile (yet), but I’m used to define such things via .items
files.
EDIT: My bad… yes, missing system:
…
So profile="system:follow"
is valid
is profile="follow"
now no longer valid?
According to docs it’s system:follow
Yes, but a simple “follow” would also work. Core will prepend the “system:” in front of it for you. But I guess it does issue kind of a warning in the log about it.
Then maybe it’s worth to clarify in documentation, that, if no section is applied, openHAB will assume system:
?