[SOLVED] Broadlink Mqtt binding config

The “problem” is that the developer is using the : as a delimiter to send play:{deviceid} for the mqtt payload and this conflicts with the structure of the mqtt binding config

Try to escape the extra colon with \\ (or \):

Switch tv "turn on tv" {mqtt=">[mosquitto:broadlink/tv/peerless/turnon:command:ON:play\\:0d43b4e42518],>[mosquitto:broadlink/tv/peerless:command:OFF:play\\:0d43b4e42518]"}

If it works, notify the developer of the bridge to update the readme https://github.com/fbacker/broadlink-mqtt-bridge/issues/6

Sources: How to convert MQTT into command? & [SOLVED] Item from mqtt topic with colons and JSONPATH & How to escape colon (:) in Item REGEX transformation

1 Like

Ok I think I have miss some think But don’t know.

1: 1 I trying to test on MQTT FX.
1: 2 # (try this one 1st)
1: 2 broadlink (then try this one too)
Then subscribe
1: 3 broadlink/epson_projector/menu
1: 4 play
Then Pulblish

2: TV menu in MQTT fx don’t come up

3: Items (I have try 3 ways so far)

//Test
Switch Menu                      "Menu"                                                 {mqtt=">[brokwe:broadlink/epson_projector/menu:command:ON:play\\:0d43b4e42518],>[broker:broadlink/epson_projector/menu:command:OFF:play\\:0d43b4e42518]"}
Switch Mebu2                     "MENU 2"                                               {mqtt=">[mqtt:broadlink/epson_projector/menu:command:ON:play]"}
Switch tv                        "turn on tv"                                           {mqtt=">[mosquitto:broadlink/epson_projector/menu:command:ON:play\\:0d43b4e42518],>[mosquitto:broadlink/epson_projector/menu:command:OFF:play\\:0d43b4e42518]"}

4: Sitmap files (3 ways)

Frame label="TV"  
	   {
           Switch item=Menu label="MENU"
		   Switch item=Mebu2 label="menu2"
		   Switch item=tv label="TV"

5: Log file

2018-11-04 20:28:48.228 [ome.event.ItemCommandEvent] - Item 'tv' received command ON

2018-11-04 20:28:48.236 [vent.ItemStateChangedEvent] - tv changed from NULL to ON

2018-11-04 20:28:50.914 [vent.ItemStateChangedEvent] - CurrentDate changed from 2018-11-04T20:27:50.864+1000 to 2018-11-04T20:28:50.869+1000

2018-11-04 20:28:51.653 [ome.event.ItemCommandEvent] - Item 'tv' received command OFF

2018-11-04 20:28:51.664 [vent.ItemStateChangedEvent] - tv changed from ON to OFF

6: Also this is my default.json (what I think I don’t change or I break updates)

{
  "mqtt": {
    "host": "127.0.0.1",
    "port": 1883,
    "protocol": "mqtt",
    "subscribeBasePath": "broadlink"
  },
  "recording": {
    "timeout": {
      "ir": 30,
      "rf": 30
    },
    "path": null
  },
  "gui": {
    "port": 3000
  }
}

7: Also this is my local.json (what I add my self but dont know what I or need to change)

{
  "mqtt": {
    "host": "127.0.0.1",
    "port": 1883,
    "protocol": "mqtt",
    "subscribeBasePath": "broadlink"
  },
  "recording": {
    "timeout": {
      "ir": 30,
      "rf": 30
    },
    "path": null
  },
  "gui": {
    "port": 3000
  }
}

Thanks Guys

I just fixed it to broker still not working

I think I stuffed up. From copying the text they had spaces.

I have fixed up but they is 2 epson_projector now

It’s still not working when using it.

But MQTT FX is working and understanding the controls.

Just not working on basic UR

thanks you! i add the // and now its working, i also post message for the developer to fix this

1 Like

Must be something wrong about mine something else missing cause

As MQTT FX is working with the link.

Can you post your mqtt.cfg file to verify its setup correctly.

I i haven’t change anything in that file in a while.

#
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with an ID you choose.
#

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
broker.url=tcp://192.168.0.4:1883

# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
#<broker>.clientId=<clientId>

# Optional. True or false. If set to true, allows the use of clientId values
# up to 65535 characters long. Defaults to false.
# NOTE: clientId values longer than 23 characters may not be supported by all
# MQTT servers. Check the server documentation.
#<broker>.allowLongerClientIds=false

# Optional. User id to authenticate with the broker.
#<broker>.user=<user>

# Optional. Password to authenticate with the broker.
#<broker>.pwd=<password>

# Optional. Set the quality of service level for sending messages to this broker.
# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
# (Deliver exactly once). Defaults to 0.
#<broker>.qos=<qos>

# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
#<broker>.retain=<retain>

# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
#<broker>.async=<async>

# Optional. Defines the last will and testament that is sent when this client goes offline
# Format: topic:message:qos:retained <br/>
#<broker>.lwt=<last will definition>

@adtwomey In the mqtt.cfg you need to change the name or use the same in the items file. The item above has brokwe not broker try changing the item to:

Switch Menu                      "Menu"                                                 {mqtt=">[broker:broadlink/epson_projector/menu:command:ON:play\\:0d43b4e42518],>[broker:broadlink/epson_projector/menu:command:OFF:play\\:0d43b4e42518]"}

Yep already fixed that still didn’t work

//Test
Switch Menu                      "Menu"                                                 {mqtt=">[broker:broadlink/epson_projector/menu:command:ON:play\\:0d43b4e42518],>[broker:broadlink/epson_projector/menu:command:OFF:play\\:0d43b4e42518]"}
 Frame label="TV"  
	   {
           Switch item=Menu label="MENU"
		 }
}

@H102
1:You think this could of don some thing?
2:Is there a away to just uninstall and reinstall?

Uninstall mqtt?

Check that the mqtt binding is installed and if you have the mqtt action binding installed I would uninstall it (mqtt action binding only).

@H102
@H102 Uninstall broadlink-maqq-bridge

I Uninstall and install MQTT
and install and then uninstall action-mqtt
still not working

2018-11-05 01:54:29.971 [thome.event.ExtensionEvent] - Extension 'action-mqtt' has been installed.

2018-11-05 01:54:53.937 [thome.event.ExtensionEvent] - Extension 'binding-mqtt1' has been installed.

2018-11-05 01:55:19.942 [INFO ] [core.karaf.internal.FeatureInstaller] - Uninstalled 'openhab-action-mqtt'

2018-11-05 01:55:19.947 [thome.event.ExtensionEvent] - Extension 'action-mqtt' has been uninstalled.

Did you put password and username to the mosquitto broker?

If yes. Install fresh without pass and user. Reboot. And try again

When I tried with user and password the broadlink Bridge did not work

Can’t say, I have no experience with this device.

If working with mqtt fx then my guess is the OH item or mqtt.cfg is not correct. Check for misspelled words or spaces in the item.

If authentication is required you will need to set that in mqtt.cfg by un-commenting and setting, to match with the device, like below.

# Optional. User id to authenticate with the broker.
broker.user=yourusername

# Optional. Password to authenticate with the broker.
broker.pwd=yourpassword

Also noticed above the address port used is 3000, have you set the device to use port 1883

I have not used authentication on MQTT. Any other idert.

@H102 this it not required @Noam_Shaharabani has said it don’t work with authentication

any other iders.

Oh I useing openhab 2.4

That was posted before I could finish typing.:smile: