Hi,
I want to prepare mqttwarn and openhab to send some basic information. I’m using facebook for communication.
Mqttwarn iitself is configured properly - I’m able to send message with command:
mosquitto_pub -t “test” -m “test”
I’ve installed binding and added broker from UI:
Item:
String test_message { mqtt=“>[mqtt:broker:domek:test/info:state:*:default]” }
rule “Test message”
when
Time cron “0 0/1 * * * ?”
then
test_message.postUpdate(“test”)
logInfo(“MESSAGE”,“Message sent”)
end
Where I’ve made a mistake? I still can’t push a message.
This is configuration for the old v1 MQTT binding. What version of the binding do you actually have installed?
I’m sure your logs will be telling you what the issues are - what do the event
and openhab
logs say?
Here’s a page in configuring the current V2 binding MQTT stuff:
# Xtend Examples
## Examples
Have a look at the following textual examples.
### A broker Thing with a Generic MQTT Thing and a few channels
demo1.things:
```java
Bridge mqtt:broker:myUnsecureBroker [ host="192.168.0.42", secure=false ]
{
Thing topic mything {
Channels:
Type switch : lamp "Kitchen Lamp" [ stateTopic="lamp/enabled", commandTopic="lamp/enabled/set" ]
Type switch : fancylamp "Fancy Lamp" [ stateTopic="fancy/lamp/state", commandTopic="fancy/lamp/command", on="i-am-on", off="i-am-off" ]
Type string : alarmpanel "Alarm system" [ stateTopic="alarm/panel/state", commandTopic="alarm/panel/set", allowedStates="ARMED_HOME,ARMED_AWAY,UNARMED" ]
Type color : lampcolor "Kitchen Lamp color" [ stateTopic="lamp/color", commandTopic="lamp/color/set", rgb=true ]
Type dimmer : blind "Blind" [ stateTopic="blind/state", commandTopic="blind/set", min=0, max=5, step=1 ]
This file has been truncated. show original
Thanks, you were right - old approach. Change in rule helped:
val actions = getActions(“mqtt”,“mqtt:broker:domek”)
actions.publishMQTT(“test”,“test message”)