rlkoshak
(Rich Koshak)
August 14, 2023, 7:32pm
2
s.laudel:
My expectation was, that if the item value is changing (as the temperature reading changes) a mqtt message should be published. But surprisingly nothing happened. No message was published.
Maybe this is, because the item is only “updated” without a command?
Correct.
Two ways:
Configure the Follow Profile on the link. Updates from the Channel get forwarded as commands to the second Channel Configure the MQTT Channel as the second.
MQTT Event Bus [4.0.0.0;4.9.9.9]
s.laudel:
But how could I easily achieve what I want to do without a lot of work? Of course I could create a second item, which is linked to the mqtt thing/channel and send changes as commands via rules, but this would tripple the work as I would have to maintain additional items and rules.
This approach will be a lot less work than you think though.
First of all, you wouldn’t necessarily need extra Items and it would just be one rule.
Add all the Items you care about to a Group
Create a rule triggered by changes to the Group
Use the MQTT binding publishMQTT
Action to publish the state to a topic generated based on the name of the triggering Item.
It’d be like four lines of code. But 1 or 2 above would be even less work.