Hello Guys…
I’m starting to use MQTT, but would like an advice how to get on with it…
Is it correct that the REGEX should be used to filter the MQTT command to something like “ON” or “OFF”…
I’m a bit confused how to update the item from the mqtt? Do i need a rule or can it be done directly? I mean i receive a long string when something is published - but how do i check that i only update this one item and only when a specific mqtt item is posted?
Yes you will need a regex for this or if the string is JSON format then you can use the jsonpath transform
What do you mean?
What string do you receive?
Which bit of the “long” string are you interested in?
On what topic?
What item are you using?
Which bit of the “long” string are you interested in?
rule "Zone Switch"
when
item myString changed
then
if (myString.state == "open") mySwitch.postUpdate(ON)
else if (myString == "closed") mySwitch.postUpdate(OFF)
end