Turn on AirCon through MQTT broadlink bridge

Hello,

I am trying to switch on and off my AirCon through MQTT broadling bridge.
I set the ON and OFF actions on the the bridge and its work while I press play on the bridge
But when I try to through openhab rules, it’s not working.

I am using MQTT1 and mosquitto as the broker, all run on resp3

Here is the item I defined:

Switch AirCon_ONOFF "AirCon" {mqtt=">[mosquitto:broadlink/AirCon/ON:command:ON:play-780f77180d57],>[mosquitto:broadlink/AirCon/OFF:command:OFF:play-780f77180d57]"}

And this is the rule:

rule "AirCon_ON"
when
  Item Test3 changed to 8.0
then
val topic = "broadlink/AirCon/OFF" 
publish("mosquitto", topic, "play-780f77180d57")
end

What I am doing wrong? Thanks for your advice

Yehuda.

Why create an Item only to ignore it and use the MQTT Action? You should do one or the other.

Have you installed the MQTT Action? It’s separately installed.

Is test changing to exactly 8.0, not 8 and not 8.00000001? Add logging to see if the Rule is even triggering.

Yes, MQTT Action is installed.
Yes, Test3 is changing to exactly 8.0 and it is in use and work well to trigger other actions.
here is the events log:

2019-10-09 00:23:48.103 [vent.ItemStateChangedEvent] - ZWaveNode003ZRC90SceneMaster8ButtonRemote_SceneNumber changed from 7.0 to 8.0
2019-10-09 00:23:48.113 [vent.ItemStateChangedEvent] - Test3 changed from 7.0 to 8.0

Any idea what is wrong or how to debug it?

Thanks.

I provided a first step above, add logging to verify that the Rule is running.

Delete the AirCon_ONOFF Item. If you will use the publish Action you don’t need the Item.

Ultimately I’m going to be limited in how much I can help. It’s been almost a year since I’ve moved to the 2.x binding.

I removed the item and add logging into the rule.
The rule is running every time change to 8.0 is happen but yet not action on the broadlink

rule "AirCon_ON"
when
  Item Test3 changed to 8.0
then
logInfo("AirCon_ON","Rule running")
val topic = "broadlink/AirCon/OFF" 
publish("mosquitto", topic, "play-780f77180d57")
end

Any errors in openhab.log? Use an mqtt client like mosquitto-sub or MQTT Explorer to verify whether or not the message is being published.

No error in the openhab.log.
how to verify if the message published? I am new to openhab, not sure I know what you mean by mqtt client

To be successfull with any technology integration with OH, you must have at least a basic understanding of that technology. Please go read https://www.hivemq.com/blog/mqtt-essentials-part-1-introducing-mqtt/ to get a basic understanding of how MQTT works in general. You should get the answer to your question there.

Though it’s worth noting that I mentioned two examples of MQTT clients in my previous replies.

I can understand such bridge technology but I am looking for help on openhab related issues. how to debug it through my openhab system?

Thanks for the support

You use MQTT tools to see whether or not openHAB is successfully publishing the message or not and if so, that it’s publishing to the right topic.

And if you “understand” MQTT, the term “MQTT Client” wouldn’t be unknown to you.

OK. I check the MQTT client log and nothing publish there.
While I directly trigger from the client it works and run.
SO I guess the action on the rule not reach the client, what can be the reason?

Check your mqtt.cfg file. Make sure you have both the MQTT Binding and MQTT Action installed. Put the binding in debug mode and see if there is anything interesting there.

This is pretty much the end of my ability to help with the MQTT 1.x binding. If you upgrade to the 2.x binding I can provide more help.

Thanks.
Is the MQTT2.x support broadlink? I choose 1.x just because I need to bridge with broadlink and read somewhere that 2.x not support it. I sit right?

MQTT is MQTT. It’s not specifically tied to any technology. All broadlink defines is the names of the topics and the contents of the messages which are all configuration parameters. The messages and topics you are using are perfectly supportable with the MQTT 2 binding.